Skip to content

Commit

Permalink
🎨 fix #444
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed May 26, 2020
1 parent 15adebe commit 5a28d23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@

### v3.2.10 / 2020-05-xx

* [444](https://github.com/Vanessa219/vditor/pull/444) delete tables when cells are empty `改进功能`
* [447](https://github.com/Vanessa219/vditor/pull/447) run vditor.insertValue('abc') throw error `修复缺陷`
* [435](https://github.com/Vanessa219/vditor/issues/435) task list 合并会添加 p 标签 `修复缺陷`
* [432](https://github.com/Vanessa219/vditor/issues/432) 代码块中输入 &pars 解析问题 `修复缺陷`
Expand Down
11 changes: 8 additions & 3 deletions src/ts/util/fixBrowserBehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,14 @@ export const fixTable = (vditor: IVditor, event: KeyboardEvent, range: Range) =>
if (!isCtrl(event) && !event.shiftKey && !event.altKey && event.key === "Backspace"
&& range.startOffset === 0 && range.toString() === "") {
const previousCellElement = goPreviousCell(cellElement, range, false);
if (!previousCellElement && tableElement && tableElement.textContent.trim() === "") {
tableElement.outerHTML = `<p data-block="0"><wbr></p>`;
setRangeByWbr(vditor[vditor.currentMode].element, range);
if (!previousCellElement && tableElement) {
if (tableElement.textContent.trim() === "") {
tableElement.outerHTML = `<p data-block="0"><wbr>\n</p>`;
setRangeByWbr(vditor[vditor.currentMode].element, range);
} else {
range.setStartBefore(tableElement);
range.collapse(true);
}
execAfterRender(vditor);
}
event.preventDefault();
Expand Down

0 comments on commit 5a28d23

Please sign in to comment.