2022-07-03 15:32:29 +02:00
|
|
|
// PlatformImplementation provides access to platform specific dependencies,
|
|
|
|
// such as the clipboard, message dialog, etc. It allows having the same plugin
|
|
|
|
|
|
|
|
import { VersionInfo } from './api/types';
|
|
|
|
import { Implementation as WindowImplementation } from './api/JoplinWindow';
|
2023-09-17 12:40:50 +02:00
|
|
|
import { Implementation as ImagingImplementation } from './api/JoplinImaging';
|
2022-07-03 15:32:29 +02:00
|
|
|
|
|
|
|
export interface JoplinViewsDialogs {
|
|
|
|
showMessageBox(message: string): Promise<number>;
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2023-10-31 17:29:19 +02:00
|
|
|
showOpenDialog(options: any): Promise<any>;
|
2022-07-03 15:32:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface JoplinViews {
|
|
|
|
dialogs: JoplinViewsDialogs;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Joplin {
|
|
|
|
views: JoplinViews;
|
|
|
|
}
|
|
|
|
|
|
|
|
// API for all platforms, but with different implementations.
|
|
|
|
export default class BasePlatformImplementation {
|
|
|
|
|
|
|
|
public get versionInfo(): VersionInfo {
|
2024-03-09 13:03:57 +02:00
|
|
|
throw new Error('Not implemented: versionInfo');
|
2022-07-03 15:32:29 +02:00
|
|
|
}
|
|
|
|
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2022-07-03 15:32:29 +02:00
|
|
|
public get clipboard(): any {
|
2024-03-09 13:03:57 +02:00
|
|
|
throw new Error('Not implemented: clipboard');
|
2022-07-03 15:32:29 +02:00
|
|
|
}
|
|
|
|
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2022-07-03 15:32:29 +02:00
|
|
|
public get nativeImage(): any {
|
2024-03-09 13:03:57 +02:00
|
|
|
throw new Error('Not implemented: nativeImage');
|
2022-07-03 15:32:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public get window(): WindowImplementation {
|
2024-03-09 13:03:57 +02:00
|
|
|
throw new Error('Not implemented: window');
|
2022-07-03 15:32:29 +02:00
|
|
|
}
|
|
|
|
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2022-07-03 15:32:29 +02:00
|
|
|
public registerComponent(_name: string, _component: any) {
|
2024-03-09 13:03:57 +02:00
|
|
|
throw new Error('Not implemented: registerComponent');
|
2022-07-03 15:32:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public unregisterComponent(_name: string) {
|
2024-03-09 13:03:57 +02:00
|
|
|
throw new Error('Not implemented: unregisterComponent');
|
2022-07-03 15:32:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public get joplin(): Joplin {
|
2024-03-09 13:03:57 +02:00
|
|
|
throw new Error('Not implemented: joplin');
|
2022-07-03 15:32:29 +02:00
|
|
|
}
|
|
|
|
|
2023-09-17 12:40:50 +02:00
|
|
|
public get imaging(): ImagingImplementation {
|
2024-03-09 13:03:57 +02:00
|
|
|
throw new Error('Not implemented: imaging');
|
2023-09-17 12:40:50 +02:00
|
|
|
}
|
|
|
|
|
2022-07-03 15:32:29 +02:00
|
|
|
}
|