Skip to content

Commit

Permalink
🐛 thx fix #418
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed May 17, 2020
1 parent 8c114cb commit c382a13
Show file tree
Hide file tree
Showing 3 changed files with 8 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.7 / 2020-05-xx

* [418](https://github.com/Vanessa219/vditor/issues/418) 点击侧边空白,光标会挪到尾部 `修复缺陷`
* [415](https://github.com/Vanessa219/vditor/issues/415) using local JS file `修复缺陷`

### v3.2.6 / 2020-05-15
Expand Down
6 changes: 4 additions & 2 deletions src/ts/ir/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ class IR {
processAfterRender(vditor);
return;
}
const range = getEditorRange(this.element);

if (event.target.isEqualNode(this.element) && this.element.lastElementChild && range.collapsed) {
const range = getEditorRange(this.element);
const lastRect = this.element.lastElementChild.getBoundingClientRect();
if (event.target.isEqualNode(this.element) && this.element.lastElementChild && range.collapsed &&
event.y > lastRect.top + lastRect.height) {
if (this.element.lastElementChild.tagName === "P") {
range.selectNodeContents(this.element.lastElementChild);
range.collapse(false);
Expand Down
4 changes: 3 additions & 1 deletion src/ts/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ class WYSIWYG {
}

const range = getEditorRange(this.element);
if (event.target.isEqualNode(this.element) && this.element.lastElementChild && range.collapsed) {
const lastRect = this.element.lastElementChild.getBoundingClientRect();
if (event.target.isEqualNode(this.element) && this.element.lastElementChild && range.collapsed &&
event.y > lastRect.top + lastRect.height) {
if (this.element.lastElementChild.tagName === "P") {
range.selectNodeContents(this.element.lastElementChild);
range.collapse(false);
Expand Down

0 comments on commit c382a13

Please sign in to comment.