aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/text-scanner.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/text-scanner.js')
-rw-r--r--ext/mixed/js/text-scanner.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js
index fb275452..7c705fc8 100644
--- a/ext/mixed/js/text-scanner.js
+++ b/ext/mixed/js/text-scanner.js
@@ -28,6 +28,7 @@ class TextScanner extends EventDispatcher {
this._ignorePoint = ignorePoint;
this._search = search;
+ this._isPrepared = false;
this._ignoreNodes = null;
this._causeCurrent = null;
@@ -69,10 +70,15 @@ class TextScanner extends EventDispatcher {
return this._causeCurrent;
}
+ prepare() {
+ this._isPrepared = true;
+ this.setEnabled(this._enabled);
+ }
+
setEnabled(enabled) {
this._eventListeners.removeAllEventListeners();
this._enabled = enabled;
- if (this._enabled) {
+ if (this._enabled && this._isPrepared) {
this._hookEvents();
} else {
this.clearSelection(true);