Insert text into editor problem

  • Thread starter Thread starter ragtek
  • Start date Start date
R

ragtek

Guest
i'm tryint to insert something into the editor with this is my code:

Code:
    Ragtek.RagtekEditorTemplate.add = function($text)
{
    var $container = $("#ragtek_container");
    var editor = XenForo.getEditorInForm($container.closest("form"));
    if (editor)
            {
                if (editor.execCommand)
                {
                    editor.execCommand("mceInsertContent", false, $text);
                    setTimeout(function() { editor.execCommand("xenForoElastic"); }, 250);
                    setTimeout(function() { editor.execCommand("xenForoElastic"); }, 1000);
                }
                else
                {
                    editor.val(editor.val() + $text);
                }
            }
}

text is set, editor is also set ( editor:Object { editorId="ctrl_message_html", id="ctrl_message_html", more...} )

when i run the function, i'm getting this error:
E.indexOf is not a function

blank.gif
(function(d){var a=/^\s*|\s*$/g,e,c="B...{a.selection.onSetContent.add(f)})}});

tiny_m...c20a874 (Zeile 1
 
Top Bottom