Created
December 31, 2019 19:01
-
-
Save amiri/cfe000358ad0efec906e00c38a7c136d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const findLastWord = (editor) => { | |
console.log(editor.selection); | |
Transforms.move(editor, { distance: 1, unit: 'word', reverse: true, edge: 'start' }) | |
console.log(editor.selection); | |
const selected = Editor.string(editor, editor.selection); | |
console.log(selected); | |
Transforms.move(editor, {distance: 2, unit: 'word', edge: 'start'}); | |
editor.insertText(' '); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment