1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Insert text into editor problem

Discussion in 'XenForo Development Discussions' started by ragtek, May 9, 2011.

  1. ragtek

    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:
     
  2. ragtek

    ragtek Guest

    ok, working now without the seteditor and editor.val stuff
     

Share This Page