How do I implement comments in Lexical? #1839
-
A common requirement in many text editors is the ability to add and reply to comments/annotations that apply to a range of text. What is the best approach to do this using Lexical? Would I be extending Some background: implementing comments in ProsemirrorIn Prosemirror you can implement comments in one of two ways:
Both approaches have their pros and cons. You can find a number of threads discussing the tradeoffs. I am also interested to know if the same tradeoffs exist in Lexical?? Here is a very good thread that talks about these two approaches and the tradeoffs. Comments as Decorations:
Comments as Marks:
I'm curious to know if similar tradeoffs exist in Lexical or if there is a more opinionated way to achieve comment functionality. Thanks for open sourcing Lexical. Even with incomplete docs I've found Lexical easier to pick up than Prosemirror (which without exaggeration took me weeks to start feeling comfortable with). Great work! |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 12 replies
-
Exciting topic! @trueadm and @sereneinserenade are also exploring this space right now and there's some good discussion on the showcase group on Discord if you want to join the conversation. Later, we can maybe summarize the conversation here for historical purposes. |
Beta Was this translation helpful? Give feedback.
-
@stuburger Just for the reference, here's the Commenting-Solution I created using repo: https://github.com/sereneinserenade/lexical-comments |
Beta Was this translation helpful? Give feedback.
-
@trueadm Awesome, is the commenting code in the playground available online? |
Beta Was this translation helpful? Give feedback.
-
Yeah cool, is the sourcecode to the playground available into repo?
On Mon, 19 Dec 2022 at 8:57 pm, Dominic Gannaway ***@***.***> wrote:
Yep. If you checkout the playground you can make inline comments when
selecting some content or just post comments for the document
—
Reply to this email directly, view it on GitHub
<#1839 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEEYCMI4Z2VBA3J7ABJD43WOAWRDANCNFSM5TVNF5BA>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Chris Rickard
|
Beta Was this translation helpful? Give feedback.
-
Thanks!
…On Tue, Dec 20, 2022 at 2:39 AM Dominic Gannaway ***@***.***> wrote:
Yep it’s all in the GitHub repository you’re viewing. Just look for the
lexical-playground package
—
Reply to this email directly, view it on GitHub
<#1839 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEEYCPBHDA225QL6GY2PGDWOB6STANCNFSM5TVNF5BA>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Chris Rickard
|
Beta Was this translation helpful? Give feedback.
-
Hey @trueadm , I have been playing with the commenting code from the playground, and it works great, but I have a use case where I need to persist these comments and restore them on loading the page, so I have been trying to do by myself checking the lexical-yjs, more specifically this file SyncEditorStates.ts to follow how to restore the selection and then run the |
Beta Was this translation helpful? Give feedback.
@stuburger Just for the reference, here's the Commenting-Solution I created using
ElementNode
inspired byLinkNode
from Lexical.repo: https://github.com/sereneinserenade/lexical-comments
demo: https://sereneinserenade.github.io/lexical-comments/