22 Answers, 1 is accepted
The reason for that the editor displays the default context menu of Firefox is that the default context menu of RadEditor contains tools that are unusable in Firefox due to its security restraints (e.g. Cut, Copy, Paste). On the other hand, using the built-in FireFox spellchecker that provides its suggestions in the [browser] context menu is very commonly used. This is why, upon customer request, we modified the [default] context menu behavior in FireFox.
Kind regards,
Rumen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
RadEditor for ASP.NET AJAX does not offer currently the requested feature. If anyone else request this option, we will consider providing a way to enable the editor's context menu in Firefox.
Sincerely,
Rumen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
We have a serious problem at one of my clients where staff were using MSWord to "set up" pages, and then they copy and paste into the editor. All the stripping options and defaults on paste worked great on IE however...
- Drag and drop was never accounted for. Users can drag and drop from Word or some other source into the editor and all default stripping is skipped - THIS IS A SERIOUS FLAW IN THE EDITOR. I had to work around it by adding handlers to trap the drag drop event to supress it and add additional handlers to catch dragstart and dragend if the drag is initiated from within the editor window to keep that functionality.
- This all fixed all my problems, but only in IE, Firefox and Safari still were allowing pasting and/or dragdrops with now paste filtering. I understand all the complexities and security issues with the cross browser, but there still has to be a solid answer to fix this issue. I've been able to replace the standard paste function specifically in Moz based browsers to fire the "PastePlainText" function; however, that context menu "paste" bypasses it.
In terms of a site that highly needs to keep a ridged format and design to maintain a professional appearance, but in an environment where multiple browsers must be accounted for, we more time and effort put into a better solution than all this custom work I've had to do. And even then, there still is that Firefox context menu that I just can't find a workaround for.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
var isInternalDrop = false;
var oldMozPaste = null;
function EditorInitialize(editor, args)
{
var element = document.all ? editor.get_document().body : editor.get_document();
if (document.all){
$telerik.addExternalHandler(element, "drop", DropCheck);
$telerik.addExternalHandler(element, "dragstart", InternalDrgStart);
$telerik.addExternalHandler(element, "dragend", InternalDrgEnd);
}else{
element.addEventListener("dragdrop", DropCheck, true);
//Catch paste functions for Moz based browsers
oldMozPaste = Telerik.Web.UI.Editor.CommandList["Paste"];
Telerik.Web.UI.Editor.CommandList["Paste"] = function(commandName, editor, args)
{
editor.fire("PastePlainText");
};
}
}
function InternalDrgStart(e)
{
isInternalDrop = true;
}
function InternalDrgEnd(e)
{
isInternalDrop = false;
}
function DropCheck(e)
{
if (isInternalDrop==false){
e.cancelBubble = true;
return (false);
}else{
return (true);
}
}
function MozDropCheck(e)
{
alert("sdfsdf");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<rcaTelerik:RadScriptManager ID="rsmMain" runat="server"></rcaTelerik:RadScriptManager>
<rcaTelerik:RadEditor ID="reContent" runat="server" OnClientLoad="EditorInitialize" StripFormattingOptions="All"></rcaTelerik:RadEditor>
</div>
</form>
</body>
</html>
Straight to the points:
- You can strip the MS Word content on drag and drop by using the following code:
<script type="text/javascript">
function OnClientLoad(editor, args)
{
var element = document.all ? editor.get_document().body : editor.get_document();
var eventHandler = document.all ? "drop" : "dragdrop";
$telerik.addExternalHandler(element, eventHandler, function(e)
{
setTimeout(function()
{
alert("before stripping" + editor.get_html(true));
editor.fire("SelectAll");
editor.fire("FormatStripper", {value : "WORD_ALL"}); //strips the MS Word formatting
alert("after stripping" + editor.get_html(true));
}, 300);
});
}
</script>
<telerik:radeditor
runat="server"
OnClientLoad="OnClientLoad"
ID="RadEditor1">
</telerik:radeditor>
By the way have you seen the requested functionality implemented in another web editor? If anyone else request it we could consider its implementation in the control.
- I have good
news that the guys from Mozilla have provided an onpaste event in the
new Firefox 3 and there are good changes to control the pasted content
in FF as well, which will allow us to provide the StripFormattingOnPaste option
for Firefox 3. We need further research and time, but the chances are
good that it will be possible to implement this functionality.
Please, also note that the editor's Word stripping filters do not work properly in Firefox 3. The problem is due to that Firefox 3.0 is presenting itself to MS Word as a XML client and the content pasted in the editor has new format different to this one pasted in Firefox 2.0. That is why the regular expressions used by the editor's Paste From Word filters are not stripping the new MS Word XML formatting.
This problem will be fixed in the Q3 release of RadEditor.
Kind regards,
Rumen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Did you postponed the fix for firefox or is it still incoming with the Q3 release ? (I see nothing new in the Q3 beta right now).
Thank you
We seem to be able to bring up the contextMenu on elements, just not for the body of the editor. We tried TagName="*" as well as TagName="BODY"
No luck... Please bring this back with Q3 ASAP
The main reason for removing the context menu in Firefox was explained in the initial reply by Rumen in this thread. We understand your scenario and we logged this issue with highest priority in our ToDo list. We will do our best to provide an easy option to switch the context menu on and off in Firefox for Q3 SP1
Sincerely yours,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I'm glad that telerik provides a solution for this soon, since we are missing this feature as well. We used the contextmenu to enable the Telerik Link Manager and other functions. In IE, this seems to work perfectly, but in Firefox you can only set link properties via contextmenu when the link is already set.
In other words: we need this very urgently! :)
Thanks in advance!
Frank H.
Thanks!
Please use the following couple of lines of code while the functionality is included (one way or another) back in the editor.
<telerik:radeditor runat="server" |
ID="RadEditor1" OnClientLoad="OnClientLoad"> |
<Content> |
Content... |
</Content> |
</telerik:radeditor> |
<script> |
function OnClientLoad(editor) |
{ |
var toolAdapter = editor.get_toolAdapter(); |
toolAdapter.isIE = true; |
} |
</script> |
Best regards,
Tervel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
This is a *safe* workaround. Please note that the toolAdapter.isIE = true; is set not on the RadEditor as such, but on its tool adapter (the object that controls tool rendering). We examined the code for side effects and we are confident there will not be any negative ones with the current Telerik.Web.UI version.
Best wishes,
Tervel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Please advise
Thanks
To enable the PastePlainText option in all browsers open the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ToolsFile.xml and ListToolsFile.xml files of RadEditor for MOSS and register the following contextmenu tags:
<
contextMenus
>
<
contextMenu
forElement
=
"HTML"
>
<
tool
Name
=
"PastePlainText"
/>
</
contextMenu
>
<
contextMenu
forElement
=
"BODY"
>
<
tool
Name
=
"PastePlainText"
/>
</
contextMenu
>
<
contextMenu
forElement
=
"P"
>
<
tool
Name
=
"PastePlainText"
/>
</
contextMenu
>
</
contextMenus
>
All the best,
Rumen
the Telerik team
Thanks
Ronak
<
contextMenus
>
<
contextMenu
forElement
=
"HTML"
>
<
tool
name
=
"Cut"
/>
<
tool
name
=
"Copy"
/>
<
tool
Name
=
"PastePlainText"
/>
</
contextMenu
>
<
contextMenu
forElement
=
"BODY"
>
<
tool
name
=
"Cut"
/>
<
tool
name
=
"Copy"
/>
<
tool
Name
=
"PastePlainText"
/>
</
contextMenu
>
<
contextMenu
forElement
=
"P"
>
<
tool
name
=
"Cut"
/>
<
tool
name
=
"Copy"
/>
<
tool
Name
=
"PastePlainText"
/>
</
contextMenu
>
</
contextMenus
>
This is a limitation of the Mozilla and WebKit browsers.
Please, note that to protect users' private information, unprivileged scripts cannot invoke the Cut, Copy, and Paste commands in the Mozilla, Safari / Chrome and Opera rich text editor, so the corresponding buttons will not work. You can cut and paste content in Firefox, Safari /Chrome and Opera only using the Ctrl+X and Ctrl+V shortcut or the Paste from Word dialog.
You can also paste content from the browsers menu: Edit -> Paste.
More information is available in this help article: Cleaning Word Formatting.
The Cut, Copy and Paste commands could be executed via JavaScript code only under Internet Explorer.
Kind regards,
Rumen
the Telerik team
I found that RadEditor doesn't allows context menu in default configuration in IE.
Is there any simple way to enable context menu in IE for all tags?
Right now I use next code in my skin file:
<
ContextMenus
>
<
telerik:EditorContextMenu
>
<
telerik:EditorTool
Name
=
"Cut"
/>
<
telerik:EditorTool
Name
=
"Copy"
/>
<
telerik:EditorTool
Name
=
"Paste"
/>
<
telerik:EditorTool
Name
=
"PastePlainText"
/>
</
telerik:EditorContextMenu
>
</
ContextMenus
>
It works, but I will prefer to just enable standard context menu of browser if it is possible.
If you want to enable the default browser's content menu and disable the built-in context menus of RadEditor, you can do that using the following script:
<script type=
"text/javascript"
>
function
OnClientLoad(editor) {
editor.get_toolAdapter().enableContextMenus(
false
);
}
</script>
<telerik:RadEditor ID=
"RadEditor"
OnClientLoad=
"OnClientLoad"
runat=
"server"
/>
All the best,
Rumen
the Telerik team
Thanks for you reply. I'm sure this code works, but I can't use it because it will force me to update every RadEditor in project.
You can put the JavaScript file in a JavaScript file and use Theme / Skin file to control multiple editors from a single location.
All the best,
Rumen
the Telerik team