Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
tinyMCE v6 event bubbling

I trying to catch keydown triggered on < p > element inside of editor iFrame but with this code, i getting textarea element. Event.stopPropagation() does not stop bubbling, i still getting topmost element

tinymce.init({
   selector: 'textarea',
   setup:function(editor) {
      editor.on('keydown', function(event) {
         console.log(event.target);
      });
   }
});

I see tinymce.event in API with its own stopPropagation() method but don't get how to make it work. Tinymce.event return undefined same as editor.event or tinymce.Event.type

also, there is eventDispatcher Utility API but trying to process keydown via eventDispatcher.dispatch() triggered inside of editor.on keydown get me nothing

In the end, I tried to remove class/style from a block inside of the editor. And cause this block is added programmatically I cant do this with the class name. I need an element pointer where is keydown happened

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Find out that I can use tinyMCE selection helper to get an element with current focus (which triggered an event) and solve my task

So the final code is

tinymce.init({
    selector: 'textarea',
    setup:function(editor) {
       editor.on('keydown', function(event) {
           const element = editor.selection.getNode();
    
           if (editor.dom.hasClass(element, 'classname')) {
    
           }  
       }
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!