Answer the question
In order to leave comments, you need to log in
How to remove wrap tag in tinyMCE editor?
In the tinyMCE editor, the necessary piece of text is wrapped in tags for me. <div class="gallery">...</div>
How can I make a button that would clear the entire code from such tags, or only the part where the cursor is?
Analogue highlighting in bold, exposing links.
What is:
I created a button in the editor that wraps the selected piece with <div class="gallery">...</div>
button code tags:
var selected = $('#container').tinymce().selection.getContent();
$('#container').tinymce().execCommand('mceReplaceContent', false, '<div class="my_select">'+selected+'</div>');
<div class="gallery">
<img src="...">
<p>....</p>
</div
<div class="gallery">
<div class="gallery">...</div>
<img src="...">
<p>....</p>
</div>
Answer the question
In order to leave comments, you need to log in
I decided to abandon such editors altogether, in favor of CodeMirror, which I advise you to do as well. There are also disadvantages, there is no visual editor, but for me it's even better. If you need a ready-made CodeMirror with connected plugins, please contact me (all contacts can be found in Brainstorage).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question