Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@codemirror/search": "6.6.0",
"@codemirror/state": "6.6.0",
"@codemirror/view": "6.41.0",
"@deltablot/dropzone": "7.4.3",
"@github/markdown-toolbar-element": "2.2.3",
"@github/paste-markdown": "1.5.3",
"@github/text-expander-element": "2.9.4",
Expand All @@ -46,7 +47,6 @@
"compare-versions": "6.1.1",
"cropperjs": "1.6.2",
"dayjs": "1.11.20",
"dropzone": "6.0.0-beta.2",
"easymde": "2.20.0",
"esbuild": "0.27.4",
"htmx.org": "2.0.8",
Expand Down Expand Up @@ -82,7 +82,6 @@
"@stylistic/eslint-plugin": "5.10.0",
"@stylistic/stylelint-plugin": "5.1.0",
"@types/codemirror": "5.60.17",
"@types/dropzone": "5.7.9",
"@types/jquery": "4.0.0",
"@types/js-yaml": "4.0.9",
"@types/katex": "0.16.8",
Expand Down
47 changes: 16 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions web_src/js/features/comp/EditorUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import {subscribe} from '@github/paste-markdown';
import type CodeMirror from 'codemirror';
import type EasyMDE from 'easymde';
import type {DropzoneFile} from 'dropzone';
import type Dropzone from '@deltablot/dropzone';

let uploadIdCounter = 0;

Expand All @@ -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 DropzoneFile);
dropzoneInst.addFile(file as Dropzone.DropzoneFile);
});
}

Expand Down
10 changes: 5 additions & 5 deletions web_src/js/features/dropzone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import {GET, POST} from '../modules/fetch.ts';
import {showErrorToast} from '../modules/toast.ts';
import {createElementFromHTML, createElementFromAttrs} from '../utils/dom.ts';
import {isImageFile, isVideoFile} from '../utils.ts';
import type {DropzoneFile, DropzoneOptions} from 'dropzone/index.js';
import type Dropzone from '@deltablot/dropzone';

const {i18n} = window.config;

type CustomDropzoneFile = DropzoneFile & {uuid: string};
type CustomDropzoneFile = Dropzone.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: DropzoneOptions) {
async function createDropzone(el: HTMLElement, opts: Dropzone.DropzoneOptions) {
const [{default: Dropzone}] = await Promise.all([
import('dropzone'),
import('dropzone/dist/dropzone.css'),
import('@deltablot/dropzone'),
import('@deltablot/dropzone/dist/dropzone.css'),
]);
return new Dropzone(el, opts);
}
Expand Down