我想在html编辑器(而不是导航栏)内添加可点击的按钮/图片/ div。但是,当我使用onBeforeSetContent.add函数过滤内容并添加一个标签时,该标签被剥离。TinyMCE在编辑器中添加可点击的按钮/ div
这是所有通过tinymce插件btw完成,因为我使用Wordpress。
//replace shortcode before editor content set
ed.onBeforeSetContent.add(function(ed, o) {
o.content = t.filter_content(o.content);
});
...
filter_content : function(co) {
return co.replace(/\[icitspot([^\]]*)\]/g, function(a,b){
return '<img src="#" onclick="alert(\'abc\')" class="wpSpot mceItem" title="clickme" />';
});
},
1固体有效的解决方案 – Thariama