-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Allowed to easily set, change, save and load root attributes #13759
Conversation
…fer`. Root attribute changes will be returned in `Differ#getChangedRoots()`.
…)`, `MultiRootEditor#getRootsAttributes()` and `EditorConfig#rootAttributes`. Internal (editor-multi-root): `MultiRootEditor#addRoot()` has a new option `attributes`.
…ier moment to prevent creating DOM elements for the editor UI + minor internal improvements.
… while adding roots.
oh that's great that you are addressing this too! |
Will this sync attributes set via dom using mutation observer? |
This solution is for attributes understood as, hm, roots metadata (additional model root data). You can write converters to convert these roots attributes from model to view and then DOM. We will probably write such guide at some point. But in general, the flow should be:
Automatic sync through mutation observer in a way that you described (DOM -> model) is against the philosophy of how CKE5 works. Instead, the changes should be done on model and be propagated downwards to DOM. You can introduce a custom UI or any other method to change model roots attributes, but the propagation should always be model -> view -> DOM. |
Is it true now? I remember it was not possible before, for one reason or another it didn't really work. I remember filed issue on that, and i stumbled upon that myself too.
You are right. I think i was confused about some other part that relied on syncing changes from the dom, but perhaps it was selection or something like that. Either way it doesn't matter. |
I think it is difficult currently, as root attributes changes were not buffered in |
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.
LGTM. Only minor comments.
|
Suggested merge commit message (convention)
Other (engine):
RootAttributeOperation
is now correctly handled byDiffer
. Root attribute changes will be returned inDiffer#getChangedRoots()
.Internal (editor-multi-root): Introduced API to easily save and load root attributes. Introduced
EditorConfig#rootsAttributes
andMultiRootEditor#getRootsAttributes()
. Closes #13395.Internal (editor-multi-root): Introduced
MultiRootEditor#getFullData()
. The method returns document data for all roots in multi-root editor.Internal (editor-multi-root):
MultiRootEditor#addRoot()
has a new optionattributes
.Internal (engine):
model.Writer#detachRoot()
will now remove attributes from the detached root.Additional information
Most things as internal because the changes will be in the changelog as "introduced multi-root editor type".
See #13395 (comment) for summary of proposed solution.