Replies: 5 comments 3 replies
-
I really like the "Typing Affinity" feature in Bike Outliner which can precise control the caret at boundary, so we can insert text at the begining of a Link, which can't be done for most of the rich text editor nowadays. SaveTwitter.Net_1649593165131943936.450p.mp4video from @JohannesMutter at Twitter I want to make something like that with Lexical, for example put the caret at the beginning of a Bold text, then type any text can be bold. But I found some trouble, when I make a button to call the function But after I click the button and then typing some text, the insert text belong to the previous text node, not the Bold Text Node. I think some normalization be applied when Lexical update under the hood, to change the selection offset from It's the browser default behavior? Can we hack to change this behavior? |
Beta Was this translation helpful? Give feedback.
-
The same situation for canInsertTextBefore(): false {
return false;
}
canInsertTextAfter(): false {
return false;
} Even if I use the methods |
Beta Was this translation helpful? Give feedback.
-
finally, make it also work with DecoratorNode CustomLinkNode.mp4 |
Beta Was this translation helpful? Give feedback.
-
I use the Nuxt (which is based on Vue 3) to build this prototype, and refer to two resources:
and also check this simple example |
Beta Was this translation helpful? Give feedback.
-
More details about this method Moving the cusor in-or-out the nest editor by pressing the ArrowLeft or ArrowRight key mostly can rely on the browser default behavior, so you can just set a higher priority command Tip you can use But moving up and down seems breakdown, the browser default behavior don't work well, maybe the nest editor trap the cursor. So I make a small trick, by register two commands, the Tip using frontend framework, like React or Vue, can easily toggle the state of |
Beta Was this translation helpful? Give feedback.
-
Implementing text insertion at node boundaries can be a challenging task for a rich text editor, I find a tweet relative to this problem, and want to figure out how to use Lexical to solve it.
And I find a pull requests #3434 relative to this problem, and the idea is fantastic!
I believe this "virtual cursor" concept can be applied to more scenarios involving node boundaries. For example, it can be used to add text before or after nodes like
LinkNode
andCodeNode
, or prepend text to formattedTextNode
.Beta Was this translation helpful? Give feedback.
All reactions