Skip to content

Commit

Permalink
🐛 fix #848
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Dec 18, 2020
1 parent 053ffaa commit 6bc8c07
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@

### v3.7.3 / 2020-12-xx

* [848](https://github.com/Vanessa219/vditor/issues/848) 即时渲染模式下FireFox浏览器光标问题 `修复缺陷`
* [847](https://github.com/Vanessa219/vditor/issues/847) 即时渲染状态下 Firefox 删除线出错 `修复缺陷`
* [858](https://github.com/Vanessa219/vditor/issues/858) 预览模式下应禁用工具栏上传按钮 `修复缺陷`
* [849](https://github.com/Vanessa219/vditor/issues/849) 固定工具栏模式下点击全屏打开后导航栏位置异常 `修复缺陷`
* [855](https://github.com/Vanessa219/vditor/issues/855) 添加全屏 z-index 设置 `引入特性`
Expand Down
22 changes: 13 additions & 9 deletions src/ts/ir/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,26 @@ export const processToolbar = (vditor: IVditor, actionBtn: Element, prefix: stri
if (range.toString() === "") {
html = `${prefix}<wbr>${suffix}`;
} else {
html = `${prefix}${range.toString()}<wbr>${suffix}`;
if (commandName === "code" || commandName === "table") {
html = `${prefix}${range.toString()}<wbr>${suffix}`;
} else {
html = `${prefix}${range.toString()}${suffix}<wbr>`;
}
range.deleteContents();
}
if (commandName === "table" || commandName === "code") {
html = "\n" + html;
actionBtn.classList.add("vditor-menu--disabled");
} else {
actionBtn.classList.add("vditor-menu--current");
html = "\n" + html + "\n\n";
}
document.execCommand("insertHTML", false, html);

const spanElement = document.createElement("span");
spanElement.innerHTML = html;
range.insertNode(spanElement);
input(vditor, range);

if (commandName === "table") {
range.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement);
setSelectionFocus(range);
}
if (commandName !== "code" && commandName !== "inline-code") {
useHighlight = false;
}
} else if (commandName === "check" || commandName === "list" || commandName === "ordered-list") {
listToggle(vditor, range, commandName, false);
useHighlight = false;
Expand Down

0 comments on commit 6bc8c07

Please sign in to comment.