Make popups store options
This commit is contained in:
parent
3e249e19ac
commit
194615ef21
@ -287,6 +287,7 @@ class Frontend {
|
||||
async updateOptions() {
|
||||
this.options = await apiOptionsGet(this.getOptionsContext());
|
||||
this.setEnabled(this.options.general.enable);
|
||||
await this.popup.setOptions(this.options);
|
||||
}
|
||||
|
||||
popupTimerSet(callback) {
|
||||
|
@ -38,6 +38,7 @@ class PopupProxyHost {
|
||||
|
||||
this.apiReceiver = new FrontendApiReceiver(`popup-proxy-host#${frameId}`, {
|
||||
createNestedPopup: ({parentId}) => this.createNestedPopup(parentId),
|
||||
setOptions: ({id, options}) => this.setOptions(id, options),
|
||||
show: ({id, elementRect, options}) => this.show(id, elementRect, options),
|
||||
showOrphaned: ({id, elementRect, options}) => this.show(id, elementRect, options),
|
||||
hide: ({id, changeFocus}) => this.hide(id, changeFocus),
|
||||
@ -86,6 +87,11 @@ class PopupProxyHost {
|
||||
return new DOMRect(x, y, jsonRect.width, jsonRect.height);
|
||||
}
|
||||
|
||||
async setOptions(id, options) {
|
||||
const popup = this.getPopup(id);
|
||||
return await popup.setOptions(options);
|
||||
}
|
||||
|
||||
async show(id, elementRect, options) {
|
||||
const popup = this.getPopup(id);
|
||||
elementRect = this.jsonRectToDOMRect(popup, elementRect);
|
||||
|
@ -46,6 +46,11 @@ class PopupProxy {
|
||||
return id;
|
||||
}
|
||||
|
||||
async setOptions(options) {
|
||||
const id = await this.getPopupId();
|
||||
return await this.invokeHostApi('setOptions', {id, options});
|
||||
}
|
||||
|
||||
async show(elementRect, options) {
|
||||
const id = await this.getPopupId();
|
||||
elementRect = PopupProxy.DOMRectToJson(elementRect);
|
||||
|
@ -37,6 +37,7 @@ class Popup {
|
||||
this.isInjected = false;
|
||||
this.visible = false;
|
||||
this.visibleOverride = null;
|
||||
this.options = null;
|
||||
this.updateVisibility();
|
||||
}
|
||||
|
||||
@ -78,6 +79,10 @@ class Popup {
|
||||
});
|
||||
}
|
||||
|
||||
async setOptions(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
async show(elementRect, writingMode, options) {
|
||||
await this.inject(options);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user