medium-editor icon indicating copy to clipboard operation
medium-editor copied to clipboard

Cross Browser Issue in Bootstrap Modal

Open stevetrader opened this issue 9 years ago • 10 comments

Description

Using medium-editor inside a Bootstrap modal, the changes do not take affect in Chrome. Works fine in Safari.

Steps to reproduce

  1. Use this generic fiddle for testing. https://jsfiddle.net/he2nnuhf/5/
  2. Tests without modal work fine in any browser.
  3. Use the modal button to test inside the modal. Changes (bold for example) take affect just fine in Safari, Chrome does not work.

Expected behavior: Changes take affect in all browsers

Actual behavior: Chrome does not work.

Link to an example: https://jsfiddle.net/he2nnuhf/5/

Versions

  • medium-editor: 5.22.0
  • browser: Chrome 53.0.2785.116 & Safari 10.0 (12602.1.50.0.10)
  • OS: MacOS Sierra

stevetrader avatar Sep 28 '16 15:09 stevetrader

+1 Same issue for me. Not compatible with bootstrap modals

Workaround:

new MediumEditor('.angular-medium-editor');
new MediumEditor('.angular-medium-editor');

Instantiate two times using the class angular-medium-editor or it will not work, but be aware that this will use more CPU and may expect problems if you have more than one editor on a single page, waiting for an official fix

manuel-di-iorio avatar Sep 29 '16 06:09 manuel-di-iorio

+1

ryanaverill avatar Oct 03 '16 21:10 ryanaverill

+1 Same issue for me.

marco-fp avatar Oct 27 '16 10:10 marco-fp

+1 Same issue for me

yodharox avatar Nov 04 '16 10:11 yodharox

+1 Same for me Any update on this? this is a huge drawback :(

essevidotto avatar Nov 22 '16 15:11 essevidotto

I ended up writting a "custom modal" imitating bootstrap style. Kinda dirty but it worked.

marco-fp avatar Nov 22 '16 15:11 marco-fp

Removing tabindex=-1 from your modal fix the issue but is kinda dirty.

You could try using 'elementsContainer' option to specify which element should contain the medium-editor (the modal for example), with this last solution, the toolbar won't be displayed anymore for siblings/parents elements.

ThomasBenoist avatar Dec 02 '16 10:12 ThomasBenoist

Potentially related issues: #1121 + #857

nmielnik avatar Feb 08 '17 06:02 nmielnik

+1 for me, as temporary fix the solution by @ThomasBenoist works

MirkoMignini avatar Feb 17 '17 15:02 MirkoMignini

That fixed it for me: Use elementsContainer to attach the Medium-Editor's toolbar to the modal node. @ThomasBenoist pointed in this direction.

Here is my example with #pages_edit_dialog as id of the modal-div and jQuery:

   $("#pages_edit_dialog").on('shown.bs.modal', function () {
      var editor = new MediumEditor('#page_leadtext_editable', {
          elementsContainer: this,
          toolbar: {
              buttons: ['bold', 'italic', 'underline', ...

I first thought that using a textarea instead of an editable div broke the toolbar but it was the wrong node for the editor (Default: document.body).

rluetke avatar Mar 21 '22 11:03 rluetke