如何在Joomla中以编程方式将文本插入编辑器? [英] How to insert text to editor programmatically in Joomla?
问题描述
我正在使用joomla 1.7,并已创建一个自定义按钮(editor-xtd插件) 我想在当前编辑器内容中插入一些字符串.
I am using joomla 1.7 and I am made a custom button (editor-xtd plugin) that I want to insert some string into the current editor content.
就像Readmore按钮一样.我搜索了Readmore代码并发现:
Like in the Readmore button. I have searched through the Readmore code and found :
$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);
}
}
";
现在,当我尝试调用jInsertEditorText时,似乎出现了一个错误,那就是它丢失了. 一些论坛建议我导入mootools.js,但这似乎并不能解决问题.
now when I try to call jInsertEditorText, I seem to get an error that's it's missing. some forum suggested I import mootools.js, but that didn't seem to do the trick.
在哪里可以找到它?或者还有其他方法?
Where can I find it or is there some other approach?
推荐答案
jInsertEditorText由编辑器定义,而不是在mootools中定义.尝试使用TinyMCE编辑器或JCE,两者都完全支持它.
jInsertEditorText is defined by the editor, not in mootools. Try using TinyMCE editor or JCE, both support it fully.
这篇关于如何在Joomla中以编程方式将文本插入编辑器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!