Problem quill.getSelection() versi 2.0.2 #4478
Unanswered
Azlan-saja
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
version 1.3.7 works.
But version 2.0.2 doesn't work.
const range = quill.getSelection();
if (range) {
if (range.length == 0) {
console.log('User cursor is at index', range.index);
} else {
const text = quill.getText(range.index, range.length);
console.log('User has highlighted: ', text);
}
} else {
console.log('User cursor is not in editor');
}
the problem is in quill.getSelection()
Uncaught TypeError: Cannot read properties of null (reading 'offset')
at selection.ts:283:26
at Array.map ()
at Proxy.normalizedToRange (selection.ts:279:31)
at Proxy.getRange (selection.ts:260:24)
at Proxy.update (selection.ts:439:43)
at Proxy.setRange (selection.ts:434:10)
at Proxy.focus (selection.ts:147:10)
at Proxy.focus (quill.ts:338:20)
at Proxy.getSelection (quill.ts:535:21)
at app.js:219:40
Beta Was this translation helpful? Give feedback.
All reactions