Skip to content

Commit

Permalink
[Fix] Selection rangecount (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
gohabereg authored Nov 30, 2019
1 parent 729f2ea commit 1e20882
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dist/editor.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
`Fix` — Fixed Grammarly conflict [#779](https://github.com/codex-team/editor.js/issues/779)
`Improvements` — Module Listeners now correctly removes events with options [#904](https://github.com/codex-team/editor.js/pull/904)
`Fix` — Fixed History Back on block deletion by Backspace in Firefox [#967](https://github.com/codex-team/editor.js/pull/967)
- `Fix` — Fixed `getRangeCount` call if range count is 0 [#938](https://github.com/codex-team/editor.js/issues/938)

### 2.15.1

Expand Down
4 changes: 4 additions & 0 deletions src/components/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ export default class SelectionUtils {
return rect;
}

if (sel.rangeCount === 0) {
return rect;
}

range = sel.getRangeAt(0).cloneRange() as Range;

if (range.getBoundingClientRect) {
Expand Down

0 comments on commit 1e20882

Please sign in to comment.