Skip to content Skip to sidebar Skip to footer

Tinymce : Don't Replicate Class When Adding A New Paragraph On Enter

Using a custom button, I add a paragraphe with a class and some content, like so :

my custom content

When I press enter after such a parag

Solution 1:

Found out a solution :

...
setup: function (ed) {
    ed.on('keydown',function(e) {
        if(e.keyCode == 13){
            if(ed.dom.hasClass(ed.selection.getNode(), 'mce-new-class')){               
                ed.selection.setContent('<p>&nbsp;</p>'); 
                returnfalse;                   
            } else {                
                returntrue;
            }
        }
    });
},
...

Post a Comment for "Tinymce : Don't Replicate Class When Adding A New Paragraph On Enter"