fix: restore dropzone imports from upstream v1.26.1

The merge conflict resolution incorrectly kept @deltablot/dropzone
imports instead of upstream's dropzone package, causing vite build
failure on unresolved import.

Authored-by: Moko Consulting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-05-15 20:08:59 -05:00
parent 869586c582
commit ddbd592c2f
2 changed files with 8 additions and 9 deletions
+2 -2
View File
@@ -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);
});
}
+6 -7
View File
@@ -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);
}
});