feat: add vditor locally

This commit is contained in:
merlin
2025-11-12 14:39:23 +08:00
parent 16e8fd2d65
commit 4e21c62e26
532 changed files with 43947 additions and 38 deletions

45
public/vditor/ts/constants.d.ts vendored Normal file
View File

@@ -0,0 +1,45 @@
/// <reference types="./types" />
declare const _VDITOR_VERSION: string;
export { _VDITOR_VERSION as VDITOR_VERSION };
export declare abstract class Constants {
static readonly ZWSP: string;
static readonly DROP_EDITOR: string;
static readonly MOBILE_WIDTH: number;
static readonly CLASS_MENU_DISABLED: string;
static readonly EDIT_TOOLBARS: string[];
static readonly CODE_THEME: string[];
static readonly ALIAS_CODE_LANGUAGES: string[];
static readonly CDN: string;
static readonly MARKDOWN_OPTIONS: {
autoSpace: boolean;
gfmAutoLink: boolean;
codeBlockPreview: boolean;
fixTermTypo: boolean;
footnotes: boolean;
linkBase: string;
linkPrefix: string;
listStyle: boolean;
mark: boolean;
mathBlockPreview: boolean;
paragraphBeginningSpace: boolean;
sanitize: boolean;
toc: boolean;
};
static readonly HLJS_OPTIONS: {
enable: boolean;
lineNumber: boolean;
defaultLang: string;
style: string;
};
static readonly MATH_OPTIONS: IMath;
static readonly THEME_OPTIONS: {
current: string;
list: {
"ant-design": string;
dark: string;
light: string;
wechat: string;
};
path: string;
};
}

7
public/vditor/ts/devtools/index.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
/// <reference types="./types" />
export declare class DevTools {
element: HTMLDivElement;
private ASTChart;
constructor();
renderEchart(vditor: IVditor): void;
}

4
public/vditor/ts/export/index.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
export declare const download: (vditor: IVditor, content: string, filename: string) => void;
export declare const exportMarkdown: (vditor: IVditor) => void;
export declare const exportPDF: (vditor: IVditor) => void;
export declare const exportHTML: (vditor: IVditor) => void;

14
public/vditor/ts/hint/index.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
/// <reference types="./types" />
export declare class Hint {
timeId: number;
element: HTMLDivElement;
recentLanguage: string;
private splitChar;
private lastIndex;
constructor(hintExtends: IHintExtend[]);
render(vditor: IVditor): void;
genHTML(data: IHintData[], key: string, vditor: IVditor): void;
fillEmoji: (element: HTMLElement, vditor: IVditor) => void;
select(event: KeyboardEvent, vditor: IVditor): boolean;
private getKey;
}

1
public/vditor/ts/ir/expandMarker.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const expandMarker: (range: Range, vditor: IVditor) => void;

View File

@@ -0,0 +1 @@
export declare const highlightToolbarIR: (vditor: IVditor) => void;

13
public/vditor/ts/ir/index.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
/// <reference types="./types" />
declare class IR {
range: Range;
element: HTMLPreElement;
processTimeoutId: number;
hlToolbarTimeoutId: number;
composingLock: boolean;
preventInput: boolean;
constructor(vditor: IVditor);
private copy;
private bindEvent;
}
export { IR };

1
public/vditor/ts/ir/input.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const input: (vditor: IVditor, range: Range, ignoreSpace?: boolean, event?: InputEvent) => void;

8
public/vditor/ts/ir/process.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
export declare const processHint: (vditor: IVditor) => void;
export declare const processAfterRender: (vditor: IVditor, options?: {
enableAddUndoStack: boolean;
enableHint: boolean;
enableInput: boolean;
}) => void;
export declare const processHeading: (vditor: IVditor, value: string) => void;
export declare const processToolbar: (vditor: IVditor, actionBtn: Element, prefix: string, suffix: string) => void;

View File

@@ -0,0 +1 @@
export declare const processKeydown: (vditor: IVditor, event: KeyboardEvent) => boolean;

View File

@@ -0,0 +1 @@
export declare const SMILESRender: (element: (HTMLElement | Document), cdn: string, theme: string) => void;

View File

@@ -0,0 +1 @@
export declare const abcRender: (element?: (HTMLElement | Document), cdn?: string) => void;

View File

@@ -0,0 +1,41 @@
export declare const mathRenderAdapter: {
getCode: (el: Element) => string;
getElements: (element: HTMLElement | Document) => NodeListOf<Element>;
};
export declare const SMILESRenderAdapter: {
getCode: (el: Element) => string;
getElements: (element: HTMLElement | Document) => NodeListOf<Element>;
};
export declare const mermaidRenderAdapter: {
/** 不仅要返回code并且需要将 code 设置为 el 的 innerHTML */
getCode: (el: Element) => string;
getElements: (element: HTMLElement | Document) => NodeListOf<Element>;
};
export declare const markmapRenderAdapter: {
getCode: (el: Element) => string;
getElements: (element: HTMLElement | Document) => NodeListOf<Element>;
};
export declare const mindmapRenderAdapter: {
getCode: (el: Element) => string;
getElements: (el: HTMLElement | Document) => NodeListOf<Element>;
};
export declare const chartRenderAdapter: {
getCode: (el: HTMLElement) => string;
getElements: (el: HTMLElement | Document) => NodeListOf<Element>;
};
export declare const abcRenderAdapter: {
getCode: (el: Element) => string;
getElements: (el: HTMLElement | Document) => NodeListOf<Element>;
};
export declare const graphvizRenderAdapter: {
getCode: (el: Element) => string;
getElements: (el: HTMLElement | Document) => NodeListOf<Element>;
};
export declare const flowchartRenderAdapter: {
getCode: (el: Element) => string;
getElements: (el: HTMLElement | Document) => NodeListOf<Element>;
};
export declare const plantumlRenderAdapter: {
getCode: (el: Element) => string;
getElements: (el: HTMLElement | Document) => NodeListOf<Element>;
};

View File

@@ -0,0 +1 @@
export declare const anchorRender: (type: number) => void;

View File

@@ -0,0 +1 @@
export declare const chartRender: (element: (HTMLElement | Document), cdn: string, theme: string) => void;

View File

@@ -0,0 +1 @@
export declare const codeRender: (element: HTMLElement, option?: IHljs) => void;

View File

@@ -0,0 +1 @@
export declare const flowchartRender: (element: HTMLElement, cdn?: string) => void;

View File

@@ -0,0 +1 @@
export declare const getHTML: (vditor: IVditor) => string;

View File

@@ -0,0 +1 @@
export declare const getMarkdown: (vditor: IVditor) => string;

View File

@@ -0,0 +1 @@
export declare const graphvizRender: (element: HTMLElement, cdn?: string) => void;

View File

@@ -0,0 +1 @@
export declare const highlightRender: (hljsOption?: IHljs, element?: HTMLElement | Document, cdn?: string) => void;

View File

@@ -0,0 +1,6 @@
declare global {
interface Window {
vditorImageIntersectionObserver: IntersectionObserver;
}
}
export declare const lazyLoadImageRender: (element?: (HTMLElement | Document)) => boolean;

View File

@@ -0,0 +1 @@
export declare const markmapRender: (element?: (HTMLElement | Document), cdn?: string) => void;

View File

@@ -0,0 +1,9 @@
declare global {
interface Window {
MathJax: any;
}
}
export declare const mathRender: (element?: (HTMLElement | Document), options?: {
cdn?: string;
math?: IMath;
}) => void;

View File

@@ -0,0 +1 @@
export declare const mediaRender: (element: HTMLElement) => void;

View File

@@ -0,0 +1 @@
export declare const mermaidRender: (element: (HTMLElement | Document), cdn: string, theme: string) => void;

View File

@@ -0,0 +1 @@
export declare const mindmapRender: (element: (HTMLElement | Document), cdn: string, theme: string) => void;

View File

@@ -0,0 +1 @@
export declare const outlineRender: (contentElement: HTMLElement, targetElement: Element, vditor?: IVditor) => string;

View File

@@ -0,0 +1 @@
export declare const plantumlRender: (element?: (HTMLElement | Document), cdn?: string) => void;

View File

@@ -0,0 +1,2 @@
export declare const md2html: (mdText: string, options?: IPreviewOptions) => Promise<string>;
export declare const previewRender: (previewElement: HTMLDivElement, markdown: string, options?: IPreviewOptions) => Promise<void>;

View File

@@ -0,0 +1 @@
export declare const setLute: (options: ILuteOptions) => Lute;

View File

@@ -0,0 +1,6 @@
declare global {
interface Window {
vditorSpeechRange: Range;
}
}
export declare const speechRender: (element: HTMLElement, lang?: keyof II18n) => void;

7
public/vditor/ts/outline/index.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
/// <reference types="./types" />
export declare class Outline {
element: HTMLElement;
constructor(outlineLabel: string);
render(vditor: IVditor): string;
toggle(vditor: IVditor, show?: boolean, focus?: boolean): void;
}

1
public/vditor/ts/preview/image.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const previewImage: (oldImgElement: HTMLImageElement, lang?: keyof II18n, theme?: string) => void;

10
public/vditor/ts/preview/index.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/// <reference types="./types" />
export declare class Preview {
element: HTMLElement;
previewElement: HTMLElement;
private mdTimeoutId;
constructor(vditor: IVditor);
render(vditor: IVditor, value?: string): void;
private afterRender;
private copyToX;
}

6
public/vditor/ts/resize/index.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="./types" />
export declare class Resize {
element: HTMLElement;
constructor(vditor: IVditor);
private bindEvent;
}

View File

@@ -0,0 +1,6 @@
/**
* 合并脚注
* @param elements vditor.sv.element
* @param afterCombine 每个脚注块合并完成后的回调, param: root为合并后的脚注块
*/
export declare const combineFootnote: (elements: HTMLElement, afterCombine?: (root: HTMLElement) => void) => void;

13
public/vditor/ts/sv/index.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
/// <reference types="./types" />
declare class Editor {
range: Range;
element: HTMLPreElement;
composingLock: boolean;
processTimeoutId: number;
hlToolbarTimeoutId: number;
preventInput: boolean;
constructor(vditor: IVditor);
private copy;
private bindEvent;
}
export { Editor };

1
public/vditor/ts/sv/inputEvent.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const inputEvent: (vditor: IVditor, event?: InputEvent) => void;

11
public/vditor/ts/sv/process.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
export declare const processPaste: (vditor: IVditor, text: string) => void;
export declare const getSideByType: (spanNode: Node, type: string, isPrevious?: boolean) => false | Element;
export declare const processSpinVditorSVDOM: (html: string, vditor: IVditor) => string;
export declare const processPreviousMarkers: (spanElement: HTMLElement) => string;
export declare const processAfterRender: (vditor: IVditor, options?: {
enableAddUndoStack: boolean;
enableHint: boolean;
enableInput: boolean;
}) => void;
export declare const processHeading: (vditor: IVditor, value: string) => void;
export declare const processToolbar: (vditor: IVditor, actionBtn: Element, prefix: string, suffix: string) => void;

View File

@@ -0,0 +1 @@
export declare const processKeydown: (vditor: IVditor, event: KeyboardEvent) => boolean;

6
public/vditor/ts/tip/index.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
export declare class Tip {
element: HTMLElement;
constructor();
show(text: string, time?: number): void;
hide(): void;
}

5
public/vditor/ts/toolbar/Both.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Both extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

4
public/vditor/ts/toolbar/Br.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
export declare class Br {
element: HTMLElement;
constructor();
}

View File

@@ -0,0 +1,6 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class CodeTheme extends MenuItem {
element: HTMLElement;
constructor(vditor: IVditor, menuItem: IMenuItem);
}

View File

@@ -0,0 +1,6 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class ContentTheme extends MenuItem {
element: HTMLElement;
constructor(vditor: IVditor, menuItem: IMenuItem);
}

6
public/vditor/ts/toolbar/Counter.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="./types" />
export declare class Counter {
element: HTMLElement;
constructor(vditor: IVditor);
render(vditor: IVditor, mdText: string): void;
}

5
public/vditor/ts/toolbar/Custom.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Custom extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Devtools extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

4
public/vditor/ts/toolbar/Divider.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
export declare class Divider {
element: HTMLElement;
constructor();
}

View File

@@ -0,0 +1,8 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare const setEditMode: (vditor: IVditor, type: string, event: Event | string) => void;
export declare class EditMode extends MenuItem {
element: HTMLElement;
constructor(vditor: IVditor, menuItem: IMenuItem);
_bindEvent(vditor: IVditor, panelElement: HTMLElement, menuItem: IMenuItem): void;
}

7
public/vditor/ts/toolbar/Emoji.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Emoji extends MenuItem {
element: HTMLElement;
constructor(vditor: IVditor, menuItem: IMenuItem);
private bindEvent;
}

6
public/vditor/ts/toolbar/Export.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Export extends MenuItem {
element: HTMLElement;
constructor(vditor: IVditor, menuItem: IMenuItem);
}

View File

@@ -0,0 +1,6 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Fullscreen extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
_bindEvent(vditor: IVditor, menuItem: IMenuItem): void;
}

View File

@@ -0,0 +1,7 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Headings extends MenuItem {
element: HTMLElement;
constructor(vditor: IVditor, menuItem: IMenuItem);
_bindEvent(vditor: IVditor, panelElement: HTMLElement): void;
}

5
public/vditor/ts/toolbar/Help.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Help extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

5
public/vditor/ts/toolbar/Indent.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Indent extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

5
public/vditor/ts/toolbar/Info.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Info extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class InsertAfter extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class InsertBefore extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
export declare class MenuItem {
element: HTMLElement;
constructor(vditor: IVditor, menuItem: IMenuItem);
}

5
public/vditor/ts/toolbar/Outdent.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Outdent extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

5
public/vditor/ts/toolbar/Outline.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Outline extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

6
public/vditor/ts/toolbar/Preview.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Preview extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
_bindEvent(vditor: IVditor): void;
}

6
public/vditor/ts/toolbar/Record.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Record extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
_bindEvent(vditor: IVditor): void;
}

5
public/vditor/ts/toolbar/Redo.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Redo extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

5
public/vditor/ts/toolbar/Undo.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Undo extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
}

6
public/vditor/ts/toolbar/Upload.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="./types" />
import { MenuItem } from "./MenuItem";
export declare class Upload extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem);
_bindEvent(vditor: IVditor): void;
}

10
public/vditor/ts/toolbar/index.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/// <reference types="./types" />
export declare class Toolbar {
elements: {
[key: string]: HTMLElement;
};
element: HTMLElement;
constructor(vditor: IVditor);
updateConfig(vditor: IVditor, options: IToolbarConfig): void;
private genItem;
}

View File

@@ -0,0 +1,20 @@
export declare const removeCurrentToolbar: (toolbar: {
[key: string]: HTMLElement;
}, names: string[]) => void;
export declare const setCurrentToolbar: (toolbar: {
[key: string]: HTMLElement;
}, names: string[]) => void;
export declare const enableToolbar: (toolbar: {
[key: string]: HTMLElement;
}, names: string[]) => void;
export declare const disableToolbar: (toolbar: {
[key: string]: HTMLElement;
}, names: string[]) => void;
export declare const hideToolbar: (toolbar: {
[key: string]: HTMLElement;
}, names: string[]) => void;
export declare const showToolbar: (toolbar: {
[key: string]: HTMLElement;
}, names: string[]) => void;
export declare const hidePanel: (vditor: IVditor, panels: string[], exceptElement?: HTMLElement) => void;
export declare const toggleSubMenu: (vditor: IVditor, panelElement: HTMLElement, actionBtn: Element, level: number) => void;

4
public/vditor/ts/ui/initUI.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
export declare const initUI: (vditor: IVditor) => void;
export declare const setPadding: (vditor: IVditor) => void;
export declare const setTypewriterPosition: (vditor: IVditor) => void;
export declare function UIUnbindListener(): void;

1
public/vditor/ts/ui/setCodeTheme.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const setCodeTheme: (codeTheme: string, cdn?: string) => void;

View File

@@ -0,0 +1 @@
export declare const setContentTheme: (contentTheme: string, path: string) => void;

View File

@@ -0,0 +1 @@
export declare const setPreviewMode: (mode: "both" | "editor", vditor: IVditor) => void;

1
public/vditor/ts/ui/setTheme.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const setTheme: (vditor: IVditor) => void;

19
public/vditor/ts/undo/index.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
/// <reference types="./types" />
declare class Undo {
private stackSize;
private dmp;
private wysiwyg;
private ir;
private sv;
constructor();
clearStack(vditor: IVditor): void;
resetIcon(vditor: IVditor): void;
undo(vditor: IVditor): void;
redo(vditor: IVditor): void;
recordFirstPosition(vditor: IVditor, event: KeyboardEvent): void;
addToUndoStack(vditor: IVditor): void;
private renderDiff;
private resetStack;
private addCaret;
}
export { Undo };

View File

@@ -0,0 +1 @@
export declare const getElement: (vditor: IVditor) => HTMLPreElement;

8
public/vditor/ts/upload/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
declare class Upload {
element: HTMLElement;
isUploading: boolean;
range: Range;
constructor();
}
declare const uploadFiles: (vditor: IVditor, files: FileList | DataTransferItemList | File[], element?: HTMLInputElement) => Promise<void>;
export { Upload, uploadFiles };

View File

@@ -0,0 +1 @@
export declare const setHeaders: (vditor: IVditor, xhr: XMLHttpRequest) => void;

8
public/vditor/ts/util/Options.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
/// <reference types="./types" />
export declare class Options {
options: IOptions;
private defaultOptions;
constructor(options: IOptions);
merge(): IOptions;
private mergeToolbar;
}

18
public/vditor/ts/util/RecordMedia.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
export declare class RecordMedia {
SAMPLE_RATE: number;
DEFAULT_SAMPLE_RATE: number;
isRecording: boolean;
readyFlag: boolean;
leftChannel: Float32List[];
rightChannel: Float32List[];
recordingLength: number;
recorder: ScriptProcessorNode;
constructor(e: MediaStream);
cloneChannelData(leftChannelData: Float32List, rightChannelData: Float32List): void;
startRecordingNewWavFile(): void;
stopRecording(): void;
buildWavFileBlob(): Blob;
private downSampleBuffer;
private mergeBuffers;
private writeUTFBytes;
}

2
public/vditor/ts/util/addScript.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
export declare const addScriptSync: (path: string, id: string) => boolean;
export declare const addScript: (path: string, id: string) => Promise<unknown>;

1
public/vditor/ts/util/addStyle.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const addStyle: (url: string, id: string) => void;

View File

@@ -0,0 +1 @@
export declare const code160to32: (text: string) => string;

View File

@@ -0,0 +1,7 @@
export declare const isSafari: () => boolean;
export declare const isFirefox: () => boolean;
export declare const accessLocalStorage: () => boolean;
export declare const getEventName: () => "click" | "touchstart";
export declare const isCtrl: (event: KeyboardEvent) => boolean;
export declare const updateHotkeyTip: (hotkey: string) => string;
export declare const isChrome: () => boolean;

View File

@@ -0,0 +1,9 @@
export declare const focusEvent: (vditor: IVditor, editorElement: HTMLElement) => void;
export declare const dblclickEvent: (vditor: IVditor, editorElement: HTMLElement) => void;
export declare const blurEvent: (vditor: IVditor, editorElement: HTMLElement) => void;
export declare const dropEvent: (vditor: IVditor, editorElement: HTMLElement) => void;
export declare const copyEvent: (vditor: IVditor, editorElement: HTMLElement, copy: (event: ClipboardEvent, vditor: IVditor) => void) => void;
export declare const cutEvent: (vditor: IVditor, editorElement: HTMLElement, copy: (event: ClipboardEvent, vditor: IVditor) => void) => void;
export declare const scrollCenter: (vditor: IVditor) => void;
export declare const hotkeyEvent: (vditor: IVditor, editorElement: HTMLElement) => void;
export declare const selectEvent: (vditor: IVditor, editorElement: HTMLElement) => void;

View File

@@ -0,0 +1,39 @@
export declare const fixGSKeyBackspace: (event: KeyboardEvent, vditor: IVditor, startContainer: Node) => boolean;
export declare const fixCJKPosition: (range: Range, vditor: IVditor, event: KeyboardEvent) => void;
export declare const fixCursorDownInlineMath: (range: Range, key: string) => void;
export declare const insertEmptyBlock: (vditor: IVditor, position: InsertPosition) => void;
export declare const isFirstCell: (cellElement: HTMLElement) => false | HTMLTableElement;
export declare const isLastCell: (cellElement: HTMLElement) => false | HTMLTableElement;
export declare const insertAfterBlock: (vditor: IVditor, event: KeyboardEvent, range: Range, element: HTMLElement, blockElement: HTMLElement) => boolean;
export declare const insertBeforeBlock: (vditor: IVditor, event: KeyboardEvent, range: Range, element: HTMLElement, blockElement: HTMLElement) => boolean;
export declare const listToggle: (vditor: IVditor, range: Range, type: string, cancel?: boolean) => void;
export declare const listIndent: (vditor: IVditor, liElement: HTMLElement, range: Range) => void;
export declare const listOutdent: (vditor: IVditor, liElement: HTMLElement, range: Range, topListElement: HTMLElement) => void;
export declare const setTableAlign: (tableElement: HTMLTableElement, type: string) => void;
export declare const isHrMD: (text: string) => boolean;
export declare const isHeadingMD: (text: string) => boolean;
export declare const execAfterRender: (vditor: IVditor, options?: {
enableAddUndoStack: boolean;
enableHint: boolean;
enableInput: boolean;
}) => void;
export declare const fixList: (range: Range, vditor: IVditor, pElement: HTMLElement | false, event: KeyboardEvent) => boolean;
export declare const fixTab: (vditor: IVditor, range: Range, event: KeyboardEvent) => boolean;
export declare const fixMarkdown: (event: KeyboardEvent, vditor: IVditor, pElement: HTMLElement | false, range: Range) => boolean;
export declare const insertRow: (vditor: IVditor, range: Range, cellElement: HTMLElement) => void;
export declare const insertRowAbove: (vditor: IVditor, range: Range, cellElement: HTMLElement) => void;
export declare const insertColumn: (vditor: IVditor, tableElement: HTMLTableElement, cellElement: HTMLElement, type?: InsertPosition) => void;
export declare const deleteRow: (vditor: IVditor, range: Range, cellElement: HTMLElement) => void;
export declare const deleteColumn: (vditor: IVditor, range: Range, tableElement: HTMLTableElement, cellElement: HTMLElement) => void;
export declare const fixTable: (vditor: IVditor, event: KeyboardEvent, range: Range) => boolean;
export declare const fixCodeBlock: (vditor: IVditor, event: KeyboardEvent, codeRenderElement: HTMLElement, range: Range) => boolean;
export declare const fixBlockquote: (vditor: IVditor, range: Range, event: KeyboardEvent, pElement: HTMLElement | false) => boolean;
export declare const fixTask: (vditor: IVditor, range: Range, event: KeyboardEvent) => boolean;
export declare const fixDelete: (vditor: IVditor, range: Range, event: KeyboardEvent, pElement: HTMLElement | false) => boolean;
export declare const fixHR: (range: Range) => void;
export declare const fixFirefoxArrowUpTable: (event: KeyboardEvent, blockElement: false | HTMLElement, range: Range) => boolean;
export declare const paste: (vditor: IVditor, event: (ClipboardEvent | DragEvent) & {
target: HTMLElement;
}, callback: {
pasteCode(code: string): void;
}) => Promise<void>;

3
public/vditor/ts/util/function.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export declare const genUUID: () => string;
export declare const getSearch: (key: string, link?: string) => string;
export declare const looseJsonParse: (text: string) => any;

View File

@@ -0,0 +1 @@
export declare const getSelectText: (editor: HTMLElement, range?: Range) => string;

9
public/vditor/ts/util/hasClosest.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
export declare const hasTopClosestByClassName: (element: Node, className: string) => false | HTMLElement;
export declare const hasTopClosestByAttribute: (element: Node, attr: string, value: string) => false | HTMLElement;
export declare const hasTopClosestByTag: (element: Node, nodeName: string) => false | HTMLElement;
export declare const getTopList: (element: Node) => false | HTMLElement;
export declare const hasClosestByAttribute: (element: Node, attr: string, value: string) => false | HTMLElement;
export declare const hasClosestBlock: (element: Node) => false | HTMLElement;
export declare const hasClosestByMatchTag: (element: Node, nodeName: string) => false | HTMLElement;
export declare const hasClosestByClassName: (element: Node, className: string) => false | HTMLElement;
export declare const getLastNode: (node: Node) => Node;

View File

@@ -0,0 +1,2 @@
export declare const hasClosestByTag: (element: Node, nodeName: string) => false | HTMLElement;
export declare const hasClosestByHeadings: (element: Node) => false | HTMLElement;

View File

@@ -0,0 +1 @@
export declare const highlightToolbar: (vditor: IVditor) => void;

1
public/vditor/ts/util/hotKey.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const matchHotKey: (hotKey: string, event: KeyboardEvent) => boolean;

1
public/vditor/ts/util/log.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const log: (method: string, content: string, type: string, print: boolean) => void;

1
public/vditor/ts/util/merge.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare const merge: (...options: any[]) => any;

View File

@@ -0,0 +1,2 @@
export declare const processPasteCode: (html: string, text: string, type?: string) => string | false;
export declare const processCodeRender: (previewPanel: HTMLElement, vditor: IVditor) => void;

14
public/vditor/ts/util/selection.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
export declare const getEditorRange: (vditor: IVditor) => Range;
export declare const getCursorPosition: (editor: HTMLElement) => {
left: number;
top: number;
};
export declare const selectIsEditor: (editor: HTMLElement, range?: Range) => boolean;
export declare const setSelectionFocus: (range: Range) => void;
export declare const getSelectPosition: (selectElement: HTMLElement, editorElement: HTMLElement, range?: Range) => {
end: number;
start: number;
};
export declare const setSelectionByPosition: (start: number, end: number, editor: HTMLElement) => Range;
export declare const setRangeByWbr: (element: HTMLElement, range: Range) => void;
export declare const insertHTML: (html: string, vditor: IVditor) => void;

5
public/vditor/ts/util/toc.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
export declare const renderToc: (vditor: IVditor) => void;
export declare const clickToc: (event: MouseEvent & {
target: HTMLElement;
}, vditor: IVditor) => void;
export declare const keydownToc: (blockElement: HTMLElement, vditor: IVditor, event: KeyboardEvent, range: Range) => boolean;

View File

@@ -0,0 +1,5 @@
export declare const afterRenderEvent: (vditor: IVditor, options?: {
enableAddUndoStack: boolean;
enableHint: boolean;
enableInput: boolean;
}) => void;

View File

@@ -0,0 +1,4 @@
export declare const highlightToolbarWYSIWYG: (vditor: IVditor) => void;
export declare const genLinkRefPopover: (vditor: IVditor, linkRefElement: HTMLElement, range?: Range) => void;
export declare const genAPopover: (vditor: IVditor, aElement: HTMLElement, range: Range) => void;
export declare const genImagePopover: (event: Event, vditor: IVditor) => void;

Some files were not shown because too many files have changed in this diff Show More