1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Desktop: Multiple window support (#11181)

Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
Henry Heino
2024-11-08 07:32:05 -08:00
committed by GitHub
parent cbef725cc8
commit 4a88d6ff7a
163 changed files with 3303 additions and 1475 deletions

View File

@ -57,7 +57,7 @@ export default class Joplin {
this.settings_ = new JoplinSettings(plugin);
this.contentScripts_ = new JoplinContentScripts(plugin);
this.clipboard_ = new JoplinClipboard(implementation.clipboard, implementation.nativeImage);
this.window_ = new JoplinWindow(implementation.window, plugin, store);
this.window_ = new JoplinWindow(plugin, store);
}
public get data(): JoplinData {

View File

@ -110,7 +110,9 @@ export default class JoplinViewsDialogs {
}
/**
* Opens the dialog
* Opens the dialog.
*
* On desktop, this closes any copies of the dialog open in different windows.
*/
public async open(handle: ViewHandle): Promise<DialogResult> {
return this.controller(handle).open();

View File

@ -3,21 +3,13 @@
import shim from '../../../shim';
import Plugin from '../Plugin';
export interface Implementation {
injectCustomStyles(elementId: string, cssFilePath: string): Promise<void>;
}
export default class JoplinWindow {
private plugin_: Plugin;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
private store_: any;
private implementation_: Implementation;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
public constructor(implementation: Implementation, plugin: Plugin, store: any) {
this.implementation_ = implementation;
this.plugin_ = plugin;
public constructor(_plugin: Plugin, store: any) {
this.store_ = store;
}
@ -30,7 +22,10 @@ export default class JoplinWindow {
* <span class="platform-desktop">desktop</span>
*/
public async loadChromeCssFile(filePath: string) {
await this.implementation_.injectCustomStyles(`pluginStyles_${this.plugin_.id}`, filePath);
this.store_.dispatch({
type: 'CUSTOM_CHROME_CSS_ADD',
filePath,
});
}
/**
@ -45,7 +40,7 @@ export default class JoplinWindow {
const cssString = await shim.fsDriver().readFile(filePath, 'utf8');
this.store_.dispatch({
type: 'CUSTOM_CSS_APPEND',
type: 'CUSTOM_VIEWER_CSS_APPEND',
css: cssString,
});
}