mirror of
https://github.com/docmost/docmost.git
synced 2026-05-15 21:24:09 +08:00
bea1637519
* fix: image fallback regression * fix image preview on upload * fix image loading
23 lines
514 B
TypeScript
23 lines
514 B
TypeScript
import { Editor } from "@tiptap/core";
|
|
|
|
export function normalizeFileUrl(src: string): string {
|
|
if (src && src.startsWith("/files/")) {
|
|
return "/api" + src;
|
|
}
|
|
return src || "";
|
|
}
|
|
|
|
export type UploadFn = (
|
|
file: File,
|
|
editor: Editor,
|
|
pos: number,
|
|
pageId: string,
|
|
// only applicable to file attachments
|
|
allowMedia?: boolean,
|
|
) => void;
|
|
|
|
export interface MediaUploadOptions {
|
|
validateFn?: (file: File, allowMedia?: boolean) => void;
|
|
onUpload: (file: File, pageId: string) => Promise<any>;
|
|
}
|