[英]tinyMCE setContent strips closing p-tag
i want to put the content from a database field to the tinyMCE editor on page load. 我想在页面加载时将数据库字段中的内容放到tinyMCE编辑器中。 For that i've got a php function like this: 为此,我有一个像这样的php函数:
public function __loadTinyMCE($jobscopeIntroText) {
print '
<script type="text/javascript">
function loadDefaultTinyMCEContent(){
tinyMCE.activeEditor.setContent("'.$jobscopeIntroText.'", {format : "raw"});
}
</script>
';
$jobscopeIntroText
is the html content i previously wrote into the tinyMCE editor and comes from the database. $jobscopeIntroText
是我以前写到tinyMCE编辑器中的html内容,来自数据库。
When i write eg: 当我写例如:
<p>Hello< /p>< p>This is a new line< /p>
it doesnt work and the html code in setContent()
is broken after the first closing p-tag. 它不起作用, setContent()
的html代码在第一个关闭的 p标签之后中断。 In chrome developer tools the text before the first closing p-tag is red and after that it's black. 在chrome开发人员工具中,第一个闭合p-tag之前的文本为红色,之后为黑色。 Even if there are no " or ' within the html. With only one closing p-tag it works. 即使html中没有“或”,也只能使用一个关闭的p标签。
Anyone knows the problem here? 有人知道这里的问题吗?
I think you should use this code once all contents will be loaded. 我认为一旦所有内容都将加载,就应该使用此代码。 Therefore there can be ways to achieve desire result: 因此,可以有一些方法来达到期望的结果:
I hope this will work for you. 希望这对您有用。 Please do let me know for specific scenario. 对于特定情况,请务必让我知道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.