feat: add 3 new plugin hooks : onBeforeBlobUpload, onBeforeDraftAutoSave, onBeforeEditDraft (#586)

Co-authored-by: Linus Rath <minipixxelinfo@gmail.com>
This commit is contained in:
Paulhenry Saux
2026-07-09 14:55:34 +02:00
committed by GitHub
co-authored by Linus Rath
parent 782974ecdb
commit 752e71198c
9 changed files with 129 additions and 17 deletions
+10
View File
@@ -189,6 +189,16 @@ function buildPluginApi(manifest: PluginManifest) {
opts?: { delayedUntil?: string; envelopeRecipients?: string[] },
) => callApi('jmap.sendRaw', [rawBytes, identityId, opts]),
},
/**
* Used to alterate files before they are uploaded to server.
* Edited files are saved on indexedDB and remove once the upload to server begins.
*/
upfiles: {
save: (formerFileId:string, file:File) =>
callApi('upfiles.save', [formerFileId, file]) as Promise<string>,
get: (fileId:string) =>
callApi('upfiles.get', [fileId]) as Promise<File>,
},
toast: {
success: (m: string) => { void callApi('toast.success', [m]); },
error: (m: string) => { void callApi('toast.error', [m]); },