2017-04-10 1 views
0

シーム2.2、JSF 1.2、およびRichFacesの3.3を使用して、レガシー・アプリケーションで作業している間は、私は次のような問題が発生しました:readonly属性がtrueに設定されているときにRichfaceのエディタにいくつかのエディタ関数を表示する方法はありますか?

項目がドラフトモードでは、したがって、編集可能です、私が入力するための見栄えの良いエディタを持っており、書式設定テキスト。テキストやアイテムは、いくつかの管理者の承認を通過した後、それはもう編集できません(最後の属性を参照してください - 読み取り専用):

<rich:editor id="a" 
    value="#{pReq.comment}" 
    configuration="editorconfig" 
    autoResize="true" 
    useSeamText="true" 
    theme="advanced" 
    plugins="fullscreen" 
    style="width: 100%;" 
    readonly="#{form.isEditable()}" > 

今同じページを表示するとき、私はすぐに緩んでRichFacesのエディタの機能のすべてと持っているだけで醜い小さなテキストフィールド。しかし、私はフルスクリーントグルなど、まだいくつかの機能が必要です。

誰かが、readonly属性の動作を "過激"にする考えはありますか?

+1

彼らはボンネットの下にCKEditorバージョンを使用しています。豊富なショーケースとckeditorを調べて、必要なものが得られるかどうかを確認します。 http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=editor&sample=advancedConfiguration&skin=blueSky http://docs.ckeditor.com/#!/guide/dev_readonly – axemoi

+1

@axemoi RichFaces 3は[tinyMCE]を使用しています。 (https://www.tinymce.com/docs/) – Makhiel

+0

これは間違いなく、tinyMCE 3 https://www.tinymce.com/docs-3x/です。 I.amが作業を終えるとすぐに私の解決策を掲載します。 – Robert

答えて

0

'readonly = false'に設定すると、richfacesエディタは常に単純なテキストボックスに戻ります。したがって、この場合、この属性は無意味です。代わりに、私は目標を達成するために2つの別個のconfiguration.propertiesファイルを使用して問題を解決しました。

XHTMLは、パラメータ「たconfigFile」に応じて、適切なプロパティファイルをロードします。

<rich:editor id="pLRiTa" value="#{pReq.comment}" 
     autoResize="true" useSeamText="false" 
     configuration="#{configFile}" 
     oninit="tinyMCE.activeEditor.getBody().setAttribute('contenteditable', #{isEditable});"> 
<f:param name="save_enablewhendirty" value="true" /> 
<f:param name="save_onsavecallback" value="savenow" /> 

構成プロパティが編集を有効にしてファイルです。

theme="advanced" 
width="100%" 
plugins="save,paste,fullscreen" 
save_enablewhendirty="true" 
save_onsavecallback="savenow" 
    theme_advanced_buttons1="bold,italic,underline,strikethrough,separator,cut,separator,forecolor,backcolor,separator,save,separator,fullscreen" 
theme_advanced_buttons2="bullist,separator,outdent,indent,separator,undo,redo,separator,cleanup,help,code" 
    theme_advanced_buttons3="pastetext,pasteword,selectall,separator,removeformat,visualaid,separator,sub,sup,separator,charmap" 
theme_advanced_toolbar_location="top" 
theme_advanced_toolbar_align="left" 

構成プロパティファイル編集無効の場合:

theme="advanced" 
plugins="fullscreen" 
theme_advanced_buttons1="fullscreen" 
theme_advanced_buttons2="" 
theme_advamced_buttons3="" 
theme_advanced_toolbar_location="top" 
theme_advanced_toolbar_align="left" 
width="100%" 

そして「savenow」次のように定義されています

<a4j:jsFunction name="savenow" id="savenowid" 
     action="#{plEditModalController.saveWithoutClosing()}" 
     ignoreDupResponses="true" immediate="false" process="plEditAll" 
     oncomplete="console.log('saved')"/> 
関連する問題