Moving render calls out of EditorUIView constructors
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.
cc @oleq @oskarwrobel @jodator
Sounds like a good idea to me. I hope what we have ATM (like registering children in the constructor) is purely accidental.
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?
If that is acceptable then maybe I can go ahead and start some PRs?
Sure, you're welcome! 👍
Huge 👏 for your contribution, @alexeckermann!
🍻 Cheers @oleq