Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / ckeditor / js / plugins / drupalimagecaption / plugin.js
index c9c9427327023947c4cff89f6310622b28a46372..7cd215a70589c674a9afa4badca054a250350e97 100644 (file)
@@ -6,6 +6,22 @@
 **/
 
 (function (CKEDITOR) {
+  function findElementByName(element, name) {
+    if (element.name === name) {
+      return element;
+    }
+
+    var found = null;
+    element.forEach(function (el) {
+      if (el.name === name) {
+        found = el;
+
+        return false;
+      }
+    }, CKEDITOR.NODE_ELEMENT);
+    return found;
+  }
+
   CKEDITOR.plugins.add('drupalimagecaption', {
     requires: 'drupalimage',
 
         widgetDefinition.upcast = function (element, data) {
           if (element.name !== 'img' || !element.attributes['data-entity-type'] || !element.attributes['data-entity-uuid']) {
             return;
-          } else if (element.attributes['data-cke-realelement']) {
-              return;
-            }
+          }
+
+          if (element.attributes['data-cke-realelement']) {
+            return;
+          }
 
           element = originalUpcast.call(this, element, data);
           var attrs = element.attributes;
       }
     }
   });
-
-  function findElementByName(element, name) {
-    if (element.name === name) {
-      return element;
-    }
-
-    var found = null;
-    element.forEach(function (el) {
-      if (el.name === name) {
-        found = el;
-
-        return false;
-      }
-    }, CKEDITOR.NODE_ELEMENT);
-    return found;
-  }
 })(CKEDITOR);
\ No newline at end of file