Hello,
I have a CustomLinkManager to handle the link creation in my editor but when I select a created link to edit it, it create an other <a> tag witch contain the one selected. My problem is that I need to replace the current selection, is there something like editor.ReplaceSelection(html) ?
Thanks for the help!
Vincent
My code looks like this :
| Telerik.Web.UI.Editor.CommandList["CustomLinkManager"] = function(commandName, editor, args) { |
| var elem = editor.getSelectedElement(); //returns the selected element. |
| if (elem.tagName == "A") { |
| editor.selectElement(elem); |
| argument = elem; |
| } |
| else { |
| var content = editor.getSelectionHtml(); |
| var link = editor.get_document().createElement("A"); |
| link.innerHTML = content; |
| argument = link; |
| } |
| var myCallbackFunction = function(sender, args) { |
| var html = String.format("<a href=\"{0}\" target=\"{1}\" class=\"{2}\" title=\"{3}\">{4}</a>", args.url, args.target, args.className, args.title.replace("'", "\'"), args.name); |
| editor.pasteHtml(html) |
| } |
| editor.showExternalDialog('<%= Page.ResolveUrl("~/aspx/cms/CustomLinkManager.aspx") %>', argument, 600, 600, myCallbackFunction, null, 'Insérer un lien', true, Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move, false, true); |
| }; |
