I've tried to copy everything from the online demo and try to make it work, but I cannot make it work.
I found the online demo description's script is different to the script in local demo file.
e.g. local file InsertSpecialLink
Online demo description's script
When I tried different script, it never worked, the error I received error message "linkUrl.value is null", can you give a working version?
I found the online demo description's script is different to the script in local demo file.
e.g. local file InsertSpecialLink
| Telerik.Web.UI.Editor.CommandList["InsertSpecialLink"] = function(commandName, editor, args) |
| { |
| var elem = editor.getSelectedElement(); //returns the selected element. |
| if (elem.tagName == "A") |
| { |
| editor.selectElement(elem); |
| argument = elem.cloneNode(true); |
| } |
| else |
| { |
| var content = editor.getSelectionHtml(); |
| var link = editor.get_document().createElement("A"); |
| link.innerHTML = content; |
| argument = link; |
| } |
| var myCallbackFunction = function(sender, args) |
| { |
| editor.pasteHyperLink(args, "Insert Link"); |
| } |
| editor.showExternalDialog( |
| "InsertLink.aspx", |
| argument, |
| 270, |
| 300, |
| myCallbackFunction, |
| null, |
| "Insert Link", |
| true, |
| Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move, |
| false, |
| true); |
| }; |
Online demo description's script
| <script type="text/javascript"> |
| Telerik.Web.UI.Editor.CommandList["InsertSpecialLink"] = function(commandName, editor, args) |
| { |
| var elem = editor.getSelectedElement(); //returns the selected element. |
| if (elem.tagName == "A") |
| { |
| editor.selectElement(elem); |
| argument = elem; |
| } |
| else |
| { |
| //remove links if present from the current selection - because of JS error thrown in IE |
| editor.fire("Unlink"); |
| //remove Unlink command from the undo/redo list |
| var commandsManager = editor.get_commandsManager(); |
| var commandIndex = commandsManager.getCommandsToUndo().length - 1; |
| commandsManager.removeCommandAt(commandIndex); |
| var content = editor.getSelectionHtml(); |
| var link = editor.get_document().createElement("A"); |
| link.innerHTML = content; |
| argument = link; |
| } |
| var myCallbackFunction = function(sender, args) |
| { |
| editor.pasteHtml(String.format("<a href={0} target='{1}' class='{2}'>{3}</a> ", args.href, args.target, args.className, args.name)) |
| } |
| editor.showExternalDialog( |
| 'InsertLink.aspx', |
| argument, |
| 270, |
| 300, |
| myCallbackFunction, |
| null, |
| 'Insert Link', |
| true, |
| Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move, |
| false, |
| false); |
| }; |
| </script> |
When I tried different script, it never worked, the error I received error message "linkUrl.value is null", can you give a working version?