我想检索tinymce区域的html内容,但没有应用清理和过滤器。我怎样才能做到这一点?例如,通过此调用,换行符已从 html 源中删除,但我想保留它们。
http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.getContent
我在 chrome 中测试过的函数调用:
console.log(tinyMCE.activeEditor.getContent({ format: 'raw' }));
console.log(tinyMCE.activeEditor.getContent({ format: 'text' }));
最佳答案
这是使用 jQuery 的简单方法:
var ed = tinymce.get('your_editor_id');
var content = $(ed.getBody).html();
请注意,内容内可能有一些tinymce内部标记(跨度)。
关于javascript - tinymce getcontent 获取未应用过滤器的完整 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12567772/