Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / quickedit / js / util.es6.js
index 192cea6537b21cf2372c9676c7392bb07be88a3b..b741c2b7e0f9a917ea55ed7773e30c97fee20936 100644 (file)
@@ -3,7 +3,7 @@
  * Provides utility functions for Quick Edit.
  */
 
-(function ($, Drupal) {
+(function($, Drupal) {
   /**
    * @namespace
    */
@@ -18,7 +18,8 @@
    *
    * @type {string}
    */
-  Drupal.quickedit.util.constants.transitionEnd = 'transitionEnd.quickedit webkitTransitionEnd.quickedit transitionend.quickedit msTransitionEnd.quickedit oTransitionEnd.quickedit';
+  Drupal.quickedit.util.constants.transitionEnd =
+    'transitionEnd.quickedit webkitTransitionEnd.quickedit transitionend.quickedit msTransitionEnd.quickedit oTransitionEnd.quickedit';
 
   /**
    * Converts a field id into a formatted url path.
@@ -37,7 +38,7 @@
    * @return {string}
    *   The formatted URL.
    */
-  Drupal.quickedit.util.buildUrl = function (id, urlFormat) {
+  Drupal.quickedit.util.buildUrl = function(id, urlFormat) {
     const parts = id.split('/');
     return Drupal.formatString(decodeURIComponent(urlFormat), {
       '!entity_type': parts[0],
@@ -56,7 +57,7 @@
    * @param {string} message
    *   The message to use in the modal dialog.
    */
-  Drupal.quickedit.util.networkErrorModal = function (title, message) {
+  Drupal.quickedit.util.networkErrorModal = function(title, message) {
     const $message = $(`<div>${message}</div>`);
     const networkErrorModal = Drupal.dialog($message.get(0), {
       title,
         },
       ],
       create() {
-        $(this).parent().find('.ui-dialog-titlebar-close').remove();
+        $(this)
+          .parent()
+          .find('.ui-dialog-titlebar-close')
+          .remove();
       },
       close(event) {
         // Automatically destroy the DOM element that was used for the dialog.
@@ -85,7 +89,6 @@
    * @namespace
    */
   Drupal.quickedit.util.form = {
-
     /**
      * Loads a form, calls a callback to insert.
      *
 
       // Create a Drupal.ajax instance to load the form.
       const formLoaderAjax = Drupal.ajax({
-        url: Drupal.quickedit.util.buildUrl(fieldID, Drupal.url('quickedit/form/!entity_type/!id/!field_name/!langcode/!view_mode')),
+        url: Drupal.quickedit.util.buildUrl(
+          fieldID,
+          Drupal.url(
+            'quickedit/form/!entity_type/!id/!field_name/!langcode/!view_mode',
+          ),
+        ),
         submit: {
           nocssjs: options.nocssjs,
           reset: options.reset,
         error(xhr, url) {
           // Show a modal to inform the user of the network error.
           const fieldLabel = Drupal.quickedit.metadata.get(fieldID, 'label');
-          const message = Drupal.t('Could not load the form for <q>@field-label</q>, either due to a website problem or a network connection problem.<br>Please try again.', { '@field-label': fieldLabel });
-          Drupal.quickedit.util.networkErrorModal(Drupal.t('Network problem!'), message);
+          const message = Drupal.t(
+            'Could not load the form for <q>@field-label</q>, either due to a website problem or a network connection problem.<br>Please try again.',
+            { '@field-label': fieldLabel },
+          );
+          Drupal.quickedit.util.networkErrorModal(
+            Drupal.t('Network problem!'),
+            message,
+          );
 
           // Change the state back to "candidate", to allow the user to start
           // in-place editing of the field again.
         },
       });
       // Implement a scoped quickeditFieldForm AJAX command: calls the callback.
-      formLoaderAjax.commands.quickeditFieldForm = function (ajax, response, status) {
+      formLoaderAjax.commands.quickeditFieldForm = function(
+        ajax,
+        response,
+        status,
+      ) {
         callback(response.data, ajax);
         Drupal.ajax.instances[this.instanceIndex] = null;
       };
          *   The HTTP status code.
          */
         success(response, status) {
-          Object.keys(response || {}).forEach((i) => {
+          Object.keys(response || {}).forEach(i => {
             if (response[i].command && this.commands[response[i].command]) {
               this.commands[response[i].command](this, response[i], status);
             }
     unajaxifySaving(ajax) {
       $(ajax.element).off('click.quickedit');
     },
-
   };
-}(jQuery, Drupal));
+})(jQuery, Drupal);