Editor Esc Key inside Bootstrap Modal
Editor Esc Key inside Bootstrap Modal
HassanDomeDenea
Posts: 29Questions: 10Answers: 0
in Editor
Greetings,
Sometimes I use a datatable inside a bootrap Modal, or any other modal.
When trying to use an editor actions, and the lightbox appear, and deciding to cancel, the ESC key is usually used.
Anyway this will cause the editor lightbox to hide, and also the main bootstrap modal to hide also.
So is there a way to overide this problem? for example, **stopPropagation() **or something like this ?
And thanks.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You can control the behavior of the Escape key with
form-options
- see the onEsc property.Colin
Thank you for the reference and I tried it. Indeed I can change the behavior, but it seems that I can't stop the another bootstrap modal from hiding with using event.stopPropagation(). It seems that I should modify the bootstrap modal itself.
Thank you.
Hi,
Good question - I think they are both listening at the top level of the document for the keyup event. You could try
stopImmediatePropagation()
but I'm not entirely certain that would give the desired result either - my concern is that the Bootstrap listener is actually added after the Editor one, so the Bootstrap modal will always disappear first.It might require a hook into the Bootstrap code to check for an Editor modal - if present then don't hide the Bootstrap one. You could do that if the Bootstrap
hide.bs.modal
event allowspreventDefault()
to stop the escape key doing anything, but it doesn't say anything about that in their documentation.Allan