简体   繁体   中英

Joomla! 1.5.26 TinyMCE init from JEditor or Javascript

Basically, the Joomla! editor (JCE/TinyMCE) based on a parameter can be enabled or disabled when the users load the specific page. Disabled means: the content is not editable and the opacity background must be set.

In the 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);
?>

Is it possible to set the editor settings in the default.php (view)? (I did not find any specific parameter)

I created the following function (thanks to stackoverflow) which enables or disables the editor

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);
    }
}

But, if I call the function within the jQuery .ready the editor DOM obj is null.

How and where in code can I set/change the editor setting?

Thanks!

This depends on which editor setting you want to change and the point of time. It is possible to set some parameters onInit of the editor. Some other parameters cannot be changed afterwards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM