summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/system/js/system.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/system/js/system.js')
-rw-r--r--core/modules/system/js/system.js9
1 files changed, 4 insertions, 5 deletions
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