summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-27 11:47:56 -0400
committerGitHub <noreply@github.com>2020-09-27 11:47:56 -0400
commit3b6e3193ae5e6248ad1405de50a98fb41796bc2e (patch)
tree8dfac9a4010efbc1ee22e080f78c106b29dd3e72 /ext/bg/js
parentcdd649ea3d3c933b571db1b00bc40162b4da8c01 (diff)
Fix data-setting attributes not being updated on index change (#872)
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/settings/scan-inputs-controller.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/ext/bg/js/settings/scan-inputs-controller.js b/ext/bg/js/settings/scan-inputs-controller.js
index 0606d142..5da0d5e1 100644
--- a/ext/bg/js/settings/scan-inputs-controller.js
+++ b/ext/bg/js/settings/scan-inputs-controller.js
@@ -135,6 +135,7 @@ class ScanInputField {
set index(value) {
this._index = value;
+ this._updateDataSettingTargets();
}
prepare(container, include, exclude) {
@@ -158,10 +159,7 @@ class ScanInputField {
this._eventListeners.on(this._excludeInputField, 'change', this._onExcludeValueChange.bind(this));
this._eventListeners.addEventListener(removeButton, 'click', this._onRemoveClick.bind(this));
- for (const typeCheckbox of node.querySelectorAll('.scan-input-settings-checkbox')) {
- const {property} = typeCheckbox.dataset;
- typeCheckbox.dataset.setting = `scanning.inputs[${this._index}].${property}`;
- }
+ this._updateDataSettingTargets();
}
cleanup() {
@@ -201,4 +199,12 @@ class ScanInputField {
const node = this._node.querySelector(`input.scan-input-settings-checkbox[data-property="types.${pointerType}"]`);
return node !== null && node.checked;
}
+
+ _updateDataSettingTargets() {
+ const index = this._index;
+ for (const typeCheckbox of this._node.querySelectorAll('.scan-input-settings-checkbox')) {
+ const {property} = typeCheckbox.dataset;
+ typeCheckbox.dataset.setting = `scanning.inputs[${index}].${property}`;
+ }
+ }
}