diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-06-21 16:14:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-21 16:14:05 -0400 |
commit | f2991fb9ee8e83738b726eb558af992f4bb5d9dc (patch) | |
tree | 6323a3ec9549131a6ef19e16595fd08fb5c31b9f /ext/mixed/js/text-scanner.js | |
parent | 244ab31bb2edb53ff7aecb51d2dd60b50a24c194 (diff) |
Frontend initialization refactor (#610)
* Create member functions for ignoreElements and ignorePoint
* Create addFullscreenChangeEventListener utility
* Move popup creation management into Frontend
* Move getUrl implementation
* Remove old setup
* Remove try/catch block
* Error wrap
* Add prepare call to TextScanner
* Update depth when popup changes
* Refactor how Frontend gets PopupFactory and frameId
* Update popup preview to work
* Update popup preview frame to use the frontend's popup
* Update how nested popups are set up
* Error wrap
* Update how popups are set up on the search page
* Error wrap
* Error unwrap
* Add missing prepare
* Remove use of frontendInitializationData
* Catch and log errors
Diffstat (limited to 'ext/mixed/js/text-scanner.js')
-rw-r--r-- | ext/mixed/js/text-scanner.js | 8 |
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); |