首页 > 解决方案 > Primefaces 的 ckEditor 无法在服务器端传递完整内容以进行 pdf 下载处理

问题描述

在 primefaces 插件 ckeditor_config 上遇到了一些问题:并非所有内容都从客户端传递到服务器端:我什至比较了来自客户端的原始内容数据和服务器正在处理的数据,就内容而言,它几乎减少了一半,这意味着第二一半的内容丢失。

配置:

CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here. For example:
    // config.language = 'fr';
    // config.uiColor = '#AADC6E';
    config.fullPage = true;//允许包含html标签
    config.allowedContent = true;
    config.font_names ="MingLiU_HKSCS;Arial;";
    config.removePlugins = 'elementspath';
    config.ignoreEmptyParagraph = true;
    //屏蔽换行符<br>
    config.enterMode = CKEDITOR.ENTER_BR;
    //屏蔽段落<p>
    config.shiftEnterMode = CKEDITOR.ENTER_P;
    config.autoUpdateElement = true;
    config.fillEmptyBlocks=false;
    config.disableObjectResizing = true;
    config.font_defaultLabel = 'MingLiU_HKSCS';
    config.fontSize_defaultLabel = '10px';
    config.toolbar = [
            ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
            ['NumberedList','BulletedList','-','Outdent','Indent'],
            ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
            ['Font','FontSize']
            ];
    
    config.font_style =
    {
    element : 'span',
    styles : { 'font-family' : 'MingLiU_HKSCS' },
    overrides : [ { element : 'font', attributes : { 'face' : null } } ]
    };
};

xhtml:

    <p:panelGrid style="width:595px;">
                    <p:row>
                      <p:column>
                           <pe:ckEditor id="editor" value="#{docxEditorUi.htmlReport}" width="850" height="500" escape="true" 
                                        customConfig="#{request.contextPath}/resources/tci/js/ckeditor_config.js">
                            <p:ajax event="blur" process="@this editForm:editor" />
                            <p:ajax event="save" listener="#{docxEditorUi.saveListener}"/>
                           </pe:ckEditor>
                      </p:column>
                      </p:row>
                      <p:row>
                      <p:column style="float:right;">
                          <p:commandButton id="download" update="@form"
                               value="Download" ajax="false"
                               onclick="javascript:getUpdatedHtmlEditor();">
                               <p:fileDownload value="#{docxEditorUi.getDownloadFile()}" />
                           </p:commandButton>
                           <p:commandButton id="close" value="Close" >
                                 <p:ajax listener="#{docxEditorUi.closeScreen}"/>
                           </p:commandButton>
                      </p:column>
                    </p:row>
                  </p:panelGrid>

Now the client side html string I was able to retrieve it in full and pass it to hidden textare temporaryly:



<html>
<body style="font-family:Calibri; font-size:10pt; background:#ffffff" class="cke_editable 
       .........COMPLETE CONTENTS HERE 
</body>
</html>

然而,当在服务器端/java中调试时,我只得到了一部分,作为回报,一些更新的内容在下载后没有被捕获。我从其他帖子/线程中看到它可能是帖子请求的限制,并试图在我的 server.xml (websphere)中添加 maxPostSize 但找不到我应该把它放在哪里,甚至这是对服务器本身的真正限制...我们的目标是对于来自编辑器的任何内容更新,它应该被传递到服务器进行进一步处理,并能够在下载的 pdf 文档中呈现它。

标签: primefacesckeditor

解决方案


推荐阅读