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

Moving render calls out of EditorUIView constructors #1150

Closed
alexeckermann opened this issue Jul 12, 2018 · 6 comments
Closed

Moving render calls out of EditorUIView constructors #1150

alexeckermann opened this issue Jul 12, 2018 · 6 comments

Comments

@alexeckermann
Copy link

Other - Comment/Feedback

A problem arose when I was testing the alexeckermann/ckeditor5-emptyness plugin where I wanted to extend the editors view template to bind a class name to a property.

The initial implementation passed with the ClassicEditor as the test case. However, when subsequently integrated into a project using a BalloonEditor it hit a wall because the plugin couldn't call to extend a template that was already rendered.

In debugging I came across an inconsistency which explained why the classic editor passed and why the balloon editor didn't. The classic editor does not call any methods in its constructor that render the InlineEditableUIView instance. That, the ClassicEditorUIView defers calls to add a child view until its own render is called.

BalloonEditorUIView, InlineEditorUIView, and DecoupledEditorUIView all call registerChild with the InlineEditableUIView in their constructor.

Is it possible that any child view (or specifically editable views) rendering is moved to render and not called in scope of constructor?

I suspect there may be some wider ramifications of such a change I may not be aware of, so I'm raising it for comment/feedback.

@Reinmar
Copy link
Member

Reinmar commented Jul 12, 2018

cc @oleq @oskarwrobel @jodator

@oleq
Copy link
Member

oleq commented Jul 12, 2018

Sounds like a good idea to me. I hope what we have ATM (like registering children in the constructor) is purely accidental.

@alexeckermann
Copy link
Author

Fantastic.

If theres no class depending on a views element being available in that scope and placing registerChild in render is appropriate then it could be ok to move.

In a basic test on my local development environment I moved registerChild to render in the balloon editor with passing automated and manual tests. If that is acceptable then maybe I can go ahead and start some PRs?

@oleq
Copy link
Member

oleq commented Jul 17, 2018

If that is acceptable then maybe I can go ahead and start some PRs?

Sure, you're welcome! 👍

@oleq oleq added this to the iteration 20 milestone Jul 18, 2018
@oleq oleq added type:improvement This issue reports a possible enhancement of an existing feature. status:confirmed and removed package:ui labels Jul 18, 2018
oleq added a commit to ckeditor/ckeditor5-editor-decoupled that referenced this issue Jul 26, 2018
Internal: Ensured the `DecoupledEditorUIView` is rendered correctly and its children are added in `#render()` instead of `#constructor()` (see ckeditor/ckeditor5#1150).

Huge thanks to [Alex Eckermann](https://github.com/alexeckermann) for this contribution!
oleq added a commit to ckeditor/ckeditor5-editor-balloon that referenced this issue Jul 26, 2018
Internal: Ensured the `BalloonEditorUIView` is rendered correctly and its children are added in `#render()` instead of `#constructor()` (see ckeditor/ckeditor5#1150).

Huge thanks to [Alex Eckermann](https://github.com/alexeckermann) for this contribution!
@oleq
Copy link
Member

oleq commented Jul 26, 2018

Huge 👏 for your contribution, @alexeckermann!

@alexeckermann
Copy link
Author

🍻 Cheers @oleq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants