mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-03 08:04:29 -06:00
Added typings for image upload
This commit is contained in:
parent
917ea336c4
commit
11963829fc
@ -59,3 +59,28 @@ const editor2 = new EasyMDE({
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor2.clearAutosavedValue();
|
editor2.clearAutosavedValue();
|
||||||
|
|
||||||
|
const editorImages = new EasyMDE({
|
||||||
|
uploadImage: true,
|
||||||
|
imageAccept: 'image/png, image/bmp',
|
||||||
|
imageCSRFToken: undefined,
|
||||||
|
imageMaxSize: 10485760,
|
||||||
|
imageUploadEndpoint: 'https://my.domain/image-upload/',
|
||||||
|
imageTexts: {
|
||||||
|
sbInit: 'Drag & drop images!',
|
||||||
|
sbOnDragEnter: 'Let it go, let it go',
|
||||||
|
sbOnDrop: 'Uploading...',
|
||||||
|
sbProgress: 'Uploading... (#progress#)',
|
||||||
|
sbOnUploaded: 'Upload complete!',
|
||||||
|
sizeUnits: 'b,Kb,Mb'
|
||||||
|
},
|
||||||
|
errorMessages: {
|
||||||
|
noFileGiven: 'Please select a file',
|
||||||
|
imageTypeNotAllowed: 'This file type is not allowed!',
|
||||||
|
imageTooLarge: 'Image too big',
|
||||||
|
imageImportError: 'Something went oops!',
|
||||||
|
},
|
||||||
|
errorCallback: (errorMessage) => {
|
||||||
|
console.error(errorMessage);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
25
types/easymde.d.ts
vendored
25
types/easymde.d.ts
vendored
@ -86,6 +86,22 @@ declare namespace EasyMDE {
|
|||||||
noMobile?: boolean;
|
noMobile?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ImageTextsOptions {
|
||||||
|
sbInit?: string;
|
||||||
|
sbOnDragEnter?: string;
|
||||||
|
sbOnDrop?: string;
|
||||||
|
sbProgress?: string;
|
||||||
|
sbOnUploaded?: string;
|
||||||
|
sizeUnits?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ImageErrorTextsOptions {
|
||||||
|
noFileGiven?: string;
|
||||||
|
imageTypeNotAllowed?: string;
|
||||||
|
imageTooLarge?: string;
|
||||||
|
imageImportError?: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
autoDownloadFontAwesome?: boolean;
|
autoDownloadFontAwesome?: boolean;
|
||||||
autofocus?: boolean;
|
autofocus?: boolean;
|
||||||
@ -114,6 +130,15 @@ declare namespace EasyMDE {
|
|||||||
toolbarTips?: boolean;
|
toolbarTips?: boolean;
|
||||||
onToggleFullScreen?: (goingIntoFullScreen: boolean) => void;
|
onToggleFullScreen?: (goingIntoFullScreen: boolean) => void;
|
||||||
theme?: string;
|
theme?: string;
|
||||||
|
|
||||||
|
uploadImage?: boolean;
|
||||||
|
imageMaxSize?: number;
|
||||||
|
imageAccept?: string;
|
||||||
|
imageUploadEndpoint?: string;
|
||||||
|
imageCSRFToken?: string;
|
||||||
|
imageTexts?: ImageTextsOptions;
|
||||||
|
errorMessages?: ImageErrorTextsOptions;
|
||||||
|
errorCallback?: (errorMessage: string) => void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user