-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
setBlock merge data option #3125
Comments
You could use existing data when setting the new, so as: Editor.setBlocks({ data: { ...existingData, alignment: 'left' } }) |
No I can't, that assumes that all the selected blocks have the same data. Currently I'm doing this:
However, it's worth noting that
It would be nice to have a |
Hi @timothyarmes, However, the first snippet you provided is the way consumers have been advised to handle data; you need to use the |
I believe that this may be fixed by #3093, which has changed a lot of the logic in Slate and |
feature
Editor.setBlocks({ data: { ... } -})
replaces the existing data with the new map.This makes is awkward for plugins to add/remove their own data without affecting other plugins. For example, I have in image plugin that sets the src, and an alignment plugin that sets the block's alignment.
When the alignment plugin tries to add its data using:
Editor.setBlocks({ data: { alignment: 'left' } })
the image src is lost.
The text was updated successfully, but these errors were encountered: