如何在Joomla中以编程方式向编辑器插入文本?

如何在Joomla中以编程方式向编辑器插入文本?,joomla,editor,joomla-article,Joomla,Editor,Joomla Article,我使用的是Joomla 1.7,我制作了一个自定义按钮(编辑器xtd插件) 我想在当前编辑器内容中插入一些字符串 就像在Readmore按钮中一样。我搜索了Readmore代码,发现: $js = " function insertReadmore(editor) { var content = $getContent if (content.match(/<hr\s+id=(\"|')system-readmore(\"

我使用的是Joomla 1.7,我制作了一个自定义按钮(编辑器xtd插件) 我想在当前编辑器内容中插入一些字符串

就像在Readmore按钮中一样。我搜索了Readmore代码,发现:

$js = "
    function insertReadmore(editor) {
        var content = $getContent
        if (content.match(/<hr\s+id=(\"|')system-readmore(\"|')\s*\/*>/i)) {
            alert('$present');
            return false;
        } else {
            jInsertEditorText('<hr id=\"system-readmore\" />', editor);
        }
    }
";
$js=”
函数insertReadmore(编辑器){
var content=$getContent

如果(content.match(/jInsertEditorText)是由编辑器定义的,而不是在mootools中。尝试使用TinyMCE编辑器或JCE,两者都完全支持它。

我知道这个问题的答案出现得很晚,但它出现在Google的第一页上,仍然没有得到回答,因此它是:

自2012年以来,情况发生了变化,编辑现在必须实现以下两个功能:

// Set value
if (typeof Joomla.editors.instances["jform_editor_name"] !== "undefined") {
  Joomla.editors.instances["jform_editor_name"].setValue(ourHTML);
}

// Get value
var text = Joomla.editors.instances["jform_editor_name"].getValue();

我使用的是JCE编辑器,但它似乎无法识别。