Skip to content

Commit

Permalink
🐛 fix #449
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed May 27, 2020
1 parent 54f47c8 commit fb6b12c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/ts/ir/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export const input = (vditor: IVditor, range: Range, ignoreSpace = false) => {
vditor.ir.element.insertAdjacentElement("beforeend", allFootnoteElement);
}
}

setRangeByWbr(vditor.ir.element, range);

vditor.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach((item: HTMLElement) => {
Expand Down
6 changes: 5 additions & 1 deletion src/ts/ir/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {getMarkdown} from "../markdown/getMarkdown";
import {accessLocalStorage, isSafari} from "../util/compatibility";
import {listToggle, renderToc} from "../util/fixBrowserBehavior";
import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName, hasClosestByMatchTag} from "../util/hasClosest";
import {getEditorRange, getSelectPosition, setRangeByWbr} from "../util/selection";
import {getEditorRange, getSelectPosition, setRangeByWbr, setSelectionFocus} from "../util/selection";
import {highlightToolbar} from "./highlightToolbar";

export const processHint = (vditor: IVditor) => {
Expand Down Expand Up @@ -183,6 +183,10 @@ export const processToolbar = (vditor: IVditor, actionBtn: Element, prefix: stri
html = "\n" + html;
}
document.execCommand("insertHTML", false, html);
if (commandName === "table") {
range.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement);
setSelectionFocus(range);
}
} else if (commandName === "check" || commandName === "list" || commandName === "ordered-list") {
listToggle(vditor, range, commandName, false);
}
Expand Down

0 comments on commit fb6b12c

Please sign in to comment.