Skip to content

Commit 6628d94

Browse files
authored
Merge pull request #1541 from binhtran92/LPS-166754
fix: avoid null on init and destroy the editor too fast makes the DOM is not loaded
2 parents a6e6b65 + 81959f0 commit 6628d94

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/adapter/core.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,15 @@ extend(
171171
const nativeEditor = this.get('nativeEditor');
172172
const isMSSelection = typeof window.getSelection != 'function';
173173

174-
if (isMSSelection) {
175-
nativeEditor.document.$.selection.empty();
176-
} else {
177-
nativeEditor.document
178-
.getWindow()
179-
.$.getSelection()
180-
.removeAllRanges();
174+
if (nativeEditor.document) {
175+
if (isMSSelection) {
176+
nativeEditor.document.$.selection.empty();
177+
} else {
178+
nativeEditor.document
179+
.getWindow()
180+
.$.getSelection()
181+
.removeAllRanges();
182+
}
181183
}
182184
},
183185

0 commit comments

Comments
 (0)