Closed 1pone closed 3 months ago
Optimize for this pr https://github.com/josdejong/svelte-jsoneditor/pull/396
Thanks! I think the approach to extend onRenderContextMenu
to return false
is the right approach. However I think implementing it neatly requires a bit more refactoring internally. The onRenderContextMenu
callback should be invoked only once, and we should not introduce a "test call" with empty items to see if it does return false (that can lead to unexpected behavior.
Right now, onRenderContextMenu
is called inside TreeContextMenu
and TableContextMenu
. I think this call should be pulled out of those components, it should be moved to the two openContextMenu()
implementations: invoke onRenderContextMenu
, if it returns false, cancel opening the modal, and otherwise, pass the items to the modal. Does that make sense?
Thanks for the suggestion, I've tried to rewrite this part of the code in https://github.com/josdejong/svelte-jsoneditor/pull/411, can you help me see if there's any problem?
Published now in v0.23.0
Always hide the context menu when
onRenderContextMenu
returnfalse