Open mark7651 opened 11 months ago
I'm trying to insert emoji into Quiil editor, but there is a error:
Failed to execute 'setStart' on 'Range': The offset 4294967295 is larger than the node's length (1).
Current code: onSelectEmoji(emoji) { if (this.editor) { const selection = this.editor.getSelection(); if (selection) { const lastIndex = selection.index || 0; const contentLength = this.editor.getLength(); console.log(contentLength); if (lastIndex >= 0 && lastIndex <= contentLength) { this.editor.insertText(lastIndex, emoji.i); this.editor.setSelection(lastIndex + emoji.u.length); } } this.toggleDialogEmoji(); } },
resolved?
I'm trying to insert emoji into Quiil editor, but there is a error:
Failed to execute 'setStart' on 'Range': The offset 4294967295 is larger than the node's length (1).
Current code: onSelectEmoji(emoji) { if (this.editor) { const selection = this.editor.getSelection(); if (selection) { const lastIndex = selection.index || 0; const contentLength = this.editor.getLength(); console.log(contentLength); if (lastIndex >= 0 && lastIndex <= contentLength) { this.editor.insertText(lastIndex, emoji.i); this.editor.setSelection(lastIndex + emoji.u.length); } } this.toggleDialogEmoji(); } },