Skip to content
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

Update view API after changes in the model #4222

Closed
pjasiun opened this issue Dec 19, 2017 · 0 comments · Fixed by ckeditor/ckeditor5-engine#1296
Closed

Update view API after changes in the model #4222

pjasiun opened this issue Dec 19, 2017 · 0 comments · Fixed by ckeditor/ckeditor5-engine#1296
Labels
package:engine type:improvement This issue reports a possible enhancement of an existing feature.
Milestone

Comments

@pjasiun
Copy link

pjasiun commented Dec 19, 2017

The only proper way of changing model will be now the model writer in the change block.

From time to time we have a problem with render being not synchronized (see https://github.com/ckeditor/ckeditor5-engine/issues/654#issuecomment-332188800 or https://github.com/ckeditor/ckeditor5-engine/issues/1148). We can solve it in the same way, introducing view.change block (see the draft here https://gist.github.com/pjasiun/74b5c4e22b2c60ec17d82918a9663fd0#file-engine-js-L124-L136). Model to view conversion should be done in this block as well as any other view modification. When all changes are done and there are changes in the renderer, view document should be rendered.

view.change should be the only way to get view writer. It should be changed to the class instead of a set of function. It should get all methods to modify the view tree, similar to the model writer, including attributes changes and selection. View writer API should be similar to the model writer with the exception that view writer does not need batches.

At the same time, we should consider splitting view and the document. Making view a general controller of the view and the document focused on what is rendered.

@szymonkups szymonkups self-assigned this Jan 11, 2018
pjasiun referenced this issue in ckeditor/ckeditor5-engine Feb 16, 2018
Other: Refactoring of the view API. Closes #1210.

BREAKING CHANGE: `view.Writer` is no longer an object literal with functions but a class.
BREAKING CHANGE: View controller `view.View` is introduced. Changes to the view document tree structure should be done by using writer provided to callback in `view.change()` method.
BREAKING CHANGE: View document is now separated from the DOM. `view.Renderer`, `view.DomConverter` and observers are moved to `view.View`. 
BREAKING CHANGE: `view#event:render` is introduced to indicate a moment when all changes are applied and document may be rendered to the DOM.
BREAKING CHANGE: Downcast converter helpers no longer accepts view elements instances as constructors are now protected. Callbacks using view writer should be used.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 14 milestone Oct 9, 2019
@mlewand mlewand added module:view type:improvement This issue reports a possible enhancement of an existing feature. package:engine labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:engine type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants