简体   繁体   English

在tinymce中向身体添加内联css

[英]add inline css to body in tinymce

I'm importing some html from a external source into tinyMCE. 我正在从外部来源将一些html导入tinyMCE。 I have 2 questions: 我有两个问题:

If i do tinyMCE.execInstanceCommand('mce_editor_0','mceSetContent', false, myVar); 如果我做tinyMCE.execInstanceCommand('mce_editor_0','mceSetContent', false, myVar); and myVar has a doctype and header etc defined, it seems to just take the body content. 并且myVar已定义了doctype和header等,它似乎只是接受正文内容。 Is this a correct behavior? 这是正确的行为吗?

Since myVar has some inline css within its body tag and mceSetContent() doesn't import it, i need to pass it myself. 由于myVar的body标签内有一些内联CSS,而mceSetContent()不会导入它,因此我需要自己传递它。 So how can i add inline css to the body of a tinyMCE instance? 那么,如何将内联CSS添加到tinyMCE实例的主体中?

Thanks 谢谢

This is correct bahaviour. 这是正确的行为。 What you paste goes into the editors iframe body. 您粘贴的内容将进入编辑器iframe主体。 doctype and css stuff not. doctype和CSS的东西没有。 The only thing you could do about that is to use the paste setting paste_preprocess , filter your css stuff out and insert it into the editors ifram head. 您唯一可以做的就是使用粘贴设置paste_preprocess ,过滤掉CSS内容并将其插入到编辑器ifram头中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM