Javascript tinymce getcontent适用于未应用过滤器的完整html

Javascript tinymce getcontent适用于未应用过滤器的完整html,javascript,editor,tinymce,wysiwyg,Javascript,Editor,Tinymce,Wysiwyg,我想检索tinymce区域的html内容,但是没有应用清理和过滤器。我该怎么做?例如,通过此调用可以从html源代码中删除换行符,但我希望保留它们 我在chrome中测试过的函数调用: console.log(tinyMCE.activeEditor.getContent({ format: 'raw' })); console.log(tinyMCE.activeEditor.getContent({ format: 'text' })); 这是使用jQuery的简单方法: var ed

我想检索tinymce区域的html内容,但是没有应用清理和过滤器。我该怎么做?例如,通过此调用可以从html源代码中删除换行符,但我希望保留它们

我在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.get(0),因为大多数情况下只有1个tinymce。如果只有一个编辑器实例,这是正确的。您也可以使用tinymce.editors[0]或
tinymce.activeEditor
几乎正确,但请记住,如果用户尚未点击编辑器,tinymce.activeEditor将为空