Skip to content

Commit

Permalink
🐛 fix #616
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jul 23, 2020
1 parent bc53ec6 commit ff49ba7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

### v3.3.11 / 2020-07-xx

* [616](https://github.com/Vanessa219/vditor/pull/616) fix: safari下选中文字添加标题文字会消失 `修复缺陷`
* [615](https://github.com/Vanessa219/vditor/issues/615) 即时渲染模式下在safari中光标位置跳动 `修复缺陷`

### v3.3.10 / 2020-07-20
Expand Down
12 changes: 6 additions & 6 deletions src/ts/ir/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ export const processHeading = (vditor: IVditor, value: string) => {
if (headingElement) {
if (value === "") {
const headingMarkerElement = headingElement.querySelector(".vditor-ir__marker--heading");
const selection = window.getSelection();
selection.selectAllChildren(headingMarkerElement)
range.selectNodeContents(headingMarkerElement);
setSelectionFocus(range);
document.execCommand("delete");
} else {
const html = value + headingElement.innerText;
const selection = window.getSelection();
selection.selectAllChildren(headingElement)
document.execCommand("insertHTML", false, html);
range.selectNodeContents(headingElement);
range.collapse(true);
setSelectionFocus(range);
document.execCommand("insertHTML", false, value);
}
highlightToolbarIR(vditor);
renderToc(vditor);
Expand Down

0 comments on commit ff49ba7

Please sign in to comment.