mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-06-29 22:21:04 -06:00
Shorten the code
This commit is contained in:
parent
acf32aeffc
commit
cea2234b58
32
types/easymde.d.ts
vendored
32
types/easymde.d.ts
vendored
@ -27,6 +27,8 @@ interface ArrayOneOrMore<T> extends Array<T> {
|
|||||||
0: T;
|
0: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SetRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
||||||
|
|
||||||
type ToolbarButton =
|
type ToolbarButton =
|
||||||
'bold'
|
'bold'
|
||||||
| 'italic'
|
| 'italic'
|
||||||
@ -53,30 +55,28 @@ type ToolbarButton =
|
|||||||
| 'fullscreen'
|
| 'fullscreen'
|
||||||
| 'guide';
|
| 'guide';
|
||||||
|
|
||||||
interface InstanceOptions extends EasyMDE {
|
interface InstanceOptions extends SetRequired<EasyMDE.Options, 'minHeight' |
|
||||||
|
'parsingConfig' |
|
||||||
|
'previewClass' |
|
||||||
|
'previewRender' |
|
||||||
|
'status' |
|
||||||
|
'toolbar' |
|
||||||
|
'uploadImage' |
|
||||||
|
'imageMaxSize' |
|
||||||
|
'imageAccept' |
|
||||||
|
'imagePathAbsolute' |
|
||||||
|
'imageCSRFName' |
|
||||||
|
'imageCSRFHeader' |
|
||||||
|
'errorCallback' |
|
||||||
|
'direction'> {
|
||||||
blockStyles: Required<EasyMDE.BlockStyleOptions>;
|
blockStyles: Required<EasyMDE.BlockStyleOptions>;
|
||||||
insertTexts: Required<EasyMDE.InsertTextOptions>;
|
insertTexts: Required<EasyMDE.InsertTextOptions>;
|
||||||
minHeight: string;
|
|
||||||
parsingConfig: EasyMDE.ParsingOptions;
|
|
||||||
previewClass: string | ReadonlyArray<string>;
|
|
||||||
previewRender: (markdownPlaintext: string, previewElement: HTMLElement) => string | null;
|
|
||||||
shortcuts: Required<EasyMDE.Shortcuts>;
|
shortcuts: Required<EasyMDE.Shortcuts>;
|
||||||
status: boolean | ReadonlyArray<string | EasyMDE.StatusBarItem>;
|
|
||||||
toolbar: boolean | ReadonlyArray<'|' | ToolbarButton | EasyMDE.ToolbarIcon | EasyMDE.ToolbarDropdownIcon>;
|
|
||||||
|
|
||||||
uploadImage: boolean;
|
|
||||||
imageMaxSize: number;
|
|
||||||
imageAccept: string;
|
|
||||||
imagePathAbsolute: boolean;
|
|
||||||
imageCSRFName: string;
|
|
||||||
imageCSRFHeader: boolean;
|
|
||||||
imageTexts: Required<EasyMDE.ImageTextsOptions>;
|
imageTexts: Required<EasyMDE.ImageTextsOptions>;
|
||||||
errorMessages: Required<EasyMDE.ImageErrorTextsOptions>;
|
errorMessages: Required<EasyMDE.ImageErrorTextsOptions>;
|
||||||
errorCallback: (errorMessage: string) => void;
|
|
||||||
|
|
||||||
promptTexts: Required<EasyMDE.PromptTexts>;
|
promptTexts: Required<EasyMDE.PromptTexts>;
|
||||||
|
|
||||||
direction: 'ltr' | 'rtl';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare namespace EasyMDE {
|
declare namespace EasyMDE {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user