How to insert text to editor programmatically in Joomla?

蹲街弑〆低调 提交于 2019-12-11 10:25:27

问题


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.

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

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?


回答1:


jInsertEditorText is defined by the editor, not in mootools. Try using TinyMCE editor or JCE, both support it fully.



来源:https://stackoverflow.com/questions/8740610/how-to-insert-text-to-editor-programmatically-in-joomla

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!