的Joomla! 1.5.26来自JEditor或Javascript的TinyMCE init

时间:2012-06-27 07:34:38

标签: jquery joomla tinymce

基本上,Joomla!当用户加载特定页面时,可以启用或禁用基于参数的编辑器(JCE / TinyMCE)。 已禁用表示:内容不可编辑,且必须设置不透明度背景。

在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(view)中设置编辑器设置? (我没有找到任何具体的参数)

我创建了以下函数(感谢stackoverflow),它启用或禁用了编辑器

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 .ready中调用该函数,则编辑器DOM obj为null。

我可以在代码中如何以及在何处设置/更改编辑器设置?

谢谢!

1 个答案:

答案 0 :(得分:1)

这取决于您要更改的编辑器设置和时间点。 可以在编辑器的onInit上设置一些参数。之后无法更改其他一些参数。