Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复Lute类型的定义 #697

Merged
merged 3 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ts/markdown/setLute.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const setLute = (options: ILuteOptions) => {
const lute: ILute = Lute.New();
const lute: Lute = Lute.New();
lute.PutEmojis(options.emojis);
lute.SetEmojiSite(options.emojiSite);
lute.SetHeadingAnchor(options.headingAnchor);
Expand Down
143 changes: 71 additions & 72 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ declare module "*.svg";

declare module "*.png";

declare const Lute: ILute;

interface IObject {
[key: string]: string;
}
Expand Down Expand Up @@ -102,108 +100,109 @@ interface ILuteOptions extends IMarkdownConfig {
inlineMathDigit: boolean;
lazyLoadImage?: string;
}
declare class Lute {
public static WalkStop: number;
public static WalkSkipChildren: number;
public static WalkContinue: number;
public static Version: string;
public static Caret: string;

interface ILute {
WalkStop: number;
WalkSkipChildren: number;
WalkContinue: number;
Version: string;
Caret: string;

New(): ILute;

GetHeadingID(node: ILuteNode): string;

SetJSRenderers(options?: {
renderers: {
HTML2VditorDOM?: ILuteRender,
HTML2VditorIRDOM?: ILuteRender,
HTML2Md?: ILuteRender,
Md2HTML?: ILuteRender,
Md2VditorDOM?: ILuteRender,
Md2VditorIRDOM?: ILuteRender,
Md2VditorSVDOM?: ILuteRender,
},
}): void;
private constructor();

public static New(): Lute;

public static GetHeadingID(node: ILuteNode): string;

SetJSRenderers(options?: {
renderers: {
HTML2VditorDOM?: ILuteRender,
HTML2VditorIRDOM?: ILuteRender,
HTML2Md?: ILuteRender,
Md2HTML?: ILuteRender,
Md2VditorDOM?: ILuteRender,
Md2VditorIRDOM?: ILuteRender,
Md2VditorSVDOM?: ILuteRender,
},
}): void;

SetChineseParagraphBeginningSpace(enable: boolean): void;
SetChineseParagraphBeginningSpace(enable: boolean): void;

SetRenderListStyle(enable: boolean): void;
SetRenderListStyle(enable: boolean): void;

SetLinkBase(url: string): void;
SetLinkBase(url: string): void;

SetSanitize(enable: boolean): void;
SetSanitize(enable: boolean): void;

SetHeadingAnchor(enable: boolean): void;
SetHeadingAnchor(enable: boolean): void;

SetImageLazyLoading(imagePath: string): void;
SetImageLazyLoading(imagePath: string): void;

SetInlineMathAllowDigitAfterOpenMarker(enable: boolean): void;
SetInlineMathAllowDigitAfterOpenMarker(enable: boolean): void;

SetToC(enable: boolean): void;
SetToC(enable: boolean): void;

SetFootnotes(enable: boolean): void;
SetFootnotes(enable: boolean): void;

SetAutoSpace(enable: boolean): void;
SetAutoSpace(enable: boolean): void;

SetChinesePunct(enable: boolean): void;
SetChinesePunct(enable: boolean): void;

SetFixTermTypo(enable: boolean): void;
SetFixTermTypo(enable: boolean): void;

SetEmojiSite(emojiSite: string): void;
SetEmojiSite(emojiSite: string): void;

SetVditorCodeBlockPreview(enable: boolean): void;
SetVditorCodeBlockPreview(enable: boolean): void;

PutEmojis(emojis: IObject): void;
PutEmojis(emojis: IObject): void;

GetEmojis(): IObject;
GetEmojis(): IObject;

FormatMd(markdown: string): string;
FormatMd(markdown: string): string;

// debugger md
RenderEChartsJSON(text: string): string;
// debugger md
RenderEChartsJSON(text: string): string;

// md 转换为 html
Md2HTML(markdown: string): string;
// md 转换为 html
Md2HTML(markdown: string): string;

// 粘贴时将 html 转换为 md
HTML2Md(html: string): string;
// 粘贴时将 html 转换为 md
HTML2Md(html: string): string;

// wysiwyg 转换为 html
VditorDOM2HTML(vhtml: string): string;
// wysiwyg 转换为 html
VditorDOM2HTML(vhtml: string): string;

// wysiwyg 输入渲染
SpinVditorDOM(html: string): string;
// wysiwyg 输入渲染
SpinVditorDOM(html: string): string;

// 粘贴时将 html 转换为 wysiwyg
HTML2VditorDOM(html: string): string;
// 粘贴时将 html 转换为 wysiwyg
HTML2VditorDOM(html: string): string;

// 将 wysiwyg 转换为 md
VditorDOM2Md(html: string): string;
// 将 wysiwyg 转换为 md
VditorDOM2Md(html: string): string;

// 将 md 转换为 wysiwyg
Md2VditorDOM(markdown: string): string;
// 将 md 转换为 wysiwyg
Md2VditorDOM(markdown: string): string;

// ir 输入渲染
SpinVditorIRDOM(markdown: string): string;
// ir 输入渲染
SpinVditorIRDOM(markdown: string): string;

// ir 获取 md
VditorIRDOM2Md(html: string): string;
// ir 获取 md
VditorIRDOM2Md(html: string): string;

// md 转换为 ir
Md2VditorIRDOM(text: string): string;
// md 转换为 ir
Md2VditorIRDOM(text: string): string;

// 获取 HTML
VditorIRDOM2HTML(html: string): string;
// 获取 HTML
VditorIRDOM2HTML(html: string): string;

// 粘贴时将 html 转换为 sv
HTML2VditorIRDOM(html: string): string;
// 粘贴时将 html 转换为 sv
HTML2VditorIRDOM(html: string): string;

// sv 输入渲染
SpinVditorSVDOM(text: string): string;
// sv 输入渲染
SpinVditorSVDOM(text: string): string;

// 粘贴是 md 转换为 sv
Md2VditorSVDOM(text: string): string;
// 粘贴是 md 转换为 sv
Md2VditorSVDOM(text: string): string;
}

declare const webkitAudioContext: {
Expand Down Expand Up @@ -538,7 +537,7 @@ interface IVditor {
element: HTMLElement;
options: IOptions;
originalInnerHTML: string;
lute: ILute;
lute: Lute;
currentMode: "sv" | "wysiwyg" | "ir";
devtools?: {
element: HTMLDivElement,
Expand Down