简体   繁体   English

的Joomla! 1.5.26从JEditor或Javascript初始化TinyMCE

[英]Joomla! 1.5.26 TinyMCE init from JEditor or Javascript

Basically, the Joomla! 基本上就是Joomla! editor (JCE/TinyMCE) based on a parameter can be enabled or disabled when the users load the specific page. 用户加载特定页面时,可以启用或禁用基于参数的编辑器(JCE / TinyMCE)。 Disabled means: the content is not editable and the opacity background must be set. 禁用表示:内容不可编辑,并且必须设置不透明度背景。

In the default.php: 在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)? 是否可以在default.php(视图)中设置编辑器设置? (I did not find any specific parameter) (我没有找到任何特定的参数)

I created the following function (thanks to stackoverflow) which enables or disables the editor 我创建了以下功能(由于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);
    }
}

But, if I call the function within the jQuery .ready the editor DOM obj is null. 但是,如果我在jQuery .ready中调用该函数,则编辑器DOM obj为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. 可以在编辑器的init上设置一些参数。 Some other parameters cannot be changed afterwards. 此后无法更改其他一些参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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