I have implemented a custom Rich text editor button. When I click on the custom RTE button it opens a Sheer dialog where the user can select an item from a list and I build a link based on the selected item. At the end it the link value has a value similar to any Sitecore media links like:
<a href="~/media/c91e6ce67216446c8c2af1ae5d2a8120.ashx">PDF_test</a>
That works fine except that the link is not inserted into the RTE within the content but it becomes the content. In other words all the content is cleared and the new link is applied.
My Dialog inherits from Sitecore.Web.UI.Pages.DialogForm. Here is how the OnOK overridden method looks like of my dialog(adapted for the question)
protected override void OnOK(object sender, EventArgs args)
{
//previous code cleared from this question
var dialogValue = AssetService.GetValue();
SheerResponse.SetDialogValue(dialogValue);
base.OnOK(sender, args);
}
Also this is the custom command item set on the RichTextCommands.js:
Telerik.Web.UI.Editor.CommandList["SelectAsset"] = function (commandName, editor, args) {
scEditor = editor;
editor.showExternalDialog(
"/sitecore/shell/default.aspx?xmlcontrol=SelectAsset¤tItemId=" + scItemID + "&assetType=link",
null, //argument
1105,
700,
scInsertSitecoreLink,
null,
"Asset",
true, //modal
Telerik.Web.UI.WindowBehaviors.Close, // behaviors
false, //showStatusBar
false //showTitleBar
);
};
Any thoughts on what I'm missing here?