0

我尝试在 JSF 页面中使用 CKEditor,例如:

<pe:ckEditor id="editor" value="#{messagingController.messageContent}" width="600"/>

编辑器将出现在 Internet Explorer 中,但不会出现在 Fire Fox 或 Chrome
中 FireBug 显示以下错误:

SyntaxError: An invalid or illegal string was specified

Chrome 控制台向我显示以下错误:

Uncaught SyntaxError: Failed to set the 'innerHTML' property on 'Element': 
The provided markup is invalid XML, and therefore cannot be inserted into an XML document.

CKEDITOR.plugins.add.afterInit
(anonymous function)
k
CKEDITOR.scriptLoader.load
(anonymous function)
(anonymous function)
(anonymous function)
k
CKEDITOR.scriptLoader.load
CKEDITOR.resourceManager.load
i
(anonymous function)
k
(anonymous function)
(anonymous function)
(anonymous function)
k
l
o
(anonymous function)

这是一个错误还是什么?我可以以任何其他方式包含此组件吗?

我还使用最新的 primefaces 扩展库:

<groupId>org.primefaces.extensions</groupId>
<artifactId>primefaces-extensions</artifactId>
<version>3.0.0</version>
4

2 回答 2

0

问题出在我的页面的 mime 类型上!当我将其从 更改application/xhtml+xml为 时text/html,问题就解决了。

于 2014-11-30T14:19:54.370 回答
0

对已经正确答案的小补充:

在 iOS Safari 中也会出现这个语法错误。一个指示是您的文档变量compatMode:"CSS1Compat"(在 js 中),然后 ckEditor 将在此函数中导致错误,x.innerHTML = "some string with html entities"因为使用错误的 mime 类型读取文档。

当文档具有compatMode:"BackCompat". 这是由浏览器设置的,取决于内容类型。媒体类型。

于 2016-05-12T05:44:55.830 回答