From 2dadb738bfd48510db2174323528fe769731c05a Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 28 Jan 2020 11:36:14 +0000 Subject: Issue #3101543 by lauriii, bnjmnm, ravi.shankar: Update core JavaScript dependencies listed in package.json --- core/modules/system/js/system.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'core/modules/system/js/system.js') diff --git a/core/modules/system/js/system.js b/core/modules/system/js/system.js index f23a69a93714..f8cbd41f6180 100644 --- a/core/modules/system/js/system.js +++ b/core/modules/system/js/system.js @@ -7,7 +7,6 @@ (function ($, Drupal, drupalSettings) { var ids = []; - Drupal.behaviors.copyFieldValue = { attach: function attach(context) { Object.keys(drupalSettings.copyFieldValue || {}).forEach(function (element) { @@ -16,18 +15,18 @@ if (ids.length) { $('body').once('copy-field-values').on('value:copy', this.valueTargetCopyHandler); - - $('#' + ids.join(', #')).once('copy-field-values').on('blur', this.valueSourceBlurHandler); + $("#".concat(ids.join(', #'))).once('copy-field-values').on('blur', this.valueSourceBlurHandler); } }, detach: function detach(context, settings, trigger) { if (trigger === 'unload' && ids.length) { $('body').removeOnce('copy-field-values').off('value:copy'); - $('#' + ids.join(', #')).removeOnce('copy-field-values').off('blur'); + $("#".concat(ids.join(', #'))).removeOnce('copy-field-values').off('blur'); } }, valueTargetCopyHandler: function valueTargetCopyHandler(e, value) { var $target = $(e.target); + if ($target.val() === '') { $target.val(value); } @@ -35,7 +34,7 @@ valueSourceBlurHandler: function valueSourceBlurHandler(e) { var value = $(e.target).val(); var targetIds = drupalSettings.copyFieldValue[e.target.id]; - $('#' + targetIds.join(', #')).trigger('value:copy', value); + $("#".concat(targetIds.join(', #'))).trigger('value:copy', value); } }; })(jQuery, Drupal, drupalSettings); \ No newline at end of file -- cgit v1.2.3