diff --git a/packages/generator-joplin/generators/app/templates/api/JoplinClipboard.d.ts b/packages/generator-joplin/generators/app/templates/api/JoplinClipboard.d.ts index 26fdf42c28..6d2baa852b 100644 --- a/packages/generator-joplin/generators/app/templates/api/JoplinClipboard.d.ts +++ b/packages/generator-joplin/generators/app/templates/api/JoplinClipboard.d.ts @@ -1,3 +1,4 @@ +import { ClipboardContent } from './types'; export default class JoplinClipboard { private electronClipboard_; private electronNativeImage_; @@ -26,4 +27,19 @@ export default class JoplinClipboard { * For example [ 'text/plain', 'text/html' ] */ availableFormats(): Promise; + /** + * Writes multiple formats to the clipboard simultaneously. + * This allows setting both text/plain and text/html at the same time. + * + * desktop + * + * @example + * ```typescript + * await joplin.clipboard.write({ + * text: 'Plain text version', + * html: 'HTML version' + * }); + * ``` + */ + write(content: ClipboardContent): Promise; } diff --git a/packages/generator-joplin/generators/app/templates/api/types.ts b/packages/generator-joplin/generators/app/templates/api/types.ts index b9fab8ff7d..3911a38f43 100644 --- a/packages/generator-joplin/generators/app/templates/api/types.ts +++ b/packages/generator-joplin/generators/app/templates/api/types.ts @@ -588,6 +588,30 @@ export interface SettingSection { */ export type Path = string[]; +// ================================================================= +// Clipboard API types +// ================================================================= + +/** + * Represents content that can be written to the clipboard in multiple formats. + */ +export interface ClipboardContent { + /** + * Plain text representation of the content + */ + text?: string; + + /** + * HTML representation of the content + */ + html?: string; + + /** + * Image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format + */ + image?: string; +} + // ================================================================= // Content Script types // ================================================================= diff --git a/packages/generator-joplin/package.json b/packages/generator-joplin/package.json index 2a2bdfcd06..9d5742f5a5 100644 --- a/packages/generator-joplin/package.json +++ b/packages/generator-joplin/package.json @@ -1,6 +1,6 @@ { "name": "generator-joplin", - "version": "3.5.0", + "version": "3.5.1", "description": "Scaffolds out a new Joplin plugin", "homepage": "https://github.com/laurent22/joplin/tree/dev/packages/generator-joplin", "author": { @@ -38,4 +38,4 @@ "repository": "https://github.com/laurent22/generator-joplin", "license": "AGPL-3.0-or-later", "private": true -} +} \ No newline at end of file