From 723ee6a111c703a7448a00ed04c3e443e50dcb83 Mon Sep 17 00:00:00 2001 From: julmis Date: Tue, 16 Mar 2004 21:40:42 +0000 Subject: [PATCH] Removelink feature added --- lib/editor/htmlarea.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/editor/htmlarea.php b/lib/editor/htmlarea.php index 7840ed5e4c..06f302848f 100644 --- a/lib/editor/htmlarea.php +++ b/lib/editor/htmlarea.php @@ -157,7 +157,7 @@ HTMLArea.Config = function () { "lefttoright", "righttoleft", "separator", "insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator", "forecolor", "hilitecolor", "separator", - "inserthorizontalrule", "createlink", "insertimage", "inserttable", + "inserthorizontalrule", "createlink", "unlink", "insertimage", "inserttable", "insertsmile", "insertchar", "separator", "htmlmode", "separator", "popupeditor" ] ]; @@ -233,6 +233,7 @@ HTMLArea.Config = function () { hilitecolor: [ "Background Color", "ed_color_bg.gif", false, function(e) {e.execCommand("hilitecolor");} ], inserthorizontalrule: [ "Horizontal Rule", "ed_hr.gif", false, function(e) {e.execCommand("inserthorizontalrule");} ], createlink: [ "Insert Web Link", "ed_link.gif", false, function(e) {e.execCommand("createlink", true);} ], + unlink: [ "Remove Link", "ed_unlink.gif", false, function(e) {e.execCommand("unlink");} ], insertimage: [ "Insert/Modify Image", "ed_image.gif", false, function(e) {e.execCommand("insertimage");} ], inserttable: [ "Insert Table", "insert_table.gif", false, function(e) {e.execCommand("inserttable");} ], htmlmode: [ "Toggle HTML Source", "ed_html.gif", true, function(e) {e.execCommand("htmlmode");} ], @@ -1629,6 +1630,15 @@ HTMLArea.prototype._insertChar = function() { return true; }, null); }; + +HTMLArea.prototype._removelink = function() { + var editor = this; + link = this.getParentElement(); + editor.selectNodeContents(link); + + this._doc.execCommand("unlink", false, null); + this.focusEditor(); +}; /************************************************************************ * Moodle hack's ends ************************************************************************/ @@ -1679,6 +1689,7 @@ HTMLArea.prototype.execCommand = function(cmdID, UI, param) { case "createlink": this._createLink(); break; + case "unlink": this._removelink(); case "popupeditor": if (HTMLArea.is_ie) { //if (confirm(HTMLArea.I18N.msg["IE-sucks-full-screen"])) -- 2.39.5