Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / editor / js / editor.admin.js
index 9cec9ada6aec6256fa718fb29ac8fa74ed7b25f6..b229620ad40130f3deba872ff1d5390cece36c11 100644 (file)
       $(document).trigger('drupalEditorFeatureModified', feature);
     },
     featureIsAllowedByFilters: function featureIsAllowedByFilters(feature) {
+      function emptyProperties(section) {
+        return section.attributes.length === 0 && section.classes.length === 0 && section.styles.length === 0;
+      }
+
       function generateUniverseFromFeatureRequirements(feature) {
         var properties = ['attributes', 'styles', 'classes'];
         var universe = {};
         return universe;
       }
 
-      function emptyProperties(section) {
-        return section.attributes.length === 0 && section.classes.length === 0 && section.styles.length === 0;
-      }
-
-      function findPropertyValuesOnTag(universe, tag, property, propertyValues, allowing) {
-        if (tag === '*') {
-          return findPropertyValuesOnAllTags(universe, property, propertyValues, allowing);
-        }
-
-        var atLeastOneFound = false;
-        _.each(propertyValues, function (propertyValue) {
-          if (findPropertyValueOnTag(universe, tag, property, propertyValue, allowing)) {
-            atLeastOneFound = true;
-          }
-        });
-        return atLeastOneFound;
-      }
-
-      function findPropertyValuesOnAllTags(universe, property, propertyValues, allowing) {
-        var atLeastOneFound = false;
-        _.each(_.keys(universe), function (tag) {
-          if (findPropertyValuesOnTag(universe, tag, property, propertyValues, allowing)) {
-            atLeastOneFound = true;
-          }
-        });
-        return atLeastOneFound;
-      }
-
       function findPropertyValueOnTag(universe, tag, property, propertyValue, allowing) {
         if (!_.has(universe, tag)) {
           return false;
         return atLeastOneFound;
       }
 
-      function deleteFromUniverseIfAllowed(universe, tag) {
+      function findPropertyValuesOnAllTags(universe, property, propertyValues, allowing) {
+        var atLeastOneFound = false;
+        _.each(_.keys(universe), function (tag) {
+          if (findPropertyValuesOnTag(universe, tag, property, propertyValues, allowing)) {
+            atLeastOneFound = true;
+          }
+        });
+        return atLeastOneFound;
+      }
+
+      function findPropertyValuesOnTag(universe, tag, property, propertyValues, allowing) {
         if (tag === '*') {
-          return deleteAllTagsFromUniverseIfAllowed(universe);
-        }
-        if (_.has(universe, tag) && _.every(_.omit(universe[tag], 'touchedByAllowedPropertyRule'))) {
-          delete universe[tag];
-          return true;
+          return findPropertyValuesOnAllTags(universe, property, propertyValues, allowing);
         }
-        return false;
+
+        var atLeastOneFound = false;
+        _.each(propertyValues, function (propertyValue) {
+          if (findPropertyValueOnTag(universe, tag, property, propertyValue, allowing)) {
+            atLeastOneFound = true;
+          }
+        });
+        return atLeastOneFound;
       }
 
       function deleteAllTagsFromUniverseIfAllowed(universe) {
         return atLeastOneDeleted;
       }
 
+      function deleteFromUniverseIfAllowed(universe, tag) {
+        if (tag === '*') {
+          return deleteAllTagsFromUniverseIfAllowed(universe);
+        }
+        if (_.has(universe, tag) && _.every(_.omit(universe[tag], 'touchedByAllowedPropertyRule'))) {
+          delete universe[tag];
+          return true;
+        }
+        return false;
+      }
+
       function anyForbiddenFilterRuleMatches(universe, filterStatus) {
         var properties = ['attributes', 'styles', 'classes'];
 
       }
 
       Drupal.filterConfiguration.update();
-
-      for (var filterID in Drupal.filterConfiguration.statuses) {
-        if (Drupal.filterConfiguration.statuses.hasOwnProperty(filterID)) {
-          var filterStatus = Drupal.filterConfiguration.statuses[filterID];
-          if (!filterStatusAllowsFeature(filterStatus, feature)) {
-            return false;
-          }
-        }
-      }
-
-      return true;
+      return Object.keys(Drupal.filterConfiguration.statuses).every(function (filterID) {
+        return filterStatusAllowsFeature(Drupal.filterConfiguration.statuses[filterID], feature);
+      });
     }
   };
 
   Drupal.EditorFeatureHTMLRule = function () {
-    this.required = { tags: [], attributes: [], styles: [], classes: [] };
+    this.required = {
+      tags: [],
+      attributes: [],
+      styles: [],
+      classes: []
+    };
 
-    this.allowed = { tags: [], attributes: [], styles: [], classes: [] };
+    this.allowed = {
+      tags: [],
+      attributes: [],
+      styles: [],
+      classes: []
+    };
 
     this.raw = null;
   };