Fix autoHideResults not working
This commit is contained in:
parent
7de24dd355
commit
75ff05148d
@ -158,7 +158,6 @@ class SettingsPopupPreview {
|
|||||||
const range = document.createRange();
|
const range = document.createRange();
|
||||||
range.selectNode(textNode);
|
range.selectNode(textNode);
|
||||||
const source = new TextSourceRange(range, range.toString(), null);
|
const source = new TextSourceRange(range, range.toString(), null);
|
||||||
if (source === null) { return; }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.frontend.searchSource(source, 'script');
|
await this.frontend.searchSource(source, 'script');
|
||||||
|
@ -336,18 +336,17 @@ class Frontend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const textSource = docRangeFromPoint(x, y, this.options);
|
const textSource = docRangeFromPoint(x, y, this.options);
|
||||||
if (
|
if (this.textSourceCurrent !== null && this.textSourceCurrent.equals(textSource)) {
|
||||||
textSource === null ||
|
|
||||||
(this.textSourceCurrent !== null && this.textSourceCurrent.equals(textSource))
|
|
||||||
) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await this.searchSource(textSource, cause);
|
await this.searchSource(textSource, cause);
|
||||||
} finally {
|
} finally {
|
||||||
|
if (textSource !== null) {
|
||||||
textSource.cleanup();
|
textSource.cleanup();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.onError(e);
|
this.onError(e);
|
||||||
}
|
}
|
||||||
@ -358,6 +357,7 @@ class Frontend {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
this.pendingLookup = true;
|
this.pendingLookup = true;
|
||||||
|
if (textSource !== null) {
|
||||||
results = (
|
results = (
|
||||||
await this.findTerms(textSource) ||
|
await this.findTerms(textSource) ||
|
||||||
await this.findKanji(textSource)
|
await this.findKanji(textSource)
|
||||||
@ -366,9 +366,10 @@ class Frontend {
|
|||||||
const focus = (cause === 'mouse');
|
const focus = (cause === 'mouse');
|
||||||
this.showContent(textSource, focus, results.definitions, results.type);
|
this.showContent(textSource, focus, results.definitions, results.type);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (window.yomichan_orphaned) {
|
if (window.yomichan_orphaned) {
|
||||||
if (textSource && this.options.scanning.modifier !== 'none') {
|
if (textSource !== null && this.options.scanning.modifier !== 'none') {
|
||||||
this.lastShowPromise = this.popup.showContent(
|
this.lastShowPromise = this.popup.showContent(
|
||||||
textSource.getRect(),
|
textSource.getRect(),
|
||||||
textSource.getWritingMode(),
|
textSource.getWritingMode(),
|
||||||
@ -386,7 +387,7 @@ class Frontend {
|
|||||||
this.pendingLookup = false;
|
this.pendingLookup = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return results !== null;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
showContent(textSource, focus, definitions, type) {
|
showContent(textSource, focus, definitions, type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user