我需要我的pe:ckEditor加载自定义配置,但我已经在这件事上失败了一段时间,我将欢迎任何建议,如何使它工作。
(我需要它的功能,因为我有这样的问题:PrimeFaces Extensions CKEditor: attempts to set encoding to UTF-8 unsuccessful,它可能通过这个https://ckeditor.com/old/forums/CKEditor-3.x/utf-8-ckeditor或类似于这个https://ckeditor.com/old/forums/Support/Change-charset-UTF-8的东西来解决)
自定义配置文件与pe:ckEditor所在的XHTML位于同一个文件夹中。
自定义配置内容:
CKEDITOR.editorConfig = function( config ) {
config.uiColor = '#AADC6E';
config.toolbar = [
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
'/',
{ name: 'links', items: [ 'Link', 'Unlink' ] },
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
'/',
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'insert', items: [ 'Table', 'HorizontalRule', 'SpecialChar'] },
{ name: 'tools', items: [ 'ShowBlocks' ] },
{ name: 'document', items: [ 'Source' ] },
];
};我试过:
<h:outputScript name="ckEditor.js" library="js"></h:outputScript>
<pe:ckEditor id="editor" customConfig="ckEditor.js"></pe:ckEditor>
<script type="text/javascript">
CKEDITOR.config.customConfig = 'ckEditor.js';
CKEDITOR.replace('editor');
</script>和:
<h:outputScript name="ckEditor.js" library="js"></h:outputScript>
<pe:ckEditor id="editor" customConfig="ckEditor.js"></pe:ckEditor>和:
<pe:ckEditor id="editor"></pe:ckEditor>
<script type="text/javascript">
CKEDITOR.config.customConfig = 'ckEditor.js';
CKEDITOR.replace('editor');
</script>和:
<pe:ckEditor id="editor" customConfig="ckEditor.js"></pe:ckEditor>和:
<pe:ckEditor id="editor" customConfig="./ckEditor.js"></pe:ckEditor>和(文件的完整路径是project/WebContent/pages/inc/ckEditor.js和project/WebContent/pages/inc/emailEditor.xhtml):)
<pe:ckEditor id="editor" customConfig="project/WebContent/pages/inc/ckEditor.js"></pe:ckEditor>和:
<pe:ckEditor id="editor" customConfig="/project/WebContent/pages/inc/ckEditor.js"></pe:ckEditor>和(由于https://forum.primefaces.org/viewtopic.php?t=31334):
<pe:ckEditor id="editor" customConfig="#{request.contextPath}/ckEditor.js"></pe:ckEditor>当我将自定义配置文件中的详细信息输入到<pe:ckEditor>下面的<pe:ckEditor>中时,它起了作用,但不幸的是,对于我的情况来说,这不是一个解决方案,因为我在许多页面上使用了编辑器,并且只需要将其设置存储在一个地方。
而且,当我在googling中搜索时,我发现了一些建议,即我应该将自定义配置的方向放置到默认配置文件中,但是我还没有在我的项目中找到任何默认配置文件,因此不幸的是,这对我来说不是一个选项。
我做过谷歌,在PrimeFaces扩展页面和CKEditor页面上阅读文档,在PrimeFaces论坛、CKEditor论坛和这里阅读类似的问题,但是还没有成功。
PrimeFaces扩展-版本7.0.2
PrimeFaces - 7.0.7版
发布于 2020-01-06 19:49:23
customConfig属性在pe:ckEditor上是一个URL。
所以,只要把你的JS放在一个可以通过浏览器访问的地方。
如果它可访问(例如)为localhost:8080/myfolder/ckeditor.js,那么当您将customConfig设置为‘{request.contextPath}myFolder/ckeditor.js’时,它应该正确工作。
https://stackoverflow.com/questions/59612256
复制相似问题