From f947865904aa352fe34d30e5e2894a2372fd1b33 Mon Sep 17 00:00:00 2001 From: jjaffeux Date: Mon, 20 Apr 2020 17:07:04 +0200 Subject: [PATCH] FIX: ensures correct updates on input and clear --- javascripts/discourse/initializers/setup.js.es6 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/javascripts/discourse/initializers/setup.js.es6 b/javascripts/discourse/initializers/setup.js.es6 index 35d66a3..5600940 100644 --- a/javascripts/discourse/initializers/setup.js.es6 +++ b/javascripts/discourse/initializers/setup.js.es6 @@ -227,6 +227,18 @@ export default { node.value = node.parentNode.dataset.default || (node.tagName === "SELECT" ? "none" : ""); + + processChange({ + target: { + value: + node.parentNode.dataset.default || + (node.tagName === "SELECT" ? "none" : ""), + dataset: { + key: node.dataset.key, + delimiter: node.dataset.delimiter + } + } + }); }); event.target.disabled = true; @@ -284,10 +296,10 @@ export default { $cooked .on("input", ".discourse-placeholder-value", inputEvent => - debounce(this, processChange, inputEvent, 250) + debounce(this, processChange, inputEvent, 150) ) .on("change", ".discourse-placeholder-select", inputEvent => - debounce(this, processChange, inputEvent, 250) + debounce(this, processChange, inputEvent, 150) ); later(_fillPlaceholders, 500);