question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TinyMCE dialogs input fields not working with Materialize

See original GitHub issue

Hey!

I’ve an issue using Materialize and TinyMCE within a modal. TinyMCE dialog input fields are not accessible. I tried to stop events propagation but it doesn’t work.

$(document).on('focusin', function(e) {
  if ($(e.target).closest(".mce-window, .moxman-window").length) {
    e.stopImmediatePropagation();
  }
});

This code works with jQueryUI dialog but not with Materialize. I think the dropdown component had a similar issue: https://github.com/Dogfalo/materialize/issues/1683

Please take a look at this CodePen: https://codepen.io/anon/pen/rKWxwK

Thanks for assistance.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

8reactions
sigma-technologycommented, Mar 3, 2019

Thank you for the quick response. Recompiling the JS isn’t really an option for us unfortunately as we’re using NPM.

However, your code does work perfectly - I’ve managed to override that function using $.extend, so anyone using jQuery should be able to do the same:

$.extend(M.Modal.prototype, {
  _handleFocus(e) {
    if (!this.el.contains(e.target)
       && this._nthModalOpened === M.Modal._modalsOpen
       && document.defaultView.getComputedStyle(e.target, null).zIndex < 1002) {
      this.el.focus();
    }
  }
});

I’ve updated the codepen.

@Dogfalo I realise this isn’t technically a Materialize issue, but would it be possible to include some sort of generic solution such as the one above into the next release?

0reactions
nikolaysmcommented, May 15, 2020

It can also be resolved to setting dismissible: false

$(document).ready(function() {
    $('.modal-tinymce').modal({dismissible:false,});
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

TinyMCE not working: possible causes and fixes
Another issue you might run into is TinyMCE initializing correctly, but the main purpose for the text editor being in the page isn't...
Read more >
TypeError: _co.keyupHandler is not a function in Angular 4 ...
I followed this guide https://go.tinymce.com/blog/angular-2-and-tinymce/ and i got the editor working, but get this error when i type ...
Read more >
Update TinyMCE integration to 3.x [#245799] | Drupal.org
No errors now, but the editor's toolbar does not show in any field. I double and triple checked tinymce settings (v3) and the...
Read more >
How to Integrate Custom Rich Text-Editor in Your Django ...
django-tinymce is a Django application that contains a widget to render a form field as a TinyMCE editor. Features :-.
Read more >
[Best solution]-TinyMCE scrubbing HTML in Umbraco
I've followed Allow any markup in the tinymce editor with no effect. Can I stop TinyMCE scrubbing my HTML? EDIT: I've reproduced the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found