From c9947cb9ef79f19a044ac31a1ee0a6f8cd1e23a8 Mon Sep 17 00:00:00 2001 From: Carson Oldson Date: Sat, 7 Sep 2024 07:39:18 -0500 Subject: [PATCH] [EPAD8-2544] Resolving issue with ck4 plugin code calling removed jquery once. --- .../modules/custom/epa_wysiwyg/epa_wysiwyg.libraries.yml | 2 ++ .../modules/custom/epa_wysiwyg/js/epa_wysiwyg_linkit.js | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/services/drupal/web/modules/custom/epa_wysiwyg/epa_wysiwyg.libraries.yml b/services/drupal/web/modules/custom/epa_wysiwyg/epa_wysiwyg.libraries.yml index 147a9e2d06..45b573ce07 100644 --- a/services/drupal/web/modules/custom/epa_wysiwyg/epa_wysiwyg.libraries.yml +++ b/services/drupal/web/modules/custom/epa_wysiwyg/epa_wysiwyg.libraries.yml @@ -15,7 +15,9 @@ epa-wysiwyg-linkit: js: js/epa_wysiwyg_linkit.js: {} dependencies: + - core/drupal - core/jquery + - core/once # CKEditor5 libraries epa-new-tag-ckeditor5: diff --git a/services/drupal/web/modules/custom/epa_wysiwyg/js/epa_wysiwyg_linkit.js b/services/drupal/web/modules/custom/epa_wysiwyg/js/epa_wysiwyg_linkit.js index 19078b5f62..e7eda7a02a 100644 --- a/services/drupal/web/modules/custom/epa_wysiwyg/js/epa_wysiwyg_linkit.js +++ b/services/drupal/web/modules/custom/epa_wysiwyg/js/epa_wysiwyg_linkit.js @@ -3,7 +3,7 @@ * EPA Linkit customizations. */ -(function ($) { +(function (Drupal, $, once) { Drupal.behaviors.epaWysiwygLinkit = { attach: function (context) { @@ -13,21 +13,20 @@ // Populate the defaultInput with the value of hrefInput on load, if there // is one. - $('[name="attributes[href]"]', context).once('epaWysiwygLinkitInitInput').each(function() { + $(once('epaWysiwygLinkitInitInput', '[name="attributes[href]"]', context)).each(function() { if ($hrefInput.val() != '') { $defaultInput.val($hrefInput.val()); $hrefInput.val(''); } }); - // Clear the linkit input values when the profile is changed to reset the // autocomplete results. - $('[name="attributes[select-profile]"]', context).once('epaWysiwygLinkitResetInput').change(function() { + $(once('epaWysiwygLinkitResetInput', '[name="attributes[select-profile]"]', context)).change(function() { $defaultInput.val(''); $webAreaInput.val(''); }); } }; -})(jQuery); +})(Drupal, jQuery, once);