我正在使用 Javascript 函数获取托管在我的服务器上的 HTML 文件的内容,然后将内容添加到 TinyMCE 编辑器。
这是函数:
function LoadTemplate(url) {
$.post(url, function (data) {
// Get the editor instance that we want to interact with.
var ed = tinyMCE.get('html_editor');
;
// Insert the response into TinyMCE editor
ed.setContent(data, {format : 'raw'});
// Hide The Templates Div
HideTemplates();
}, "text");
}
用户选择文件后,点击Load template,HTML文件插入TinyMCE编辑器没有任何问题,但是点击提交后,我在数据库中找到了文档的head,以及CSS in style标签已被 TinyMCE 删除。
我添加到 TinyMCE 常规选项:
element_format : "html",
verify_html : false,
但还是报错
最佳答案
默认情况下,TinyMCE 只对包含在文档 <body>
中的页面内容感兴趣。部分。如果你想让 TinyMCE 编辑文档的每个部分,尤其是 <head>
部分,那么您将需要整页插件。
关于php - TinyMCE 从我的 HTML 代码中删除 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9318709/