-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Decorator ref system #1120
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/fbopensource/lexical/9C3xWbjF2LF9B5ZY2QDC2mNmnRAB |
I think I understand the idea. I would appreciate it if you could do us a walkthrough the code, especially around the NestedEditor and CollaborationPlugin bits to be able to properly review this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me but obv would like someone with more experience to actually approve. Had a bunch of questions as I read through
<MentionsPlugin /> | ||
<TablesPlugin /> | ||
<TableCellActionMenuPlugin /> | ||
<ImagesPlugin /> | ||
<LinkPlugin /> | ||
<EmojisPlugin /> | ||
<HashtagsPlugin /> | ||
<KeywordsPlugin /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we 'inherit' plugins from the outer editor? (is that desirable, is it possible, etc). Just thinking about divergence in plugin support between the 'main' editor and the caption editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that's too desirable as it makes things less explicit and more magical. It should be clear what plugins are being used and which ones are not. Inheriting plugins blurs that someone.
General question regarding decoratorMap: are values can only be primitives or it can be a nested map/array but it just won't be resolved granularly (recursively) between clients, and latest update will rewrite whole value? |
I had the same thought - I think a walkthrough would be great. I think I get the intent, overall, though. |
@fantactuka only primitive values because of JSON/collab. You can nest DecoratorMap inside DecoratorMap, and once I add DecoratorList, that too. I'll need to wire up the parts more for collab, so you can look at this PR to not be definitive. More PRs to go! |
If anyone would like me to walk through this with them (I already did with Gerard) please schedule some time in my calendar to do so :) |
Scheduled some time tomorrow morning, if anyone else is interested - lmk I'll add to the invite |
@fantactuka would appreciate being added to that invite! |
* Refactor Decorator ref system * Fix typo * Address feedback * Address feedback
This removes the current
ref
system for Decorators and replaces it with aDecoratorState
system. Specifically, (for now at least), we have two types ofDecoratorState
-DecoratorEditor
andDecoratorMap
. This integrates these data structures into the existing implementations, both locally and for collaboration.A follow up PR could introduce the
DecoratorList
data structure.