diff --git a/web_src/js/features/comp/EditorUpload.ts b/web_src/js/features/comp/EditorUpload.ts index ad666d741f..6aff4242ba 100644 --- a/web_src/js/features/comp/EditorUpload.ts +++ b/web_src/js/features/comp/EditorUpload.ts @@ -8,7 +8,7 @@ import { import {subscribe} from '@github/paste-markdown'; import type CodeMirror from 'codemirror'; import type EasyMDE from 'easymde'; -import type Dropzone from '@deltablot/dropzone'; +import type {DropzoneFile} from 'dropzone'; let uploadIdCounter = 0; @@ -31,7 +31,7 @@ function uploadFile(dropzoneEl: HTMLElement, file: File) { }; dropzoneInst.on(DropzoneCustomEventUploadDone, onUploadDone); // FIXME: this is not entirely correct because `file` does not satisfy DropzoneFile (we have abused the Dropzone for long time) - dropzoneInst.addFile(file as Dropzone.DropzoneFile); + dropzoneInst.addFile(file as DropzoneFile); }); } diff --git a/web_src/js/features/dropzone.ts b/web_src/js/features/dropzone.ts index 84076dc93b..55c0e3c7a5 100644 --- a/web_src/js/features/dropzone.ts +++ b/web_src/js/features/dropzone.ts @@ -5,23 +5,22 @@ import {showTemporaryTooltip} from '../modules/tippy.ts'; import {GET, POST} from '../modules/fetch.ts'; import {showErrorToast} from '../modules/toast.ts'; import {createElementFromHTML, createElementFromAttrs} from '../utils/dom.ts'; -import {errorMessage} from '../modules/errors.ts'; import {isImageFile, isVideoFile} from '../utils.ts'; -import type Dropzone from '@deltablot/dropzone'; +import type {DropzoneFile, DropzoneOptions} from 'dropzone/index.js'; const {i18n} = window.config; -type CustomDropzoneFile = Dropzone.DropzoneFile & {uuid: string}; +type CustomDropzoneFile = DropzoneFile & {uuid: string}; // dropzone has its owner event dispatcher (emitter) export const DropzoneCustomEventReloadFiles = 'dropzone-custom-reload-files'; export const DropzoneCustomEventRemovedFile = 'dropzone-custom-removed-file'; export const DropzoneCustomEventUploadDone = 'dropzone-custom-upload-done'; -async function createDropzone(el: HTMLElement, opts: Dropzone.DropzoneOptions) { +async function createDropzone(el: HTMLElement, opts: DropzoneOptions) { const [{default: Dropzone}] = await Promise.all([ - import('@deltablot/dropzone'), - import('@deltablot/dropzone/dist/dropzone.css'), + import('dropzone'), + import('dropzone/dist/dropzone.css'), ]); return new Dropzone(el, opts); } @@ -150,7 +149,7 @@ export async function initDropzone(dropzoneEl: HTMLElement) { } catch (error) { // TODO: if listing the existing attachments failed, it should stop from operating the content or attachments, // otherwise the attachments might be lost. - showErrorToast(`Failed to load attachments: ${errorMessage(error)}`); + showErrorToast(`Failed to load attachments: ${error}`); console.error(error); } });