Skip to content

Commit ea3c767

Browse files
authored
[issue-926]: fix dom iterator leafing when items are empty (#958)
* [issue-926]: fix dom iterator leafing when items are empty * update Changelog
1 parent d086b6d commit ea3c767

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

dist/editor.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- `Improvements` — Inline Toolbar design improved
66
- `Improvements` — Conversion Toolbar now included in the Inline Toolbar [#853](https://github.com/codex-team/editor.js/issues/853)
7+
`Fix` — Fix flipper with empty dom iterator [#926](https://github.com/codex-team/editor.js/issues/926)
78

89
### 2.15.1
910

src/components/domIterator.ts

+7
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ export default class DomIterator {
9696
* @return {Number} index of focused node
9797
*/
9898
private leafNodesAndReturnIndex(direction: string): number {
99+
/**
100+
* if items is empty then there is nothing to leaf
101+
*/
102+
if (this.items.length === 0) {
103+
return this.cursor;
104+
}
105+
99106
let focusedButtonIndex = this.cursor;
100107

101108
/**

0 commit comments

Comments
 (0)