JavaScript issues with adding button to editor

2 posts, 0 answers
  1. Eric
    Eric avatar
    2 posts
    Member since:
    Jan 2012

    Posted 05 Jan 2012 Link to this post

    Hello,

    I am trying to add a custom button to a RadEditor in Sitecore 6.4.  I have successfully added the button and am now defining the command.  Here is what I have so far (from a previous project):

    RadEditorCommandList["InsertBrightcoveVideo"] = function(commandName, editor, tool) {
        var args = editor.GetDialogParameters(commandName);
     
        var html = editor.getSelectionHtml();
        var videoid = scItemID;
        var playerid = scItemID;
        var playlistids = scItemID;
        var wmode = "window";
        var bgcolor = "#ffffff";
        var autostart = "false";
     
        if (html) {
            videoid = getVidQStringVal(html, 'video');
            playerid = getVidQStringVal(html, 'player');
            playlistids = getVidQStringVal(html, 'playlists');
            wmode = getVidQStringVal(html, 'wmode');
            bgcolor = getVidQStringVal(html, 'bgcolor');
            autostart = getVidQStringVal(html, 'autostart');
        }
     
        scEditor = editor;
     
        editor.ShowDialog(
            "/sitecore/shell/default.aspx?xmlcontrol=RichText.InsertVideo&la=" + scLanguage + "&video=" + videoid + "&player=" + playerid + "&playlists=" + playlistids + "&selectedText=" + escape(html) + "&wmode=" + wmode + "&bgcolor=" + bgcolor + "&autostart=" + autostart,
            null, //argument
            600, //width
            500, //height
            scInsertBrightcoveVideo,
            null,
            "Insert Video");
    };

    I am getting a few JavaScript errors.  This first error is caused by the second line of my command.

    Uncaught TypeError: Object [object Object] has no method 'GetDialogParameters'

    Looking in the Client-side API Reference, I don't see the GetDialogParameters method listed, so I commented it out.  The error goes away but I receive another.

    Uncaught TypeError: Object [object Object] has no method 'ShowDialog'

    Strange.  Looking in the API I see that the method does in fact exist.  But if I change the method call from ShowDialog to showDialog the error goes away.  Unfortunately I receive another.

    Uncaught Sys.ArgumentNullException: Sys.ArgumentNullException: Dialog Parameters for the /sitecore/shell/default.aspx?xmlcontrol=RichText.InsertVideo&la=en&video={E114FA72-EC42-43F3-8A1F-99B00541E86A}&player={E114FA72-EC42-43F3-8A1F-99B00541E86A}&playlists={E114FA72-EC42-43F3-8A1F-99B00541E86A}&selectedText=&wmode=window&bgcolor=#ffffff&autostart=false dialog do not exist
    Parameter name: dialogName

    Any ideas as to what could be going wrong?  I'm a little confused as to why I had to change the method call when the docs say it exists.  Is there something wrong with the editor parameter possibly?

    Thanks for any help.
  2. Richard
    Richard avatar
    479 posts
    Member since:
    Nov 2011

    Posted 06 Jan 2012 Link to this post

    Eric:

    If you have not already referenced this, there's a useful Editor/Custom Dialogs demo to help you with your implementation.

    The DialogParametersProvider..::..GetDialogParameters Method  does exist in the Telerik.Web.UI namespace.

    Hope this helps!
Back to Top