I've customized the editor toolbars by removing some buttons while adding my own custom buttons. I've implemented a clientside OnClientCommandExecuting handler to intercept and cancel keyboard shortcuts to the removed editor buttons. I also want to handle click events from the editor toolbar custom buttons.
Telerik documentation says to add onclick handlers to the editor's RadEditorCommandList. But, I've noticed that custom button click events are first processed by the OnClientCommandExecuting handler before they get to the RadEditorCommandList handlers.
What is the difference between using these two handlers? The custom buttons will instigate serverside save and saveas functionality via an ajax post. I'ld prefer to combine everything into the OnClientCommandExecuting handler, and to launch save/saveas ajax posts from there. After each launch I will cancel the click event.
Telerik documentation says to add onclick handlers to the editor's RadEditorCommandList. But, I've noticed that custom button click events are first processed by the OnClientCommandExecuting handler before they get to the RadEditorCommandList handlers.
What is the difference between using these two handlers? The custom buttons will instigate serverside save and saveas functionality via an ajax post. I'ld prefer to combine everything into the OnClientCommandExecuting handler, and to launch save/saveas ajax posts from there. After each launch I will cancel the click event.
<
script
type
=
"text/javascript"
>
function OnClientCommandExecuting(editor, args) {
if ("Save" == args.get_commandName()) {
alert("OnClientCommandExecuting Save");
args.set_cancel(true);
} else if ("SaveAs" == args.get_commandName()) {
alert("OnClientCommandExecuting SaveAs");
args.set_cancel(true);
}
} //EOF OnClientCommandExecuting
</
script
>
<
telerik:RadEditor
ID
=
"telerikeditor"
Runat
=
"server"
OnClientLoad
=
"onClientLoad"
OnClientCommandExecuting
=
"OnClientCommandExecuting"
>
<
Tools
>
<
telerik:EditorToolGroup
Tag
=
"grpInputOutput"
>
<
telerik:EditorTool
ImageUrl
=
"Images/radeditorSave.gif"
Name
=
"Save"
ShowText
=
"False"
Text
=
"Save"
/>
<
telerik:EditorTool
ImageUrl
=
"Images/radeditorSaveAs.gif"
Name
=
"SaveAs"
ShowText
=
"False"
Text
=
"Save As"
/>
<
telerik:EditorSeparator
/>
</
telerik:EditorToolGroup
>
</
Tools
>
<
Content
>
</
Content
>
</
telerik:RadEditor
>
<
script
type
=
"text/javascript"
>
//locate this script after the radeditor HTML declaration
RadEditorCommandList["Save"] = function(commandName, editor, oTool) {
alert("RadEditorCommandList Save");
}
</
script
>