Browse Source

Stricter typings for the onSuccess and onError calls

tags/2.8.0
Jeroen Akkerman 4 months ago
parent
commit
509763f3b2
2 changed files with 5 additions and 3 deletions
  1. 4
    2
      types/easymde-test.ts
  2. 1
    1
      types/easymde.d.ts

+ 4
- 2
types/easymde-test.ts View File

@@ -92,8 +92,10 @@ const editorImagesCustom = new EasyMDE({
imageAccept: 'image/png, image/bmp',
imageCSRFToken: undefined,
imageMaxSize: 10485760,
imageUploadFunction: (file: File, onSuccess: Function, onError: Function) => {
console.log(file)
imageUploadFunction: (file: File, onSuccess, onError) => {
console.log(file);
onSuccess('http://image.url/9.png');
onError('Failed because reasons.');
},
imageTexts: {
sbInit: 'Drag & drop images!',

+ 1
- 1
types/easymde.d.ts View File

@@ -134,7 +134,7 @@ declare namespace EasyMDE {
uploadImage?: boolean;
imageMaxSize?: number;
imageAccept?: string;
imageUploadFunction?: (file: File, onSuccess: Function, onError: Function) => void;
imageUploadFunction?: (file: File, onSuccess: (url: string) => void, onError: (error: string) => void) => void;
imageUploadEndpoint?: string;
imageCSRFToken?: string;
imageTexts?: ImageTextsOptions;

Loading…
Cancel
Save