Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / ckeditor / js / plugins / drupallink / plugin.js
index d53f49a345ec2a1670fe8c675b0552863a954947..f8e2505d5ba67afa1909c091189332b2b99a278a 100644 (file)
     };
   }
 
+  function getSelectedLink(editor) {
+    var selection = editor.getSelection();
+    var selectedElement = selection.getSelectedElement();
+    if (selectedElement && selectedElement.is('a')) {
+      return selectedElement;
+    }
+
+    var range = selection.getRanges(true)[0];
+
+    if (range) {
+      range.shrink(CKEDITOR.SHRINK_TEXT);
+      return editor.elementPath(range.getCommonAncestor()).contains('a', 1);
+    }
+    return null;
+  }
+
   CKEDITOR.plugins.add('drupallink', {
     icons: 'drupallink,drupalunlink',
     hidpi: true,
                 range.selectNodeContents(text);
               }
 
-              var style = new CKEDITOR.style({ element: 'a', attributes: returnValues.attributes });
+              var style = new CKEDITOR.style({
+                element: 'a',
+                attributes: returnValues.attributes
+              });
               style.type = CKEDITOR.STYLE_INLINE;
               style.applyToRange(range);
               range.select();
           }
         }),
         exec: function exec(editor) {
-          var style = new CKEDITOR.style({ element: 'a', type: CKEDITOR.STYLE_INLINE, alwaysRemoveElement: 1 });
+          var style = new CKEDITOR.style({
+            element: 'a',
+            type: CKEDITOR.STYLE_INLINE,
+            alwaysRemoveElement: 1
+          });
           editor.removeStyle(style);
         },
         refresh: function refresh(editor, path) {
 
           var menu = {};
           if (anchor.getAttribute('href') && anchor.getChildCount()) {
-            menu = { link: CKEDITOR.TRISTATE_OFF, unlink: CKEDITOR.TRISTATE_OFF };
+            menu = {
+              link: CKEDITOR.TRISTATE_OFF,
+              unlink: CKEDITOR.TRISTATE_OFF
+            };
           }
           return menu;
         });
     }
   });
 
-  function getSelectedLink(editor) {
-    var selection = editor.getSelection();
-    var selectedElement = selection.getSelectedElement();
-    if (selectedElement && selectedElement.is('a')) {
-      return selectedElement;
-    }
-
-    var range = selection.getRanges(true)[0];
-
-    if (range) {
-      range.shrink(CKEDITOR.SHRINK_TEXT);
-      return editor.elementPath(range.getCommonAncestor()).contains('a', 1);
-    }
-    return null;
-  }
-
   CKEDITOR.plugins.drupallink = {
     parseLinkAttributes: parseAttributes,
     getLinkAttributes: getAttributes