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

Make the Mapper in the DataController usable outside the conversion scope #4345

Closed
CHItA opened this issue Apr 27, 2018 · 4 comments · Fixed by ckeditor/ckeditor5-engine#1507
Labels
package:engine type:improvement This issue reports a possible enhancement of an existing feature.
Milestone

Comments

@CHItA
Copy link

CHItA commented Apr 27, 2018

The purpose of this change would be to make it possible to use the Mapper in the DataController outside the conversion phase (in my specific case, it would be in a DataProcessor implementation).

Moving the this.mapper.clearBindings() lines to the beginning of the toView() method would make this possible, and hopefully would not conflict with how the editor would behave. I have not tested this solution, therefore the actual solution to the problem could be more difficult.

To create an issue came up in the answer of this question on stackoverflow, and the question contains a more detailed explanation of why I would need this feature.

@pjasiun
Copy link

pjasiun commented Apr 30, 2018

It is not recommended to use mapper and model in DataProcessor . It breaks layers separation: data controller should convert between data and view. If any data from the model is needed it should be converted to view earlier.

However, the change you propose looks good. It will be safer for the next conversion to clear bindings at the beginning, and it will let people read mapper biding after the conversion, what, in some cases, is fine.

@CHItA
Copy link
Author

CHItA commented Apr 30, 2018

I'm aware that it is not recommended to use the model, however, it is the best solution to my problem that I was able to come up with. Regardless, this change would help my use case, and if it is unlikely to cause problems for others or more conventional use cases of the editor then I think it would be a good addition to the engine.

@pjasiun
Copy link

pjasiun commented Apr 30, 2018

Sure, this is why I said that I'm fine with it :)

@CHItA
Copy link
Author

CHItA commented Apr 30, 2018

Yeah, I understood, I just felt the need to add the standard disclaimer that I know you don't recommend doing what I'm doing (although I probably should start with that with all my CKE5 questions). :)

scofalik referenced this issue in ckeditor/ckeditor5-engine Aug 24, 2018
Other: Allowed using `Mapper` outside the conversion scope. Closes #1415.

Thanks to [Mate Bartus](https://github.com/CHItA) for this contribution!
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 20 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed 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