Tinymce 4-纯文本/条形HTML标签按钮



是否有一种方法可以完全剥离其样式和HTML标签的选定元素?

所以<p>Text</p>将成为Text

使用自定义按钮(函数)或格式下拉的"纯文本"样式?

尝试

selection.getContent({格式:'text'});

selection.getContent({格式:'html'});

感谢Anub的方向,我自己做了这个。

// Store the current selections string/value in a variable and strip it's tags
var node = tinymce.activeEditor.selection.getContent({ format : 'text' });
// Replace the selected content with the stripped out content
tinymce.activeEditor.selection.setContent(node);

最新更新