Hi,
Thank you for the detailed steps.
To fix the problem attach to the OnClientSubmit event of RadEditor and switch the mode to Design before submitting the content, e.g.
<telerik:RadEditor runat=
"server"
ID=
"radEdit"
Skin=
"Default"
SkinID=
"DefaultSetOfTools"
ContentAreaMode=
"Div"
Width=
"100%"
Height=
"450px"
EnableResize=
"false"
_ToolsFile=
"~/_controls/ctlWYSIWYGEditor/ctlWYSIWYGEditor.xml"
OnClientCommandExecuting=
"ExecuteCommand"
OnClientPasteHtml=
"OnClientPasteHtml"
OnClientSubmit=
"OnClientSubmit"
_ExternalDialogsPath=
"~/_controls/ctlWYSIWYGEditor/EditorDialogs/"
>
<ImageManager ViewPaths=
"/_images/WYSIWYGEditor/ImageManager/"
EnableImageEditor=
"false"
></ImageManager>
<SpellCheckSettings DictionaryPath=
"~/App_Data/RadSpell/"
/>
</telerik:RadEditor>
<asp:Button ID=
"Button1"
runat=
"server"
Text=
"Submit"
OnClick=
"Button1_Click"
/>
<script type=
"text/javascript"
>
function
OnClientSubmit(sender, args) {
sender.set_mode(1);
}
function
OnClientPasteHtml(sender, args) {
var
commandName = args.get_commandName();
var
value = args.get_value();
if
(commandName ==
"ImageManager"
) {
//See if an img has an alt tag set
var
div = document.createElement(
"DIV"
);
//Do not use div.innerHTML as in IE this would cause the image's src or the link's href to be converted to absolute path.
//This is a severe IE quirk.
Telerik.Web.UI.Editor.Utils.setElementInnerHtml(div, value);
//Now check if there is alt attribute
var
img = div.firstChild;
img.setAttribute(
"width"
,
"100"
);
img.setAttribute(
"height"
,
"100"
);
//Set new content to be pasted into the editor
args.set_value(div.innerHTML);
}
}
function
ExecuteCommand(editor, args) {
var
name = args.get_name();
var
val = args.get_value();
if
(name ==
"Logos"
|| name ==
"MyClipArt"
|| name ==
"Signatures"
) {
editor.pasteHtml(
"<img src='"
+ val +
"'>"
);
//Cancel the further execution of the command as such a command does not exist in the editor command list
args.set_cancel(
true
);
}
}
</script>
Another approach is to render the content area as an iframe element by setting ContentAreaMode="Iframe".
Best regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their
blog feed now.