From 49a510efbd4b620d46bebda17f6bbe05df6dc503 Mon Sep 17 00:00:00 2001
From: Andrew Nicols <andrew@nicols.co.uk>
Date: Tue, 25 Mar 2014 13:21:49 +0800
Subject: [PATCH] MDL-44241 atto_unlink: Merge into atto_link

---
 lib/classes/plugin_manager.php                |  2 +-
 .../atto/plugins/link/lang/en/atto_link.php   |  1 +
 lib/editor/atto/plugins/link/lib.php          |  1 +
 .../moodle-atto_link-button-debug.js          | 11 +++++
 .../moodle-atto_link-button-min.js            |  2 +-
 .../moodle-atto_link-button.js                | 11 +++++
 .../plugins/link/yui/src/button/js/button.js  | 11 +++++
 .../plugins/unlink/lang/en/atto_unlink.php    | 25 ----------
 lib/editor/atto/plugins/unlink/version.php    | 29 -----------
 .../moodle-atto_unlink-button-debug.js        | 49 -------------------
 .../moodle-atto_unlink-button-min.js          |  1 -
 .../moodle-atto_unlink-button.js              | 49 -------------------
 .../plugins/unlink/yui/src/button/build.json  | 10 ----
 .../unlink/yui/src/button/js/button.js        | 44 -----------------
 .../unlink/yui/src/button/meta/button.json    |  7 ---
 lib/editor/atto/settings.php                  |  2 +-
 16 files changed, 38 insertions(+), 217 deletions(-)
 delete mode 100644 lib/editor/atto/plugins/unlink/lang/en/atto_unlink.php
 delete mode 100644 lib/editor/atto/plugins/unlink/version.php
 delete mode 100644 lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-debug.js
 delete mode 100644 lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-min.js
 delete mode 100644 lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button.js
 delete mode 100644 lib/editor/atto/plugins/unlink/yui/src/button/build.json
 delete mode 100644 lib/editor/atto/plugins/unlink/yui/src/button/js/button.js
 delete mode 100644 lib/editor/atto/plugins/unlink/yui/src/button/meta/button.json

diff --git a/lib/classes/plugin_manager.php b/lib/classes/plugin_manager.php
index d06464b6435..1d829389456 100644
--- a/lib/classes/plugin_manager.php
+++ b/lib/classes/plugin_manager.php
@@ -936,7 +936,7 @@ class core_plugin_manager {
                 'equation', 'fontcolor', 'html', 'image', 'indent', 'italic',
                 'link', 'managefiles', 'media', 'noautolink', 'orderedlist',
                 'rtl', 'strike', 'subscript', 'superscript', 'table', 'title',
-                'underline', 'undo', 'unlink', 'unorderedlist'
+                'underline', 'undo', 'unorderedlist'
             ),
 
             'assignment' => array(
diff --git a/lib/editor/atto/plugins/link/lang/en/atto_link.php b/lib/editor/atto/plugins/link/lang/en/atto_link.php
index cff9e2f862c..f138de839e0 100644
--- a/lib/editor/atto/plugins/link/lang/en/atto_link.php
+++ b/lib/editor/atto/plugins/link/lang/en/atto_link.php
@@ -27,3 +27,4 @@ $string['createlink'] = 'Create link';
 $string['enterurl'] = 'Enter a URL';
 $string['openinnewwindow'] = 'Open in new window';
 $string['pluginname'] = 'Link';
+$string['unlink'] = 'Unlink';
diff --git a/lib/editor/atto/plugins/link/lib.php b/lib/editor/atto/plugins/link/lib.php
index 6b5f19dd741..fa9496ac2c8 100644
--- a/lib/editor/atto/plugins/link/lib.php
+++ b/lib/editor/atto/plugins/link/lib.php
@@ -32,6 +32,7 @@ function atto_link_strings_for_js() {
     global $PAGE;
 
     $PAGE->requires->strings_for_js(array('createlink',
+                                          'unlink',
                                           'enterurl',
                                           'browserepositories',
                                           'openinnewwindow'),
diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js
index 077e2363021..2304d4b124c 100644
--- a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js
+++ b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js
@@ -77,11 +77,22 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
     _content: null,
 
     initializer: function() {
+        // Add the link button first.
         this.addButton({
             icon: 'e/insert_edit_link',
             callback: this._displayDialogue,
             tags: 'a'
         });
+
+        // And then the unlink button.
+        this.addBasicButton({
+            exec: 'unlink',
+            icon: 'e/remove_link',
+            title: 'unlink',
+
+            // Watch the following tags and add/remove highlighting as appropriate:
+            tags: 'a'
+        });
     },
 
     /**
diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js
index 2b145903e6b..91e757380e3 100644
--- a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js
+++ b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js
@@ -1 +1 @@
-YUI.add("moodle-atto_link-button",function(e,t){var n="atto_link",r={NEWWINDOW:"atto_link_openinnewwindow"},i='<form class="atto_form"><label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth url" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>{{#if showFilepicker}}<button class="openlinkbrowser">{{get_string "browserepositories" component}}</button><br/>{{/if}}<input type="checkbox" class="newwindow" id="{{elementid}}_{{CSS.NEWWINDOW}}"/><label class="sameline" for="{{elementid}}_{{CSS.NEWWINDOW}}">{{get_string "openinnewwindow" component}}</label><br/><div class="mdl-align"><br/><button type="submit" class="submit">{{get_string "createlink" component}}</button></div></form>';e.namespace("M.atto_link").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.addButton({icon:"e/insert_edit_link",callback:this._displayDialogue,tags:"a"})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1||this._currentSelection.collapsed)return;var e=this.getDialogue({headerContent:M.util.get_string("createlink",n),focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()),this._resolveAnchors(),e.show()},_resolveAnchors:function(){var t=this.get("host").getSelectionParentNode(),n,r,i,s;if(!t)return;n=this._findSelectedAnchors(e.one(t)),n.length>0&&(r=n[0],this._currentSelection=this.get("host").getSelectionFromNode(r),i=r.getAttribute("href"),s=r.getAttribute("target"),i!==""&&this._content.one(".url").setAttribute("value",i),s==="_blank"?this._content.one(".newwindow").setAttribute("checked","checked"):this._content.one(".newwindow").removeAttribute("checked"))},_filepickerCallback:function(e){this.getDialogue().set("focusAfterHide",null).hide(),e.url!==""&&(this.get("host").setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},_setLink:function(t){var n,r,i,s,o,u=this.get("host");t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=this._content.one(".url"),o=n.get("value");if(o!==""){this.editor.focus(),u.setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,o),i=u.getSelectionParentNode();if(!i)return;s=this._findSelectedAnchors(e.one(i)),e.Array.each(s,function(e){r=this._content.one(".newwindow"),r.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")},this),this.markUpdated()}},_findSelectedAnchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&this.get("host").selectionContainsNode(e)&&r.push(e)}),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},_getDialogueContent:function(){var t=this.get("host").canShowFilepicker("link"),s=e.Handlebars.compile(i);return this._content=e.Node.create(s({showFilepicker:t,component:n,CSS:r})),this._content.one(".submit").on("click",this._setLink,this),t&&this._content.one(".openlinkbrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("link",this._filepickerCallback,this)},this),this._content}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
+YUI.add("moodle-atto_link-button",function(e,t){var n="atto_link",r={NEWWINDOW:"atto_link_openinnewwindow"},i='<form class="atto_form"><label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth url" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>{{#if showFilepicker}}<button class="openlinkbrowser">{{get_string "browserepositories" component}}</button><br/>{{/if}}<input type="checkbox" class="newwindow" id="{{elementid}}_{{CSS.NEWWINDOW}}"/><label class="sameline" for="{{elementid}}_{{CSS.NEWWINDOW}}">{{get_string "openinnewwindow" component}}</label><br/><div class="mdl-align"><br/><button type="submit" class="submit">{{get_string "createlink" component}}</button></div></form>';e.namespace("M.atto_link").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.addButton({icon:"e/insert_edit_link",callback:this._displayDialogue,tags:"a"}),this.addBasicButton({exec:"unlink",icon:"e/remove_link",title:"unlink",tags:"a"})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1||this._currentSelection.collapsed)return;var e=this.getDialogue({headerContent:M.util.get_string("createlink",n),focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()),this._resolveAnchors(),e.show()},_resolveAnchors:function(){var t=this.get("host").getSelectionParentNode(),n,r,i,s;if(!t)return;n=this._findSelectedAnchors(e.one(t)),n.length>0&&(r=n[0],this._currentSelection=this.get("host").getSelectionFromNode(r),i=r.getAttribute("href"),s=r.getAttribute("target"),i!==""&&this._content.one(".url").setAttribute("value",i),s==="_blank"?this._content.one(".newwindow").setAttribute("checked","checked"):this._content.one(".newwindow").removeAttribute("checked"))},_filepickerCallback:function(e){this.getDialogue().set("focusAfterHide",null).hide(),e.url!==""&&(this.get("host").setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},_setLink:function(t){var n,r,i,s,o,u=this.get("host");t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=this._content.one(".url"),o=n.get("value");if(o!==""){this.editor.focus(),u.setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,o),i=u.getSelectionParentNode();if(!i)return;s=this._findSelectedAnchors(e.one(i)),e.Array.each(s,function(e){r=this._content.one(".newwindow"),r.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")},this),this.markUpdated()}},_findSelectedAnchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&this.get("host").selectionContainsNode(e)&&r.push(e)}),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},_getDialogueContent:function(){var t=this.get("host").canShowFilepicker("link"),s=e.Handlebars.compile(i);return this._content=e.Node.create(s({showFilepicker:t,component:n,CSS:r})),this._content.one(".submit").on("click",this._setLink,this),t&&this._content.one(".openlinkbrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("link",this._filepickerCallback,this)},this),this._content}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js
index 077e2363021..2304d4b124c 100644
--- a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js
+++ b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js
@@ -77,11 +77,22 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
     _content: null,
 
     initializer: function() {
+        // Add the link button first.
         this.addButton({
             icon: 'e/insert_edit_link',
             callback: this._displayDialogue,
             tags: 'a'
         });
+
+        // And then the unlink button.
+        this.addBasicButton({
+            exec: 'unlink',
+            icon: 'e/remove_link',
+            title: 'unlink',
+
+            // Watch the following tags and add/remove highlighting as appropriate:
+            tags: 'a'
+        });
     },
 
     /**
diff --git a/lib/editor/atto/plugins/link/yui/src/button/js/button.js b/lib/editor/atto/plugins/link/yui/src/button/js/button.js
index efd47b92204..31d8ee82392 100644
--- a/lib/editor/atto/plugins/link/yui/src/button/js/button.js
+++ b/lib/editor/atto/plugins/link/yui/src/button/js/button.js
@@ -75,11 +75,22 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
     _content: null,
 
     initializer: function() {
+        // Add the link button first.
         this.addButton({
             icon: 'e/insert_edit_link',
             callback: this._displayDialogue,
             tags: 'a'
         });
+
+        // And then the unlink button.
+        this.addBasicButton({
+            exec: 'unlink',
+            icon: 'e/remove_link',
+            title: 'unlink',
+
+            // Watch the following tags and add/remove highlighting as appropriate:
+            tags: 'a'
+        });
     },
 
     /**
diff --git a/lib/editor/atto/plugins/unlink/lang/en/atto_unlink.php b/lib/editor/atto/plugins/unlink/lang/en/atto_unlink.php
deleted file mode 100644
index bbf03b7a181..00000000000
--- a/lib/editor/atto/plugins/unlink/lang/en/atto_unlink.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * Strings for component 'atto_unlink', language 'en'.
- *
- * @package    atto_unlink
- * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$string['pluginname'] = 'Unlink';
diff --git a/lib/editor/atto/plugins/unlink/version.php b/lib/editor/atto/plugins/unlink/version.php
deleted file mode 100644
index 5e5b14395f2..00000000000
--- a/lib/editor/atto/plugins/unlink/version.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * Atto text editor integration version file.
- *
- * @package    atto_unlink
- * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$plugin->version   = 2014012800;        // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2013110500;        // Requires this Moodle version.
-$plugin->component = 'atto_unlink';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-debug.js b/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-debug.js
deleted file mode 100644
index abe24ce7505..00000000000
--- a/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-debug.js
+++ /dev/null
@@ -1,49 +0,0 @@
-YUI.add('moodle-atto_unlink-button', function (Y, NAME) {
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/*
- * @package    atto_unlink
- * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * @module moodle-atto_unlink-button
- */
-
-/**
- * Atto text editor unlink plugin.
- *
- * @namespace M.atto_unlink
- * @class button
- * @extends M.editor_atto.EditorPlugin
- */
-
-Y.namespace('M.atto_unlink').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
-    initializer: function() {
-        this.addBasicButton({
-            exec: 'unlink',
-            icon: 'e/remove_link',
-
-            // Watch the following tags and add/remove highlighting as appropriate:
-            tags: 'a'
-        });
-    }
-});
-
-
-}, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]});
diff --git a/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-min.js b/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-min.js
deleted file mode 100644
index 2e2111a7c0f..00000000000
--- a/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-min.js
+++ /dev/null
@@ -1 +0,0 @@
-YUI.add("moodle-atto_unlink-button",function(e,t){e.namespace("M.atto_unlink").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addBasicButton({exec:"unlink",icon:"e/remove_link",tags:"a"})}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
diff --git a/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button.js b/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button.js
deleted file mode 100644
index abe24ce7505..00000000000
--- a/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button.js
+++ /dev/null
@@ -1,49 +0,0 @@
-YUI.add('moodle-atto_unlink-button', function (Y, NAME) {
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/*
- * @package    atto_unlink
- * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * @module moodle-atto_unlink-button
- */
-
-/**
- * Atto text editor unlink plugin.
- *
- * @namespace M.atto_unlink
- * @class button
- * @extends M.editor_atto.EditorPlugin
- */
-
-Y.namespace('M.atto_unlink').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
-    initializer: function() {
-        this.addBasicButton({
-            exec: 'unlink',
-            icon: 'e/remove_link',
-
-            // Watch the following tags and add/remove highlighting as appropriate:
-            tags: 'a'
-        });
-    }
-});
-
-
-}, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]});
diff --git a/lib/editor/atto/plugins/unlink/yui/src/button/build.json b/lib/editor/atto/plugins/unlink/yui/src/button/build.json
deleted file mode 100644
index 57ceaa51efb..00000000000
--- a/lib/editor/atto/plugins/unlink/yui/src/button/build.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-  "name": "moodle-atto_unlink-button",
-  "builds": {
-    "moodle-atto_unlink-button": {
-      "jsfiles": [
-        "button.js"
-      ]
-    }
-  }
-}
diff --git a/lib/editor/atto/plugins/unlink/yui/src/button/js/button.js b/lib/editor/atto/plugins/unlink/yui/src/button/js/button.js
deleted file mode 100644
index e2aade20fc1..00000000000
--- a/lib/editor/atto/plugins/unlink/yui/src/button/js/button.js
+++ /dev/null
@@ -1,44 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/*
- * @package    atto_unlink
- * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * @module moodle-atto_unlink-button
- */
-
-/**
- * Atto text editor unlink plugin.
- *
- * @namespace M.atto_unlink
- * @class button
- * @extends M.editor_atto.EditorPlugin
- */
-
-Y.namespace('M.atto_unlink').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
-    initializer: function() {
-        this.addBasicButton({
-            exec: 'unlink',
-            icon: 'e/remove_link',
-
-            // Watch the following tags and add/remove highlighting as appropriate:
-            tags: 'a'
-        });
-    }
-});
diff --git a/lib/editor/atto/plugins/unlink/yui/src/button/meta/button.json b/lib/editor/atto/plugins/unlink/yui/src/button/meta/button.json
deleted file mode 100644
index dd73f16db1d..00000000000
--- a/lib/editor/atto/plugins/unlink/yui/src/button/meta/button.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-    "moodle-atto_unlink-button": {
-        "requires": [
-            "moodle-editor_atto-plugin"
-        ]
-    }
-}
diff --git a/lib/editor/atto/settings.php b/lib/editor/atto/settings.php
index 3ab47531346..fbfec135186 100644
--- a/lib/editor/atto/settings.php
+++ b/lib/editor/atto/settings.php
@@ -35,7 +35,7 @@ if ($ADMIN->fulltree) {
     $default = 'collapse = collapse
 style1 = title, bold, italic
 list = unorderedlist, orderedlist
-links = link, unlink, noautolink
+links = link, noautolink
 files = image, media, managefiles
 style2 = underline, strike, subscript, superscript
 align = align