Fix popup preview disappearing after changing a setting (#1707)

This commit is contained in:
toasted-nutbread 2021-05-23 14:30:31 -04:00 committed by GitHub
parent 5188e49cd4
commit 8e330d54d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -565,6 +565,7 @@ class Frontend {
_updateTextScannerEnabled() { _updateTextScannerEnabled() {
const enabled = (this._options !== null && this._options.general.enable && !this._disabledOverride); const enabled = (this._options !== null && this._options.general.enable && !this._disabledOverride);
if (enabled === this._textScanner.isEnabled()) { return; }
this._textScanner.setEnabled(enabled); this._textScanner.setEnabled(enabled);
this._clearSelection(true); this._clearSelection(true);
} }

View File

@ -119,6 +119,10 @@ class TextScanner extends EventDispatcher {
this.setEnabled(this._enabled); this.setEnabled(this._enabled);
} }
isEnabled() {
return this._enabled;
}
setEnabled(enabled) { setEnabled(enabled) {
this._enabled = enabled; this._enabled = enabled;