Loading js/patternkit.jsoneditor.es6.js +11 −7 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ /*globals Drupal:false */ /*globals jQuery:false */ /*globals JSONEditor:false */ /*globals once:false */ /** * @file * Provides Twig Pattern Library Editing Functionality. Loading @@ -12,6 +13,8 @@ * * @external JSONEditor * * @external once * * @todo .patternkit-editor-target .card all: initial */ Loading @@ -34,7 +37,7 @@ patternkitEditorProseMirror(jQuery, Drupal, JSONEditor); patternkitEditorObject(jQuery, Drupal, JSONEditor); patternkitEditorArray(jQuery, Drupal, JSONEditor); (function ($, Drupal, JSONEditor) { (function ($, Drupal, JSONEditor, once) { 'use strict'; Drupal.behaviors.patternkitEditor = { attach: function (context, settings) { Loading @@ -52,7 +55,7 @@ patternkitEditorArray(jQuery, Drupal, JSONEditor); } }; let $target = $('#patternkit-editor-target', context); $target.once('patternkit-editor').each(function () { $(once('patternkit-editor', $target)).each(function () { var loadingIndicatorClass = 'js-patternkit-loading__on'; $target.before(`<div class="${loadingIndicatorClass}"></div>`); Loading Loading @@ -225,18 +228,19 @@ patternkitEditorArray(jQuery, Drupal, JSONEditor); }; window.patternkitEditor.destroy(); delete window.patternkitEditor; $target.removeOnce('patternkit-editor'); $(once.remove('patternkit-editor', $target)); } } parent_call.call(this, formValues, elementSettings, options); }; $('[data-drupal-selector="edit-actions-submit"]').parent('form').once().each(function () { let $form = $('[data-drupal-selector="edit-actions-submit"]').parent('form'); $(once('json-editor-processed', $form, context)).each(function () { $(this).on('submit', (e) => { window.patternkitEditor.disable(); saveSchema(); window.patternkitEditor.destroy(); delete window.patternkitEditor; $target.removeOnce('patternkit-editor'); $(once.remove('patternkit-editor', $target)); $(this).off('submit'); }); }); Loading @@ -245,7 +249,7 @@ patternkitEditorArray(jQuery, Drupal, JSONEditor); // If user closes the Layout Builder dialog without saving, this cleans // up Patternkit (and, in turn) CKEditor instance. Code stolen from // `Drupal.behaviors.offCanvasEvents`. $(window).once('patternkit-jsoneditor-off-canvas').on('dialog:beforeclose', (event, dialog, $element) => { $(once('patternkit-jsoneditor-off-canvas', window)).on('dialog:beforeclose', (event, dialog, $element) => { // The editor may have already been destroyed if its form was // submitted. The following code only destroys the editor if the modal // gets closed without submitting the form. Loading @@ -265,4 +269,4 @@ patternkitEditorArray(jQuery, Drupal, JSONEditor); // `headerTemplate` property in schemas. JSONEditor.defaults.options.template = 'handlebars'; })(jQuery, Drupal, JSONEditor); })(jQuery, Drupal, JSONEditor, once); js/patternkit.jsoneditor.js +8 −7 Original line number Diff line number Diff line Loading @@ -1054,7 +1054,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi (0, _patternkitJsoneditorEditorObject.patternkitEditorObject)(jQuery, Drupal, JSONEditor); (0, _patternkitJsoneditorEditorArray.patternkitEditorArray)(jQuery, Drupal, JSONEditor); (function ($, Drupal, JSONEditor) { (function ($, Drupal, JSONEditor, once) { 'use strict'; Drupal.behaviors.patternkitEditor = { Loading @@ -1077,7 +1077,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi }; var $target = $('#patternkit-editor-target', context); $target.once('patternkit-editor').each(function () { $(once('patternkit-editor', $target)).each(function () { var loadingIndicatorClass = 'js-patternkit-loading__on'; $target.before("<div class=\"".concat(loadingIndicatorClass, "\"></div>")); var theme_js = settings.patternkitEditor.themeJS; Loading Loading @@ -1269,14 +1269,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi }; window.patternkitEditor.destroy(); delete window.patternkitEditor; $target.removeOnce('patternkit-editor'); $(once.remove('patternkit-editor', $target)); } } parent_call.call(this, formValues, elementSettings, options); }; $('[data-drupal-selector="edit-actions-submit"]').parent('form').once().each(function () { var $form = $('[data-drupal-selector="edit-actions-submit"]').parent('form'); $(once('json-editor-processed', $form, context)).each(function () { var _this2 = this; $(this).on('submit', function (e) { Loading @@ -1284,7 +1285,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi saveSchema(); window.patternkitEditor.destroy(); delete window.patternkitEditor; $target.removeOnce('patternkit-editor'); $(once.remove('patternkit-editor', $target)); $(_this2).off('submit'); }); }); Loading @@ -1292,7 +1293,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi // up Patternkit (and, in turn) CKEditor instance. Code stolen from // `Drupal.behaviors.offCanvasEvents`. $(window).once('patternkit-jsoneditor-off-canvas').on('dialog:beforeclose', function (event, dialog, $element) { $(once('patternkit-jsoneditor-off-canvas', window)).on('dialog:beforeclose', function (event, dialog, $element) { // The editor may have already been destroyed if its form was // submitted. The following code only destroys the editor if the modal // gets closed without submitting the form. Loading @@ -1311,7 +1312,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi // `headerTemplate` property in schemas. JSONEditor.defaults.options.template = 'handlebars'; })(jQuery, Drupal, JSONEditor); })(jQuery, Drupal, JSONEditor, once); },{"./patternkit.jsoneditor.ckeditor.es6":1,"./patternkit.jsoneditor.cygnet.es6.js":2,"./patternkit.jsoneditor.editor.array.es6":3,"./patternkit.jsoneditor.editor.object.es6":4,"./patternkit.jsoneditor.prosemirror.es6":6,"./patternkit.jsoneditor.quill.es6.js":7}],6:[function(require,module,exports){ "use strict"; Loading npm-shrinkwrap.json +8 −10 Original line number Diff line number Diff line Loading @@ -115,8 +115,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "optional": true "dev": true }, "readdirp": { "version": "3.5.0", Loading Loading @@ -1166,9 +1165,9 @@ } }, "@json-editor/json-editor": { "version": "2.7.0", "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/@json-editor/json-editor/-/json-editor-2.7.0.tgz", "integrity": "sha512-wFizbCCiH02kDPfndcrD9xif8ymSiIelDw299Di2lAO6RJsobfF1NcnsWIbVYHT9npL/1KLH9x6NNrfnmRS63w==", "version": "2.9.0-beta.0", "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/@json-editor/json-editor/-/json-editor-2.9.0-beta.0.tgz", "integrity": "sha512-lxHff4g/3XP4wX2qrGXdNBoeir0euX2MVyDs8BdsySFRFWD7FutPRenK8f1xVkgjHeofJaApYEab5K8+gerAqw==", "dev": true, "requires": { "core-js": "^3.12.1" Loading Loading @@ -2270,9 +2269,9 @@ } }, "core-js": { "version": "3.22.2", "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/core-js/-/core-js-3.22.2.tgz", "integrity": "sha512-Z5I2vzDnEIqO2YhELVMFcL1An2CIsFe9Q7byZhs8c/QxummxZlAHw33TUHbIte987LkisOgL0LwQ1P9D6VISnA==", "version": "3.25.3", "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/core-js/-/core-js-3.25.3.tgz", "integrity": "sha512-y1hvKXmPHvm5B7w4ln1S4uc9eV/O5+iFExSRUimnvIph11uaizFR8LFMdONN8hG3P2pipUfX4Y/fR8rAEtcHcQ==", "dev": true }, "core-js-compat": { Loading Loading @@ -5041,8 +5040,7 @@ "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true, "optional": true "dev": true }, "pify": { "version": "2.3.0", Loading patternkit.libraries.yml +2 −1 Original line number Diff line number Diff line Loading @@ -25,8 +25,9 @@ patternkit.jsoneditor: - core/drupal.dialog - core/drupal.dialog.ajax - core/drupalSettings - core/jquery - core/drupal.debounce - core/jquery - core/once - patternkit/jsoneditor - patternkit/quill Loading Loading
js/patternkit.jsoneditor.es6.js +11 −7 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ /*globals Drupal:false */ /*globals jQuery:false */ /*globals JSONEditor:false */ /*globals once:false */ /** * @file * Provides Twig Pattern Library Editing Functionality. Loading @@ -12,6 +13,8 @@ * * @external JSONEditor * * @external once * * @todo .patternkit-editor-target .card all: initial */ Loading @@ -34,7 +37,7 @@ patternkitEditorProseMirror(jQuery, Drupal, JSONEditor); patternkitEditorObject(jQuery, Drupal, JSONEditor); patternkitEditorArray(jQuery, Drupal, JSONEditor); (function ($, Drupal, JSONEditor) { (function ($, Drupal, JSONEditor, once) { 'use strict'; Drupal.behaviors.patternkitEditor = { attach: function (context, settings) { Loading @@ -52,7 +55,7 @@ patternkitEditorArray(jQuery, Drupal, JSONEditor); } }; let $target = $('#patternkit-editor-target', context); $target.once('patternkit-editor').each(function () { $(once('patternkit-editor', $target)).each(function () { var loadingIndicatorClass = 'js-patternkit-loading__on'; $target.before(`<div class="${loadingIndicatorClass}"></div>`); Loading Loading @@ -225,18 +228,19 @@ patternkitEditorArray(jQuery, Drupal, JSONEditor); }; window.patternkitEditor.destroy(); delete window.patternkitEditor; $target.removeOnce('patternkit-editor'); $(once.remove('patternkit-editor', $target)); } } parent_call.call(this, formValues, elementSettings, options); }; $('[data-drupal-selector="edit-actions-submit"]').parent('form').once().each(function () { let $form = $('[data-drupal-selector="edit-actions-submit"]').parent('form'); $(once('json-editor-processed', $form, context)).each(function () { $(this).on('submit', (e) => { window.patternkitEditor.disable(); saveSchema(); window.patternkitEditor.destroy(); delete window.patternkitEditor; $target.removeOnce('patternkit-editor'); $(once.remove('patternkit-editor', $target)); $(this).off('submit'); }); }); Loading @@ -245,7 +249,7 @@ patternkitEditorArray(jQuery, Drupal, JSONEditor); // If user closes the Layout Builder dialog without saving, this cleans // up Patternkit (and, in turn) CKEditor instance. Code stolen from // `Drupal.behaviors.offCanvasEvents`. $(window).once('patternkit-jsoneditor-off-canvas').on('dialog:beforeclose', (event, dialog, $element) => { $(once('patternkit-jsoneditor-off-canvas', window)).on('dialog:beforeclose', (event, dialog, $element) => { // The editor may have already been destroyed if its form was // submitted. The following code only destroys the editor if the modal // gets closed without submitting the form. Loading @@ -265,4 +269,4 @@ patternkitEditorArray(jQuery, Drupal, JSONEditor); // `headerTemplate` property in schemas. JSONEditor.defaults.options.template = 'handlebars'; })(jQuery, Drupal, JSONEditor); })(jQuery, Drupal, JSONEditor, once);
js/patternkit.jsoneditor.js +8 −7 Original line number Diff line number Diff line Loading @@ -1054,7 +1054,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi (0, _patternkitJsoneditorEditorObject.patternkitEditorObject)(jQuery, Drupal, JSONEditor); (0, _patternkitJsoneditorEditorArray.patternkitEditorArray)(jQuery, Drupal, JSONEditor); (function ($, Drupal, JSONEditor) { (function ($, Drupal, JSONEditor, once) { 'use strict'; Drupal.behaviors.patternkitEditor = { Loading @@ -1077,7 +1077,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi }; var $target = $('#patternkit-editor-target', context); $target.once('patternkit-editor').each(function () { $(once('patternkit-editor', $target)).each(function () { var loadingIndicatorClass = 'js-patternkit-loading__on'; $target.before("<div class=\"".concat(loadingIndicatorClass, "\"></div>")); var theme_js = settings.patternkitEditor.themeJS; Loading Loading @@ -1269,14 +1269,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi }; window.patternkitEditor.destroy(); delete window.patternkitEditor; $target.removeOnce('patternkit-editor'); $(once.remove('patternkit-editor', $target)); } } parent_call.call(this, formValues, elementSettings, options); }; $('[data-drupal-selector="edit-actions-submit"]').parent('form').once().each(function () { var $form = $('[data-drupal-selector="edit-actions-submit"]').parent('form'); $(once('json-editor-processed', $form, context)).each(function () { var _this2 = this; $(this).on('submit', function (e) { Loading @@ -1284,7 +1285,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi saveSchema(); window.patternkitEditor.destroy(); delete window.patternkitEditor; $target.removeOnce('patternkit-editor'); $(once.remove('patternkit-editor', $target)); $(_this2).off('submit'); }); }); Loading @@ -1292,7 +1293,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi // up Patternkit (and, in turn) CKEditor instance. Code stolen from // `Drupal.behaviors.offCanvasEvents`. $(window).once('patternkit-jsoneditor-off-canvas').on('dialog:beforeclose', function (event, dialog, $element) { $(once('patternkit-jsoneditor-off-canvas', window)).on('dialog:beforeclose', function (event, dialog, $element) { // The editor may have already been destroyed if its form was // submitted. The following code only destroys the editor if the modal // gets closed without submitting the form. Loading @@ -1311,7 +1312,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi // `headerTemplate` property in schemas. JSONEditor.defaults.options.template = 'handlebars'; })(jQuery, Drupal, JSONEditor); })(jQuery, Drupal, JSONEditor, once); },{"./patternkit.jsoneditor.ckeditor.es6":1,"./patternkit.jsoneditor.cygnet.es6.js":2,"./patternkit.jsoneditor.editor.array.es6":3,"./patternkit.jsoneditor.editor.object.es6":4,"./patternkit.jsoneditor.prosemirror.es6":6,"./patternkit.jsoneditor.quill.es6.js":7}],6:[function(require,module,exports){ "use strict"; Loading
npm-shrinkwrap.json +8 −10 Original line number Diff line number Diff line Loading @@ -115,8 +115,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "optional": true "dev": true }, "readdirp": { "version": "3.5.0", Loading Loading @@ -1166,9 +1165,9 @@ } }, "@json-editor/json-editor": { "version": "2.7.0", "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/@json-editor/json-editor/-/json-editor-2.7.0.tgz", "integrity": "sha512-wFizbCCiH02kDPfndcrD9xif8ymSiIelDw299Di2lAO6RJsobfF1NcnsWIbVYHT9npL/1KLH9x6NNrfnmRS63w==", "version": "2.9.0-beta.0", "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/@json-editor/json-editor/-/json-editor-2.9.0-beta.0.tgz", "integrity": "sha512-lxHff4g/3XP4wX2qrGXdNBoeir0euX2MVyDs8BdsySFRFWD7FutPRenK8f1xVkgjHeofJaApYEab5K8+gerAqw==", "dev": true, "requires": { "core-js": "^3.12.1" Loading Loading @@ -2270,9 +2269,9 @@ } }, "core-js": { "version": "3.22.2", "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/core-js/-/core-js-3.22.2.tgz", "integrity": "sha512-Z5I2vzDnEIqO2YhELVMFcL1An2CIsFe9Q7byZhs8c/QxummxZlAHw33TUHbIte987LkisOgL0LwQ1P9D6VISnA==", "version": "3.25.3", "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/core-js/-/core-js-3.25.3.tgz", "integrity": "sha512-y1hvKXmPHvm5B7w4ln1S4uc9eV/O5+iFExSRUimnvIph11uaizFR8LFMdONN8hG3P2pipUfX4Y/fR8rAEtcHcQ==", "dev": true }, "core-js-compat": { Loading Loading @@ -5041,8 +5040,7 @@ "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true, "optional": true "dev": true }, "pify": { "version": "2.3.0", Loading
patternkit.libraries.yml +2 −1 Original line number Diff line number Diff line Loading @@ -25,8 +25,9 @@ patternkit.jsoneditor: - core/drupal.dialog - core/drupal.dialog.ajax - core/drupalSettings - core/jquery - core/drupal.debounce - core/jquery - core/once - patternkit/jsoneditor - patternkit/quill Loading