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

[Solved] Context Menus for custom tags

1 Answer 125 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Michael Pullella
Top achievements
Rank 1
Michael Pullella asked on 22 Feb 2010, 03:01 PM
Hi..

I am tagging the text in my editor using xhtml as in the following:
<my:Comment 
    
class=comment 
    
commentValue="comment text for arrested">ARRESTED
</my:Comment> MAN FOUND IN DITCH 

I want to be able to show a different context menu if the user right clicks the word "Arrested" rather than the normal context menu that shows when they right click the words "MAN" or "FOUND" etc...

I began by trying to implement the example shown in this forum post
http://www.telerik.com/community/forums/aspnet-ajax/editor/changing-context-menu-programmatically-client-side.aspx

however, the editor doesn't seem to understand the Comment tag.  It worked when I followed the example and used an IMG, but I would like it to work for the custom tags that I am defining.

Is this possible?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dobromir
Telerik team
answered on 24 Feb 2010, 02:10 PM
Hi Michael,

RadEditor's content area is an editable IFRAME and is extending the browser's RichText editing engine. The custom tags are not handled by the control and are recognized differently by the browser. Internet Explorer distinct the namespace part and the tagname part while FireFox does not. As a solution to this behavior I could suggest you to define context menus for each tag, e.g.:
<telerik:RadEditor runat="server" ID="RadEditor1">
    <ContextMenus>
        <telerik:EditorContextMenu TagName="Comment">
            <telerik:EditorTool Name="Bold" Text="Bold" />
        </telerik:EditorContextMenu>
        <telerik:EditorContextMenu TagName="MY:COMMENT">
            <telerik:EditorTool Name="Bold" Text="Bold" />
        </telerik:EditorContextMenu>
    </ContextMenus>
    <Content>
        <div>Div with some content</div>
        <my:Comment>MyCustomTag's content</my:Comment>
        <span>Span with some content</span>
    </Content>
</telerik:RadEditor>

I hope this helps.

Regards,
Dobromir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Editor
Asked by
Michael Pullella
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or