【发布时间】:2019-01-23 04:14:20
【问题描述】:
我的页面上加载了一个 CKEDITOR,它似乎工作正常。内容以 NVARCHAR(max) SQL Server 字段中的完整 HTML 代码保存到数据库中。
保存后数据库字段的内容
<p>this was a test for the full round trip with <a href="http://www.google.com">click here</a> to link to the google</p>
<p>and an additional line here</p>
<p>and one more here</p>
<p> </p>
当我尝试通过数据库读取或硬编码值将该字符串加载到 CKEDITOR 中时,不会显示上下文。
这是我迄今为止尝试过的。
$('#beb_header').val('');
CKEDITOR.instances['editor1'].setData('');
$('#beb_header').val(httpResult[0].header);
CKEDITOR.instances['editor1'].setData("<b>test</b>");
// CKEDITOR.instances['editor1'].setData(httpResult[0].message);
// CKEDITOR.instances['editor1'].insertHTML(httpResult[0].message);
上面的代码似乎可以正常工作,除非我尝试加载内容。 conte 的硬编码和另外两行没有在编辑区域显示文本 - 除非我切换到 html 代码视图,然后有时,数据会显示在窗口中......有时。
我错过了什么吗?
【问题讨论】:
标签: javascript ckeditor