summaryrefslogtreecommitdiff
path: root/ext/mixed
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed')
-rw-r--r--ext/mixed/js/text-scanner.js16
1 files changed, 5 insertions, 11 deletions
diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js
index 85be7119..bff9544f 100644
--- a/ext/mixed/js/text-scanner.js
+++ b/ext/mixed/js/text-scanner.js
@@ -22,13 +22,11 @@
*/
class TextScanner {
- constructor(node, ignoreElements, ignorePoints, canEnable=null) {
+ constructor(node, ignoreElements, ignorePoints) {
this.node = node;
this.ignoreElements = ignoreElements;
this.ignorePoints = ignorePoints;
- this.canEnable = canEnable;
-
this.ignoreNodes = null;
this.scanTimerPromise = null;
@@ -226,12 +224,8 @@ class TextScanner {
}
}
- setEnabled(enabled) {
- if (this.canEnable !== null && !this.canEnable()) {
- enabled = false;
- }
-
- if (enabled) {
+ setEnabled(enabled, canEnable) {
+ if (enabled && canEnable) {
if (!this.enabled) {
this.hookEvents();
this.enabled = true;
@@ -277,9 +271,9 @@ class TextScanner {
];
}
- setOptions(options) {
+ setOptions(options, canEnable=true) {
this.options = options;
- this.setEnabled(this.options.general.enable);
+ this.setEnabled(this.options.general.enable, canEnable);
}
async searchAt(x, y, cause) {