You've already forked joplin
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:
@ -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 {
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user