diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-08-23 11:15:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-23 11:15:23 -0400 |
commit | 1ab853a4d5bb0fdfe329282be2ae213ec1563252 (patch) | |
tree | ea30788a164b054c45510a4a13fb04b78f338cae /ext | |
parent | a96e1c20a7239254690822dac249c03a789ebd47 (diff) |
Display owner frame (#751)
* Move ownerFrameId definition to Display
* Rename _invoke to _invokeOwner
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fg/js/float.js | 11 | ||||
-rw-r--r-- | ext/mixed/js/display.js | 9 |
2 files changed, 14 insertions, 6 deletions
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js index 8526c9c1..7f673bd5 100644 --- a/ext/fg/js/float.js +++ b/ext/fg/js/float.js @@ -25,7 +25,6 @@ class DisplayFloat extends Display { constructor() { super(document.querySelector('#spinner'), document.querySelector('#definitions')); this._nestedPopupsPrepared = false; - this._ownerFrameId = null; this._frameEndpoint = new FrameEndpoint(); this._windowMessageHandlers = new Map([ ['extensionUnloaded', {async: false, handler: this._onMessageExtensionUnloaded.bind(this)}] @@ -59,7 +58,7 @@ class DisplayFloat extends Display { } onEscape() { - this._invoke('closePopup'); + this._invokeOwner('closePopup'); } async setOptionsContext(optionsContext) { @@ -99,7 +98,7 @@ class DisplayFloat extends Display { } async _onMessageConfigure({frameId, ownerFrameId, popupId, optionsContext, childrenSupported, scale}) { - this._ownerFrameId = ownerFrameId; + this.ownerFrameId = ownerFrameId; this.setOptionsContext(optionsContext); await this.updateOptions(); @@ -158,7 +157,7 @@ class DisplayFloat extends Display { _copySelection() { if (window.getSelection().toString()) { return false; } - this._invoke('copySelection'); + this._invokeOwner('copySelection'); return true; } @@ -197,7 +196,7 @@ class DisplayFloat extends Display { await onOptionsUpdated(); } - _invoke(action, params={}) { - return api.crossFrame.invoke(this._ownerFrameId, action, params); + _invokeOwner(action, params={}) { + return api.crossFrame.invoke(this.ownerFrameId, action, params); } } diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 3f8a43ab..c3498e85 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -82,6 +82,7 @@ class Display extends EventDispatcher { documentUtil: this._documentUtil }); this._mode = null; + this._ownerFrameId = null; this.registerActions([ ['close', () => { this.onEscape(); }], @@ -147,6 +148,14 @@ class Display extends EventDispatcher { return this._mode; } + get ownerFrameId() { + return this._ownerFrameId; + } + + set ownerFrameId(value) { + this._ownerFrameId = value; + } + async prepare() { this._updateMode(); this._setInteractive(true); |