Skip to content

Commit

Permalink
fix #30
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jan 5, 2020
1 parent a145cc4 commit 5c9ec14
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

### v2.0.10 / 2020-01-04

* [30](https://github.com/Vanessa219/vditor/issues/30) 添加 option.value `enhancement`
* [29](https://github.com/Vanessa219/vditor/issues/29) 添加 debugger,为开发时显示日志 `enhancement`
* [28](https://github.com/Vanessa219/vditor/issues/28) wysiwyg 时代码块、流程图等直接进行渲染,不展示源码 `enhancement`
* [26](https://github.com/Vanessa219/vditor/issues/26) wysiwyg 性能优化 `enhancement`
Expand All @@ -50,6 +51,7 @@
* 文档更新
* 添加 option.mode?: "wysiwyg-show" | "markdown-show" | "wysiwyg-only" | "markdown-only" 参数
* 添加 options.debugger
* 添加 options.value

### v1.10.11 / 2019-12-12

Expand Down
4 changes: 2 additions & 2 deletions src/ts/markdown/md2html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const loadLuteJs = async (vditor: IVditor | string) => {
} else if (typeof vditor === "object" && vditor.options.cdn) {
cdn = vditor.options.cdn;
}
addScript(`${cdn}/dist/js/lute/lute.min.js`, "vditorLuteScript");
// addScript(`http://192.168.0.107:9090/lute.min.js?${new Date().getTime()}`, "vditorLuteScript");
// addScript(`${cdn}/dist/js/lute/lute.min.js`, "vditorLuteScript");
addScript(`http://192.168.0.107:9090/lute.min.js?${new Date().getTime()}`, "vditorLuteScript");

if (vditor && typeof vditor === "object" && !vditor.lute) {
vditor.lute = Lute.New();
Expand Down
1 change: 1 addition & 0 deletions src/ts/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ interface IResize {
}

interface IOptions {
value?: string;
debugger?: boolean;
after?: () => void;
typewriterMode?: boolean;
Expand Down
9 changes: 7 additions & 2 deletions src/ts/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ export class Ui {

// set default value
let initValue = localStorage.getItem("vditor" + vditor.id);
if ((!vditor.options.cache || !initValue) && vditor.originalInnerHTML) {
initValue = await html2md(vditor, vditor.originalInnerHTML);
if (!vditor.options.cache || !initValue) {
if (vditor.options.value) {
initValue = vditor.options.value;
} else if (vditor.originalInnerHTML) {
initValue = await html2md(vditor, vditor.originalInnerHTML);
}
}

if (!initValue) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/ts/util/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export class Options {
url: "",
withCredentials: false,
},
value: "",
width: "auto",
};

Expand Down

0 comments on commit 5c9ec14

Please sign in to comment.