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

Disable "builtin" copy/paste/... contextmenu

4 Answers 193 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Darryl
Top achievements
Rank 1
Darryl asked on 20 Aug 2008, 06:21 PM
Is there a way to disable the builtin copy/paste context menu? Or even better, disable/remove items from the builtin copy/paste context menu?

I have an editor implementation where I only want to allow PastePlainText. However I cant seem to access this copy/paste context menu to disable the other paste options.

If I use <contextmenu forElement="*" /> in the toolsfile to create a custom contextmenu, will this override the table property context menu and the image property context menu?

Thanks in advance.

4 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 21 Aug 2008, 12:58 PM
Hello Darryl,

Here is the whole context menu configuration of RadEditor:

<telerik:RadEditor ID="RadEditor1" runat="server">
  <ContextMenus>
    <telerik:EditorContextMenu TagName="IMG">
      <telerik:EditorTool Name="SetImageProperties" />
      <telerik:EditorTool Name="ImageMapDialog" />
    </telerik:EditorContextMenu>
    <telerik:EditorContextMenu TagName="TABLE">
      <telerik:EditorTool Name="ToggleTableBorder" />
      <telerik:EditorTool Name="SetTableProperties" />
      <telerik:EditorTool Name="DeleteTable" />
    </telerik:EditorContextMenu>
    <telerik:EditorContextMenu TagName="TD">
      <telerik:EditorTool Name="InsertRowAbove" />
      <telerik:EditorTool Name="InsertRowBelow" />
      <telerik:EditorTool Name="DeleteRow" />
      <telerik:EditorTool Name="InsertColumnLeft" />
      <telerik:EditorTool Name="InsertColumnRight" />
      <telerik:EditorTool Name="MergeColumns" />
      <telerik:EditorTool Name="MergeRows" />
      <telerik:EditorTool Name="SplitCell" />
      <telerik:EditorTool Name="DeleteCell" />
      <telerik:EditorTool Name="SetCellProperties" />
    </telerik:EditorContextMenu>
    <telerik:EditorContextMenu TagName="A">
      <telerik:EditorTool Name="SetLinkProperties" />
      <telerik:EditorTool Name="Unlink" />
    </telerik:EditorContextMenu>
    <telerik:EditorContextMenu TagName="BODY">
      <telerik:EditorTool Name="Cut" />
      <telerik:EditorTool Name="Copy" />
      <telerik:EditorTool Name="Paste" />
      <telerik:EditorTool Name="PasteFromWord" />
      <telerik:EditorTool Name="PastePlainText" />
      <telerik:EditorTool Name="PasteAsHtml" />
    </telerik:EditorContextMenu>
  </ContextMenus>
</telerik:RadEditor>

All you need to do is to delete the tags corresponding to the elements that you would like to remove. Of course you can add new tools.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Darryl
Top achievements
Rank 1
answered on 21 Aug 2008, 01:26 PM
Thanks Rumen.

Your example uses the RadEditor, EditorContextMenu, and EditorTool server control tags. Can I do the same in the toolsfile.xml ?
0
Darryl
Top achievements
Rank 1
answered on 21 Aug 2008, 01:43 PM
Rumen, I figured it out.

I inserted your example into ToolsFile.xml and changed element and attribute names to those used in ToolsFile.xml.

Thanks for your help.
0
Rumen
Telerik team
answered on 21 Aug 2008, 01:43 PM
Hello Darryl,

Yes, of course. The syntax is as follows:

  <contextMenus>
    <contextMenu forElement="BODY">
      <tool name="JustifyLeft" />
      <tool name="JustifyCenter" />
      <tool name="JustifyRight" />
      <tool name="JustifyFull" />
    </contextMenu>
    <contextMenu forElement="IMG">
      <tool name="Cut" />
      <tool name="Copy" />
      <tool name="Paste" />
    </contextMenu>
    <contextMenu forElement="A">
    </contextMenu>
  </contextMenus>


Best regards,
Rumen
the Telerik team

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