-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Link editing does not work within modal dialogs #1121
Comments
@IvoJager this is an interesting case and I think your theory is correct where jQuery is preventing focus from going into the toolbar since the toolbar is not a child of the dialog. MediumEditor does support a I've updated your fiddle here to use the You can pass the option like this: var editor = new MediumEditor('#dialog .editable', {
toolbar: {
relativeContainer: document.querySelector("#dialog")
}
}); Will that help you work around the issue? |
Really appreciate the quick response and suggestion! Unfortunately, the placement/presentation in the updated fiddle (and in my code base) does not match that of the (IMHO very nice) default behaviour; the toolbar is positioned after the editable, rather than positioned absolutely ("floating") near the selected text. With the workaround as-is, the toolbar may even "appear" off-screen if the text is long and scrolling was needed, though that is obviously easy to fix by affixing it to something else that doesn't scroll. If there's an easy way to mimic the default behavior and achieve the "floating" positioning I'd love to know though! FWIW, the same issue was accepted as a "bug" by Imperavi/Redactor RTE a couple of years ago, and given that other UI frameworks use similar techniques to make dialogs "modal", IMHO it's probably worth fixing. Thanks again! |
FWIW, for anyone who has the same issue using jQuery UI, a workaround can be created through the _allowInteraction extension, e.g. like so; $.widget( "ui.dialog", $.ui.dialog, {
_allowInteraction: function( event ) {
return !!$( event.target ).closest( ".medium-editor-toolbar" ).length || this._super( event );
}
}); |
I definitely agree it's worth fixing, if you come up with some fix within medium-editor please open a PR! |
Description
Editing and creating links does not work (passes through events to underlying RTE instead) when the RTE is embedded in a modal dialog.
This is likely because some auxiliary/helper divs/elements are erroneously appended to the body (which are therefore non-responsive in a modal dialog), rather the element containing the RTE.
Steps to reproduce
Expected behavior: Link should be editable
Actual behavior: Link editing dialog closes and any keystrokes are passed to underlying RTE instead.
Link to an example: https://jsfiddle.net/arnkmdnL/2/
Versions
The text was updated successfully, but these errors were encountered: