mind-elixir-core icon indicating copy to clipboard operation
mind-elixir-core copied to clipboard

Editable should prevent edit but not selection

Open arvindm1991 opened this issue 2 years ago • 2 comments

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?

arvindm1991 avatar Aug 19 '23 18:08 arvindm1991

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

SSShooter avatar Aug 27 '23 10:08 SSShooter

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

arvindm1991 avatar Aug 27 '23 12:08 arvindm1991