From bac0d681564fca005edfe844f13a088d7e404e5e Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 10 Aug 2021 11:34:49 +0100 Subject: [PATCH] Plugins: Updated types --- .../codemirror_content_script/api/Joplin.d.ts | 6 +++++ .../api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../api/JoplinViewsDialogs.d.ts | 9 ++++++- .../api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../codemirror_content_script/api/types.ts | 20 ++++++++++++++-- .../plugins/content_script/api/Joplin.d.ts | 6 +++++ .../content_script/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../api/JoplinViewsDialogs.d.ts | 9 ++++++- .../content_script/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../plugins/content_script/api/types.ts | 20 ++++++++++++++-- .../support/plugins/dialog/api/Joplin.d.ts | 6 +++++ .../plugins/dialog/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../dialog/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../plugins/dialog/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../tests/support/plugins/dialog/api/types.ts | 20 ++++++++++++++-- .../editor_context_menu/api/Joplin.d.ts | 6 +++++ .../api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../api/JoplinViewsDialogs.d.ts | 9 ++++++- .../editor_context_menu/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../plugins/editor_context_menu/api/types.ts | 20 ++++++++++++++-- .../support/plugins/events/api/Joplin.d.ts | 6 +++++ .../plugins/events/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../events/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../plugins/events/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../tests/support/plugins/events/api/types.ts | 20 ++++++++++++++-- .../plugins/external_assets/api/Joplin.d.ts | 6 +++++ .../external_assets/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../api/JoplinViewsDialogs.d.ts | 9 ++++++- .../external_assets/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../plugins/external_assets/api/types.ts | 20 ++++++++++++++-- .../support/plugins/jpl_test/api/Joplin.d.ts | 6 +++++ .../plugins/jpl_test/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../jpl_test/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../plugins/jpl_test/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../support/plugins/jpl_test/api/types.ts | 20 ++++++++++++++-- .../plugins/json_export/api/Joplin.d.ts | 6 +++++ .../json_export/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../json_export/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../plugins/json_export/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../support/plugins/json_export/api/types.ts | 20 ++++++++++++++-- .../support/plugins/menu/api/Joplin.d.ts | 6 +++++ .../plugins/menu/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../plugins/menu/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../plugins/menu/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../tests/support/plugins/menu/api/types.ts | 20 ++++++++++++++-- .../plugins/multi_selection/api/Joplin.d.ts | 6 +++++ .../multi_selection/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../api/JoplinViewsDialogs.d.ts | 9 ++++++- .../multi_selection/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../plugins/multi_selection/api/types.ts | 20 ++++++++++++++-- .../plugins/nativeModule/api/Joplin.d.ts | 6 +++++ .../nativeModule/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../nativeModule/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../nativeModule/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../support/plugins/nativeModule/api/types.ts | 20 ++++++++++++++-- .../plugins/post_messages/api/Joplin.d.ts | 6 +++++ .../post_messages/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../post_messages/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../post_messages/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../plugins/post_messages/api/types.ts | 20 ++++++++++++++-- .../plugins/register_command/api/Joplin.d.ts | 6 +++++ .../register_command/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../api/JoplinViewsDialogs.d.ts | 9 ++++++- .../register_command/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../plugins/register_command/api/types.ts | 20 ++++++++++++++-- .../plugins/selected_text/api/Joplin.d.ts | 6 +++++ .../selected_text/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../selected_text/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../selected_text/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../plugins/selected_text/api/types.ts | 20 ++++++++++++++-- .../support/plugins/settings/api/Joplin.d.ts | 6 +++++ .../plugins/settings/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../settings/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../plugins/settings/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../support/plugins/settings/api/types.ts | 20 ++++++++++++++-- .../tests/support/plugins/toc/api/Joplin.d.ts | 6 +++++ .../plugins/toc/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../plugins/toc/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../support/plugins/toc/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../tests/support/plugins/toc/api/types.ts | 20 ++++++++++++++-- .../withExternalModules/api/Joplin.d.ts | 6 +++++ .../api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../api/JoplinViewsDialogs.d.ts | 9 ++++++- .../withExternalModules/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../plugins/withExternalModules/api/types.ts | 20 ++++++++++++++-- .../generators/app/templates/api/Joplin.d.ts | 6 +++++ .../app/templates/api/JoplinClipboard.d.ts | 23 ++++++++++++++++++ .../app/templates/api/JoplinViewsDialogs.d.ts | 9 ++++++- .../app/templates/api/JoplinWindow.d.ts | 24 +++++++++++++++++++ .../generators/app/templates/api/types.ts | 20 ++++++++++++++-- packages/generator-joplin/package-lock.json | 2 +- 91 files changed, 1423 insertions(+), 55 deletions(-) create mode 100644 packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/content_script/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/content_script/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/dialog/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/dialog/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/events/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/events/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/external_assets/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/external_assets/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/jpl_test/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/jpl_test/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/json_export/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/json_export/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/menu/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/menu/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/multi_selection/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/multi_selection/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/nativeModule/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/nativeModule/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/post_messages/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/post_messages/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/register_command/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/register_command/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/selected_text/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/selected_text/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/settings/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/settings/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/toc/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/toc/api/JoplinWindow.d.ts create mode 100644 packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinClipboard.d.ts create mode 100644 packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinWindow.d.ts create mode 100644 packages/generator-joplin/generators/app/templates/api/JoplinClipboard.d.ts create mode 100644 packages/generator-joplin/generators/app/templates/api/JoplinWindow.d.ts diff --git a/packages/app-cli/tests/support/plugins/codemirror_content_script/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/codemirror_content_script/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/codemirror_content_script/api/types.ts b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/codemirror_content_script/api/types.ts +++ b/packages/app-cli/tests/support/plugins/codemirror_content_script/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/content_script/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/content_script/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/content_script/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/content_script/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/content_script/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/content_script/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/content_script/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/content_script/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/content_script/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/content_script/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/content_script/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/content_script/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/content_script/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/content_script/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/content_script/api/types.ts b/packages/app-cli/tests/support/plugins/content_script/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/content_script/api/types.ts +++ b/packages/app-cli/tests/support/plugins/content_script/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/dialog/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/dialog/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/dialog/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/dialog/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/dialog/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/dialog/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/dialog/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/dialog/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/dialog/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/dialog/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/dialog/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/dialog/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/dialog/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/dialog/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/dialog/api/types.ts b/packages/app-cli/tests/support/plugins/dialog/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/dialog/api/types.ts +++ b/packages/app-cli/tests/support/plugins/dialog/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/editor_context_menu/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/editor_context_menu/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/editor_context_menu/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/editor_context_menu/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/editor_context_menu/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/editor_context_menu/api/types.ts b/packages/app-cli/tests/support/plugins/editor_context_menu/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/editor_context_menu/api/types.ts +++ b/packages/app-cli/tests/support/plugins/editor_context_menu/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/events/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/events/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/events/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/events/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/events/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/events/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/events/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/events/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/events/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/events/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/events/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/events/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/events/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/events/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/events/api/types.ts b/packages/app-cli/tests/support/plugins/events/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/events/api/types.ts +++ b/packages/app-cli/tests/support/plugins/events/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/external_assets/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/external_assets/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/external_assets/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/external_assets/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/external_assets/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/external_assets/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/external_assets/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/external_assets/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/external_assets/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/external_assets/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/external_assets/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/external_assets/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/external_assets/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/external_assets/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/external_assets/api/types.ts b/packages/app-cli/tests/support/plugins/external_assets/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/external_assets/api/types.ts +++ b/packages/app-cli/tests/support/plugins/external_assets/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/jpl_test/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/jpl_test/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/jpl_test/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/jpl_test/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/jpl_test/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/jpl_test/api/types.ts b/packages/app-cli/tests/support/plugins/jpl_test/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/jpl_test/api/types.ts +++ b/packages/app-cli/tests/support/plugins/jpl_test/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/json_export/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/json_export/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/json_export/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/json_export/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/json_export/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/json_export/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/json_export/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/json_export/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/json_export/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/json_export/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/json_export/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/json_export/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/json_export/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/json_export/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/json_export/api/types.ts b/packages/app-cli/tests/support/plugins/json_export/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/json_export/api/types.ts +++ b/packages/app-cli/tests/support/plugins/json_export/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/menu/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/menu/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/menu/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/menu/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/menu/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/menu/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/menu/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/menu/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/menu/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/menu/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/menu/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/menu/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/menu/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/menu/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/menu/api/types.ts b/packages/app-cli/tests/support/plugins/menu/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/menu/api/types.ts +++ b/packages/app-cli/tests/support/plugins/menu/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/multi_selection/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/multi_selection/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/multi_selection/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/multi_selection/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/multi_selection/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/multi_selection/api/types.ts b/packages/app-cli/tests/support/plugins/multi_selection/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/multi_selection/api/types.ts +++ b/packages/app-cli/tests/support/plugins/multi_selection/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/nativeModule/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/nativeModule/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/nativeModule/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/nativeModule/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/nativeModule/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/nativeModule/api/types.ts b/packages/app-cli/tests/support/plugins/nativeModule/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/nativeModule/api/types.ts +++ b/packages/app-cli/tests/support/plugins/nativeModule/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/post_messages/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/post_messages/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/post_messages/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/post_messages/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/post_messages/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/post_messages/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/post_messages/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/post_messages/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/post_messages/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/post_messages/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/post_messages/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/post_messages/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/post_messages/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/post_messages/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/post_messages/api/types.ts b/packages/app-cli/tests/support/plugins/post_messages/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/post_messages/api/types.ts +++ b/packages/app-cli/tests/support/plugins/post_messages/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/register_command/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/register_command/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/register_command/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/register_command/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/register_command/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/register_command/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/register_command/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/register_command/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/register_command/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/register_command/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/register_command/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/register_command/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/register_command/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/register_command/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/register_command/api/types.ts b/packages/app-cli/tests/support/plugins/register_command/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/register_command/api/types.ts +++ b/packages/app-cli/tests/support/plugins/register_command/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/selected_text/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/selected_text/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/selected_text/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/selected_text/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/selected_text/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/selected_text/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/selected_text/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/selected_text/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/selected_text/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/selected_text/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/selected_text/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/selected_text/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/selected_text/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/selected_text/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/selected_text/api/types.ts b/packages/app-cli/tests/support/plugins/selected_text/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/selected_text/api/types.ts +++ b/packages/app-cli/tests/support/plugins/selected_text/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/settings/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/settings/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/settings/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/settings/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/settings/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/settings/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/settings/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/settings/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/settings/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/settings/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/settings/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/settings/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/settings/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/settings/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/settings/api/types.ts b/packages/app-cli/tests/support/plugins/settings/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/settings/api/types.ts +++ b/packages/app-cli/tests/support/plugins/settings/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/toc/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/toc/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/toc/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/toc/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/toc/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/toc/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/toc/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/toc/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/toc/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/toc/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/toc/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/toc/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/toc/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/toc/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/toc/api/types.ts b/packages/app-cli/tests/support/plugins/toc/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/toc/api/types.ts +++ b/packages/app-cli/tests/support/plugins/toc/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/app-cli/tests/support/plugins/withExternalModules/api/Joplin.d.ts b/packages/app-cli/tests/support/plugins/withExternalModules/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/app-cli/tests/support/plugins/withExternalModules/api/Joplin.d.ts +++ b/packages/app-cli/tests/support/plugins/withExternalModules/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinClipboard.d.ts b/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinViewsDialogs.d.ts b/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinViewsDialogs.d.ts +++ b/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinWindow.d.ts b/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/app-cli/tests/support/plugins/withExternalModules/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/app-cli/tests/support/plugins/withExternalModules/api/types.ts b/packages/app-cli/tests/support/plugins/withExternalModules/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/app-cli/tests/support/plugins/withExternalModules/api/types.ts +++ b/packages/app-cli/tests/support/plugins/withExternalModules/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/generator-joplin/generators/app/templates/api/Joplin.d.ts b/packages/generator-joplin/generators/app/templates/api/Joplin.d.ts index e30586e68..09d856e37 100644 --- a/packages/generator-joplin/generators/app/templates/api/Joplin.d.ts +++ b/packages/generator-joplin/generators/app/templates/api/Joplin.d.ts @@ -8,6 +8,8 @@ import JoplinViews from './JoplinViews'; import JoplinInterop from './JoplinInterop'; import JoplinSettings from './JoplinSettings'; import JoplinContentScripts from './JoplinContentScripts'; +import JoplinClipboard from './JoplinClipboard'; +import JoplinWindow from './JoplinWindow'; /** * This is the main entry point to the Joplin API. You can access various services using the provided accessors. * @@ -33,8 +35,12 @@ export default class Joplin { private interop_; private settings_; private contentScripts_; + private clipboard_; + private window_; constructor(implementation: any, plugin: Plugin, store: any); get data(): JoplinData; + get clipboard(): JoplinClipboard; + get window(): JoplinWindow; get plugins(): JoplinPlugins; get workspace(): JoplinWorkspace; get contentScripts(): JoplinContentScripts; diff --git a/packages/generator-joplin/generators/app/templates/api/JoplinClipboard.d.ts b/packages/generator-joplin/generators/app/templates/api/JoplinClipboard.d.ts new file mode 100644 index 000000000..3abc4e9df --- /dev/null +++ b/packages/generator-joplin/generators/app/templates/api/JoplinClipboard.d.ts @@ -0,0 +1,23 @@ +export default class JoplinClipboard { + private electronClipboard_; + private electronNativeImage_; + constructor(electronClipboard: any, electronNativeImage: any); + readText(): Promise; + writeText(text: string): Promise; + readHtml(): Promise; + writeHtml(html: string): Promise; + /** + * Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + readImage(): Promise; + /** + * Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format. + */ + writeImage(dataUrl: string): Promise; + /** + * Returns the list available formats (mime types). + * + * For example [ 'text/plain', 'text/html' ] + */ + availableFormats(): Promise; +} diff --git a/packages/generator-joplin/generators/app/templates/api/JoplinViewsDialogs.d.ts b/packages/generator-joplin/generators/app/templates/api/JoplinViewsDialogs.d.ts index 043d488ea..f1643a01d 100644 --- a/packages/generator-joplin/generators/app/templates/api/JoplinViewsDialogs.d.ts +++ b/packages/generator-joplin/generators/app/templates/api/JoplinViewsDialogs.d.ts @@ -2,7 +2,7 @@ import Plugin from '../Plugin'; import { ButtonSpec, ViewHandle, DialogResult } from './types'; /** * Allows creating and managing dialogs. A dialog is modal window that - * contains a webview and a row of buttons. You can update the update the + * contains a webview and a row of buttons. You can update the * webview using the `setHtml` method. Dialogs are hidden by default and * you need to call `open()` to open them. Once the user clicks on a * button, the `open` call will return an object indicating what button was @@ -59,4 +59,11 @@ export default class JoplinViewsDialogs { * Opens the dialog */ open(handle: ViewHandle): Promise; + /** + * Toggle on whether to fit the dialog size to the content or not. + * When set to false, the dialog stretches to fill the application + * window. + * @default true + */ + setFitToContent(handle: ViewHandle, status: boolean): Promise; } diff --git a/packages/generator-joplin/generators/app/templates/api/JoplinWindow.d.ts b/packages/generator-joplin/generators/app/templates/api/JoplinWindow.d.ts new file mode 100644 index 000000000..231c55c3d --- /dev/null +++ b/packages/generator-joplin/generators/app/templates/api/JoplinWindow.d.ts @@ -0,0 +1,24 @@ +import Plugin from '../Plugin'; +export interface Implementation { + injectCustomStyles(elementId: string, cssFilePath: string): Promise; +} +export default class JoplinWindow { + private plugin_; + private store_; + private implementation_; + constructor(implementation: Implementation, plugin: Plugin, store: any); + /** + * Loads a chrome CSS file. It will apply to the window UI elements, except + * for the note viewer. It is the same as the "Custom stylesheet for + * Joplin-wide app styles" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadChromeCssFile(filePath: string): Promise; + /** + * Loads a note CSS file. It will apply to the note viewer, as well as any + * exported or printed note. It is the same as the "Custom stylesheet for + * rendered Markdown" setting. See the [Load CSS Demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/load_css) + * for an example. + */ + loadNoteCssFile(filePath: string): Promise; +} diff --git a/packages/generator-joplin/generators/app/templates/api/types.ts b/packages/generator-joplin/generators/app/templates/api/types.ts index 9c4aa7332..e0b2d96c0 100644 --- a/packages/generator-joplin/generators/app/templates/api/types.ts +++ b/packages/generator-joplin/generators/app/templates/api/types.ts @@ -334,6 +334,17 @@ export enum SettingItemType { Button = 6, } +export enum AppType { + Desktop = 'desktop', + Mobile = 'mobile', + Cli = 'cli', +} + +export enum SettingStorage { + Database = 1, + File = 2, +} + // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { @@ -372,7 +383,7 @@ export interface SettingItem { /** * Reserved property. Not used at the moment. */ - appTypes?: string[]; + appTypes?: AppType[]; /** * Set this to `true` to store secure data, such as passwords. Any such @@ -393,6 +404,11 @@ export interface SettingItem { minimum?: number; maximum?: number; step?: number; + + /** + * Either store the setting in the database or in settings.json. Defaults to database. + */ + storage?: SettingStorage; } export interface SettingSection { @@ -419,7 +435,7 @@ export type Path = string[]; // Content Script types // ================================================================= -export type PostMessageHandler = (id: string, message: any)=> Promise; +export type PostMessageHandler = (message: any)=> Promise; /** * When a content script is initialised, it receives a `context` object. diff --git a/packages/generator-joplin/package-lock.json b/packages/generator-joplin/package-lock.json index a4d5bff63..ed3669556 100644 --- a/packages/generator-joplin/package-lock.json +++ b/packages/generator-joplin/package-lock.json @@ -1,6 +1,6 @@ { "name": "generator-joplin", - "version": "2.0.1", + "version": "2.2.0", "lockfileVersion": 1, "requires": true, "dependencies": {