1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Chore: Apply changes from mobile plugins to lib/ and app-desktop/ (#10079)

This commit is contained in:
Henry Heino
2024-03-09 03:03:57 -08:00
committed by GitHub
parent 91004f5714
commit 25cd5affca
37 changed files with 418 additions and 205 deletions

View File

@@ -47,6 +47,9 @@ export default class WebviewController extends ViewController {
private messageListener_: Function = null;
private closeResponse_: CloseResponse = null;
// True if a **panel** is shown in a modal window.
private panelInModalMode_ = false;
public constructor(handle: ViewHandle, pluginId: string, store: any, baseDir: string, containerType: ContainerType) {
super(handle, pluginId, store);
this.baseDir_ = toSystemSlashes(baseDir, 'linux');
@@ -150,8 +153,26 @@ export default class WebviewController extends ViewController {
return this.show(false);
}
// This method allows us to determine whether a panel is shown in dialog mode,
// which is used on mobile.
public setIsShownInModal(shown: boolean) {
this.panelInModalMode_ = shown;
}
public get visible(): boolean {
const mainLayout = this.store.getState().mainLayout;
const appState = this.store.getState();
if (this.panelInModalMode_) {
return true;
}
const mainLayout = appState.mainLayout;
// Mobile: There is no appState.mainLayout
if (!mainLayout) {
return false;
}
const item = findItemByKey(mainLayout, this.handle);
return item ? item.visible : false;
}