Skip to content

Commit

Permalink
🐛 fix #246
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Mar 27, 2020
1 parent f0f79b8 commit 1e1864e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@

* [open issues](https://github.com/Vanessa219/vditor/issues)

### v3.0.6 / 2020-03-xx

* [246](https://github.com/Vanessa219/vditor/issues/246) 报错index.min.js:27 `修复缺陷`

### v3.0.5 / 2020-03-26

* [235](https://github.com/Vanessa219/vditor/pull/235) 修复父元素自定义行高时工具栏垂直不居中 `修复缺陷`
Expand Down
13 changes: 7 additions & 6 deletions src/ts/toolbar/EditMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ export const setEditMode = (vditor: IVditor, type: string, event?: Event) => {
if (vditor.devtools) {
vditor.devtools.renderEchart(vditor);
}
if (vditor.preview) {
if ((vditor.currentPreviewMode === "both" || vditor.currentPreviewMode === "preview") && type === "sv") {
vditor.preview.element.style.display = "block";
} else {
vditor.preview.element.style.display = "none";
}
}
const allToolbar = ["emoji", "headings", "bold", "italic", "strike", "link", "list", "ordered-list", "check",
"line", "quote", "code", "inline-code", "upload", "record", "table"];
enableToolbar(vditor.toolbar.elements, allToolbar);
Expand All @@ -31,7 +38,6 @@ export const setEditMode = (vditor: IVditor, type: string, event?: Event) => {
hideToolbar(vditor.toolbar.elements, ["format", "both", "preview"]);
vditor.irUndo.resetIcon(vditor);
vditor.sv.element.style.display = "none";
vditor.preview.element.style.display = "none";
vditor.wysiwyg.element.parentElement.style.display = "none";
vditor.ir.element.parentElement.style.display = "block";

Expand All @@ -57,7 +63,6 @@ export const setEditMode = (vditor: IVditor, type: string, event?: Event) => {
hideToolbar(vditor.toolbar.elements, ["format", "both", "preview"]);
vditor.wysiwygUndo.resetIcon(vditor);
vditor.sv.element.style.display = "none";
vditor.preview.element.style.display = "none";
vditor.wysiwyg.element.parentElement.style.display = "block";
vditor.ir.element.parentElement.style.display = "none";

Expand All @@ -77,15 +82,11 @@ export const setEditMode = (vditor: IVditor, type: string, event?: Event) => {
vditor.ir.element.parentElement.style.display = "none";
if (vditor.currentPreviewMode === "both") {
vditor.sv.element.style.display = "block";
vditor.preview.element.style.display = "block";
} else if (vditor.currentPreviewMode === "preview") {
vditor.sv.element.style.display = "none";
vditor.preview.element.style.display = "block";
} else if (vditor.currentPreviewMode === "editor") {
vditor.sv.element.style.display = "block";
vditor.preview.element.style.display = "none";
}

const wysiwygMD = getMarkdown(vditor);
vditor.currentMode = "sv";
formatRender(vditor, wysiwygMD, undefined);
Expand Down

0 comments on commit 1e1864e

Please sign in to comment.