diff --git a/examples/react/src/App.tsx b/examples/react/src/App.tsx index 4915048..ba95a24 100644 --- a/examples/react/src/App.tsx +++ b/examples/react/src/App.tsx @@ -287,7 +287,7 @@ function App() { }> Add Bolt11 - editor.chain().selectFile().run()}>Add Media + editor.chain().selectFiles().run()}>Add Media editor.chain().uploadFiles().run()}>Upload { }}> Sign diff --git a/src/extensions/FileUploadExtension.ts b/src/extensions/FileUploadExtension.ts index d28f346..c2f59f4 100644 --- a/src/extensions/FileUploadExtension.ts +++ b/src/extensions/FileUploadExtension.ts @@ -11,7 +11,7 @@ import type { VideoAttributes } from './VideoExtension' declare module '@tiptap/core' { interface Commands { fileUpload: { - selectFile: () => ReturnType + selectFiles: () => ReturnType uploadFiles: () => ReturnType } } @@ -50,14 +50,14 @@ export const FileUploadExtension = Extension.create({ async hash(file: File) { return bufferToHex(await crypto.subtle.digest('SHA-256', await file.arrayBuffer())) }, - onDrop() {}, - onComplete() {}, + onDrop() { }, + onComplete() { }, } }, addCommands() { return { - selectFile: () => (props) => { + selectFiles: () => (props) => { props.tr.setMeta('selectFiles', true) return true }, @@ -80,7 +80,7 @@ export const FileUploadExtension = Extension.create({ apply(tr) { setTimeout(() => { if (tr.getMeta('selectFiles')) { - uploader.selectFile() + uploader.selectFiles() tr.setMeta('selectFiles', null) } else if (tr.getMeta('uploadFiles')) { uploader.uploadFiles() @@ -104,7 +104,7 @@ class Uploader { constructor( public editor: Editor, private options: FileUploadOptions, - ) {} + ) { } get view() { return this.editor.view @@ -201,7 +201,7 @@ class Uploader { } } - selectFile() { + selectFiles() { const input = document.createElement('input') input.type = 'file' input.multiple = true