Display owner frame (#751)
* Move ownerFrameId definition to Display * Rename _invoke to _invokeOwner
This commit is contained in:
parent
a96e1c20a7
commit
1ab853a4d5
@ -25,7 +25,6 @@ class DisplayFloat extends Display {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super(document.querySelector('#spinner'), document.querySelector('#definitions'));
|
super(document.querySelector('#spinner'), document.querySelector('#definitions'));
|
||||||
this._nestedPopupsPrepared = false;
|
this._nestedPopupsPrepared = false;
|
||||||
this._ownerFrameId = null;
|
|
||||||
this._frameEndpoint = new FrameEndpoint();
|
this._frameEndpoint = new FrameEndpoint();
|
||||||
this._windowMessageHandlers = new Map([
|
this._windowMessageHandlers = new Map([
|
||||||
['extensionUnloaded', {async: false, handler: this._onMessageExtensionUnloaded.bind(this)}]
|
['extensionUnloaded', {async: false, handler: this._onMessageExtensionUnloaded.bind(this)}]
|
||||||
@ -59,7 +58,7 @@ class DisplayFloat extends Display {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onEscape() {
|
onEscape() {
|
||||||
this._invoke('closePopup');
|
this._invokeOwner('closePopup');
|
||||||
}
|
}
|
||||||
|
|
||||||
async setOptionsContext(optionsContext) {
|
async setOptionsContext(optionsContext) {
|
||||||
@ -99,7 +98,7 @@ class DisplayFloat extends Display {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _onMessageConfigure({frameId, ownerFrameId, popupId, optionsContext, childrenSupported, scale}) {
|
async _onMessageConfigure({frameId, ownerFrameId, popupId, optionsContext, childrenSupported, scale}) {
|
||||||
this._ownerFrameId = ownerFrameId;
|
this.ownerFrameId = ownerFrameId;
|
||||||
this.setOptionsContext(optionsContext);
|
this.setOptionsContext(optionsContext);
|
||||||
|
|
||||||
await this.updateOptions();
|
await this.updateOptions();
|
||||||
@ -158,7 +157,7 @@ class DisplayFloat extends Display {
|
|||||||
|
|
||||||
_copySelection() {
|
_copySelection() {
|
||||||
if (window.getSelection().toString()) { return false; }
|
if (window.getSelection().toString()) { return false; }
|
||||||
this._invoke('copySelection');
|
this._invokeOwner('copySelection');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +196,7 @@ class DisplayFloat extends Display {
|
|||||||
await onOptionsUpdated();
|
await onOptionsUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
_invoke(action, params={}) {
|
_invokeOwner(action, params={}) {
|
||||||
return api.crossFrame.invoke(this._ownerFrameId, action, params);
|
return api.crossFrame.invoke(this.ownerFrameId, action, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ class Display extends EventDispatcher {
|
|||||||
documentUtil: this._documentUtil
|
documentUtil: this._documentUtil
|
||||||
});
|
});
|
||||||
this._mode = null;
|
this._mode = null;
|
||||||
|
this._ownerFrameId = null;
|
||||||
|
|
||||||
this.registerActions([
|
this.registerActions([
|
||||||
['close', () => { this.onEscape(); }],
|
['close', () => { this.onEscape(); }],
|
||||||
@ -147,6 +148,14 @@ class Display extends EventDispatcher {
|
|||||||
return this._mode;
|
return this._mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get ownerFrameId() {
|
||||||
|
return this._ownerFrameId;
|
||||||
|
}
|
||||||
|
|
||||||
|
set ownerFrameId(value) {
|
||||||
|
this._ownerFrameId = value;
|
||||||
|
}
|
||||||
|
|
||||||
async prepare() {
|
async prepare() {
|
||||||
this._updateMode();
|
this._updateMode();
|
||||||
this._setInteractive(true);
|
this._setInteractive(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user