Implement track changes #4707
-
Hi, I am new to lexical editor and I am trying to implement track changes in lexical editor. But I am not sure how to wrap the character typed by the user. If the user type a character then it should be wrapped in a span tag with class name inserted. I created plugin to create a span element but not sure how to replace the character with the created element in the editor. Can someone give me suggestion on how to implement this efficiently ? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
Have you figured it out? If not the CharacterLimitPlugin from the playground might help which basically does the same, only wrapping characters (or text) which is longer than allowed and then instead of wrapping deleted it unwraps Also interesting idea actually, maybe I'm going to use something similar at least for galleries and such 🤔 |
Beta Was this translation helpful? Give feedback.
-
Hi @Shiva804 . Did you have any joy implementing this feature? I am also looking to develop this same functionality in Lexical, and have struggled to find any examples of this having been implemented. |
Beta Was this translation helpful? Give feedback.
-
I think Im already done this or same thing. e.g. base priority is 0 or 1, my registered listener has 2 |
Beta Was this translation helpful? Give feedback.
-
https://github.com/Ramnath-Karthikesan/lexical-track-changes I've implemented a basic version of track changes in the Lexical Editor. While this approach has some bugs and efficiency issues , contributions to improve the track changes feature in Lexical would be greatly appreciated. The concept involves creating two nodes, one for insertion and one for deletion, inspired by the structure of the link node in Lexical. A custom plugin is then developed to listen for specific operations such as KEY_DOWN_COMMAND and KEY_BACKSPACE_COMMAND. Based on the current user selection, the plugin executes the node insertion or deletion operation. |
Beta Was this translation helpful? Give feedback.
-
For anyone seeking alternative, I made a package lexical-review which customize |
Beta Was this translation helpful? Give feedback.
https://github.com/Ramnath-Karthikesan/lexical-track-changes
I've implemented a basic version of track changes in the Lexical Editor. While this approach has some bugs and efficiency issues , contributions to improve the track changes feature in Lexical would be greatly appreciated.
The concept involves creating two nodes, one for insertion and one for deletion, inspired by the structure of the link node in Lexical. A custom plugin is then developed to listen for specific operations such as KEY_DOWN_COMMAND and KEY_BACKSPACE_COMMAND. Based on the current user selection, the plugin executes the node insertion or deletion operation.