2012-06-27 43 views
2

基本上,Joomla!當用戶加載特定頁面時,可以啓用或禁用基於參數的編輯器(JCE/TinyMCE)。 禁用表示:內容不可編輯,不透明背景必須設置。Joomla! 1.5.26來自JEditor或Javascript的TinyMCE init

在如default.php:

<?php 
    $editor =& JFactory::getEditor(); 
    /* 
    Parameter Type Default Description 
    $name string The control name 
    $html string The contents of the text area 
    $width string The width of the text area (px or %) 
    $height string The height of the text area (px or %) 
    $col int The number of columns for the textarea 
    $row int The number of rows for the textarea 
    $buttons boolean true True and the editor buttons will be displayed 
    $params array array() Associative array of editor parameters 
    */ 
    echo $editor->display('emailText', $this->articleFullText, '960', '700', '20', '20', false); 
?> 

是否有可能設置在如default.php(視圖)編輯器設置? (我沒有發現任何具體的參數)

我創建了下面的函數(感謝計算器),它允許或禁止編輯

function setEditorEditable(editable) { 
    if (editable == 1) { 
     tinymce.get(tinymce.activeEditor.id).getBody().setAttribute('contenteditable', 'true'); 
     J('#' + tinymce.activeEditor.id + '_parent').fadeTo(0, 1); 
    } else { 
     tinymce.get(tinymce.activeEditor.id).getBody().setAttribute('contenteditable', 'false'); 
     J('#' + tinymce.activeEditor.id + '_parent').fadeTo(0, 0.5); 
    } 
} 

但是,如果我調用函數中jQuery的。就緒的編輯器DOM obj爲null。

如何以及在代碼中哪裏可以設置/更改編輯器設置?

謝謝!

回答

1

這取決於您想要更改哪個編輯器設置以及時間點。 可以設置編輯器的一些參數onInit。其他一些參數以後不能更改。

+0

基本上,閱讀文檔[鏈接](http://docs.joomla.org/JEditor/1.5)(很差),無法基於view.html中的自定義PHP參數集來設置JCE CSS 。我的組件的.php。我決定在jQuery級別執行此操作,但當然,DOM中的jEditor obj尚未在jQuery .ready()中定義。不可能完成的任務? – Daviddd

+0

所以,你基本上想要添加一個自定義樣式表到編輯器? – Thariama

+0

這可能是一種解決方法。在default.php(MVC模式的Joomla!HTML模板)中,我可以將主題設置爲禁用(但我不知道如何將編輯器可編輯參數設置爲false,以及如何爲編輯器加載不同的CSS PHP的水平(echo $ editor-> display('emailText',$ this-> articleFullText,'960','700','20','20',false);)...無論如何)。 簡而言之,基於從模型中獲得的PHP變量,我加載禁用的編輯器,否則我加載默認編輯器... – Daviddd