summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index c3498e85..6e41a190 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -1145,9 +1145,12 @@ class Display extends EventDispatcher {
}
async _getScreenshot() {
+ const ownerFrameId = this._ownerFrameId;
+ let token = null;
try {
- await this._setPopupVisibleOverride(false);
- await promiseTimeout(1); // Wait for popup to be hidden.
+ if (ownerFrameId !== null) {
+ token = await api.crossFrame.invoke(ownerFrameId, 'setAllVisibleOverride', {value: false, priority: 0, awaitFrame: true});
+ }
const {format, quality} = this._options.anki.screenshot;
const dataUrl = await api.screenshotGet({format, quality});
@@ -1155,7 +1158,9 @@ class Display extends EventDispatcher {
return {dataUrl, format};
} finally {
- await this._setPopupVisibleOverride(null);
+ if (token !== null) {
+ await api.crossFrame.invoke(ownerFrameId, 'clearAllVisibleOverride', {token});
+ }
}
}
@@ -1163,10 +1168,6 @@ class Display extends EventDispatcher {
return this._options.general.resultOutputMode === 'merge' ? 0 : -1;
}
- _setPopupVisibleOverride(visible) {
- return api.broadcastTab('popupSetVisibleOverride', {visible});
- }
-
_getEntry(index) {
const entries = this._container.querySelectorAll('.entry');
return index >= 0 && index < entries.length ? entries[index] : null;