This is a migrated thread and some comments may be shown as answers.

Edit Context Menu Returned Markup

1 Answer 27 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Addams
Top achievements
Rank 1
Addams asked on 03 Oct 2008, 04:07 PM
I am trying to edit the markup returned from the Set Image Properties context menu (I am trying to append an additional style on the img tag).  I have added the below to my tools file:

<contextMenu forElement="IMG">

<tool name="SetImageProperties1" iconurl="~/RadControls/Editor/Skins/Default/Img/imageProperties.gif" />

</contextMenu>


and the following javascript beneath the RadEditor on the page:


RadEditorCommandList["SetImageProperties1"] =
function(commandName, editor, oTool)
{
    editor.Fire('SetImageProperties', callBackFn);
    function callBackFn(result)
    {
        if (result)
        {
          alert(result);
        };
    }
};

This is currently giving me a js error Object does not support this property or method.  Also the icon URL is not displaying in the context menu even though it is valid and how would I put custom text in the context menu text?  I was trying to use this approach which is similar to the following thread: http://www.telerik.com/community/forums/thread/b311D-taged.aspx

Thank you for your help.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 06 Oct 2008, 10:28 AM
Hi Addams,

I think that you are using RadEditor for ASP.NET AJAX, but the solution provided in the forum post applies to RadEditor Classic only.

The recommended solution for RadEditor for ASP.NET AJAX is to use the OnClientPasteHtml event which is useful in scenarios where the developers need to examine or modify the HTML to be pasted by an editor tool before it is inserted in the editor content area.

The built-in editor's dialogs returns a string, which is inserted in the content area via the editor.pasteHtml(content) method. You can modify this string using the OnClientPasteHtml method.

This means that you do not need to create a new custom command that will fire the Set Image Properties dialog, but you can directly modify the content returned by the original Set Image Properties dialog.


All the best,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Addams
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or