【问题标题】:Joomla! 1.5.26 TinyMCE init from JEditor or JavascriptJoomla! 1.5.26 来自 JEditor 或 Javascript 的 TinyMCE 初始化
【发布时间】:2012-06-27 07:34:37
【问题描述】:

基本上,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(视图)中设置编辑器设置? (我没有找到具体的参数)

我创建了以下启用或禁用编辑器的函数(感谢 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 为空。

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

谢谢!

【问题讨论】:

    标签: jquery joomla tinymce


    【解决方案1】:

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

    【讨论】:

    • 基本上,阅读文档link(非常差)不可能根据我组件的 view.html.php 中设置的自定义 PHP 参数设置 JCE CSS。我决定在 jQuery 级别执行此操作,但当然 DOM 中的 jEditor obj 尚未在 jQuery .ready() 中定义。不可能完成的任务?
    • 那么,您基本上是想在编辑器中添加自定义样式表?
    • 这可能是一种解决方法。在 default.php(Joomla!MVC 模式的 HTML 模板)中,我可以将主题设置为禁用(但我不知道如何将编辑器可编辑参数设置为 false,以及如何为编辑器加载不同的 CSS PHP 级别(echo $editor->display('emailText', $this->articleFullText, '960', '700', '20', '20', false);)...反正)。简而言之,基于从模型中获取的 PHP 变量,我加载禁用的编辑器,否则我加载默认编辑器...
    • 你根本没有javascript选项?
    • 你可以访问tinymce初始化吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多