Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editable should prevent edit but not selection #215

Open
arvindm1991 opened this issue Aug 19, 2023 · 2 comments
Open

Editable should prevent edit but not selection #215

arvindm1991 opened this issue Aug 19, 2023 · 2 comments

Comments

@arvindm1991
Copy link

arvindm1991 commented Aug 19, 2023

From mouse.ts,

mind.map.addEventListener('click', e => {
   // if (dragMoveHelper.afterMoving) return
   // e.preventDefault() // can cause <a /> tags don't work
   const target = e.target as any
   if (target.tagName === 'ME-EPD') {
     mind.expandNode((target as Expander).previousSibling)
   } else if (!mind.editable) {
     return
   } else if (isTopic(target)) {
     mind.selectNode(target as Topic, false, e)
   } ...
   
   
    mind.map.addEventListener('dblclick', e => {
   e.preventDefault()
   if (!mind.editable) return
   const target = e.target as HTMLElement
   if (isTopic(target)) {
     mind.beginEdit(target as Topic)
   }
 })

Preventing dblclick makes sense but preventing selection itself does not make sense I think. I have a teacher, student use case where students can't edit a node but should be able to select the node and use focus. I currently cannot do this because setting editable = false is making the mindmap readonly with no interactions. Focus or select or unselect are all passive operations and shouldn't be considered for mind.editable

Does anyone have a suggestion on how I can get selection to work without allowing dblclick?

@SSShooter
Copy link
Owner

Currently if editable is set to false then the map mind is a totally readonly version (without any interaction)

@arvindm1991
Copy link
Author

arvindm1991 commented Aug 27, 2023

Yes. I'm proposing that this should be changed to prevent dblclick only and not prevent selection. Allowing select allows us to implement plugins but as it is implemented now, we implement anything since the node cannot be selected in editable=false condition. @SSShooter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants