admin管理员组文章数量:1415137
This is a simple code to create a function in the TinyMCE (Advanced) editor. It creates an icon in the toolbar and once you click it some DIV tags will be added into the editor. This works great.. But how can I undo that style (div) from the element.
This will be added to the editor, once you click on the icon:
<div class="kader well"><div class="remove_kader"></div><p> [TEXT] </p></div>
I want to create a function to remove the div elements from the (selected) text. The best way would be, when you click on the "remove_kader" DIV. See below (the blue arrow).
tinymce.create('tinymce.plugins.wpse723953_plugin', {
init : function(ed, url) {
ed.addCommand('wpse72395_insert_shortcode', function() {
selected = tinyMCE.activeEditor.selection.getContent();
if( selected ){
content = '<div class="kader well"><p>'+selected+'</p><div class="remove_kader"></div></div>';
}else{
content = '<div class="kader well"><p></p><div class="remove_kader"></div></div>';
}
tinymce.execCommand('mceInsertContent', false, content);
});
ed.addButton('mm_kader', {title : 'Kader aanmaken', cmd : 'wpse72395_insert_shortcode', image: url + '/icon.png' });
}
});
tinymce.PluginManager.add('mm_kader', tinymce.plugins.wpse723953_plugin);
本文标签: TinyMCE function Remove (earlier) added style from the editor
版权声明:本文标题:TinyMCE function: Remove (earlier) added style from the editor 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745195444a2647111.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论