Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

T/262: Implemented View#render method #332

Merged
merged 45 commits into from
Nov 2, 2017
Merged

T/262: Implemented View#render method #332

merged 45 commits into from
Nov 2, 2017

Conversation

oleq
Copy link
Member

@oleq oleq commented Oct 24, 2017

Suggested merge commit message (convention)

Other: Implemented View#render method which replaces the #element rendering upon the first reference and incorporates the #init method functionality. Closes ckeditor/ckeditor5#5384. Closes ckeditor/ckeditor5#5403.

From now on View#setTemplate and View#extendTemplate methods are recommended as a shorthand for view.template = new Template( { ... } ) and Template.extend( view.template ).

BREAKING CHANGE: The init() method in various UI components has been renamed to render(). Please refer to the documentation to learn more.

BREAKING CHANGE: The View#element is no longer a getter which renders an element when first referenced. Use the View#render() method instead.

BREAKING CHANGE: Template#children property became an Array (previously ViewCollection).

BREAKING CHANGE: View#addChildren and View#removeChildren methods became #registerChildren and #deregisterChildren.

BREAKING CHANGE: The DOM structure of the StickyPanelView has changed along with the class names. Please refer to the component documentation to learn more.


Additional information

This PR comes with a branch constellation centralized in https://github.com/ckeditor/ckeditor5/tree/t/ckeditor5-ui/262:

Merge commit message for related branches:

Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5#5384).

Misc

…named addChildren(), removeChildren() -> registerChildren(), deregisterChildren().
…te#children (ViewCollection->Array). Implemented Template#getViews() generator.
…in the component to wrap it in a single #element.
@oleq oleq requested a review from oskarwrobel October 24, 2017 14:52

return new Promise( ( resolve, reject ) => {
deferred = { resolve, reject };
} );
Copy link
Contributor

@oskarwrobel oskarwrobel Oct 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just

render() {
    return new Promise( resolve => {
        this.on( 'loaded', resolve );
        super.render();
    } ) ;
}

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If tests are passing, I think it is the right way to render an IframeView

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant: you're probably right 😋

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works fine but I think we don't need to resolve this promise outside of the promise scope. deferred variable doesn't have too much sense here. But it's a detail :)

@oskarwrobel
Copy link
Contributor

oskarwrobel commented Oct 27, 2017

It's worth to mention about View#setTemplate and View#extendTemplate methods in commit message.

@oskarwrobel
Copy link
Contributor

https://github.com/ckeditor/ckeditor5-utils/compare/t/ckeditor5-ui/262?expand=1#diff-b7a0ddd6b2b22f178c9c2e5bbf8fac34R7 - should be isdomnode

Copy link
Contributor

@oskarwrobel oskarwrobel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests works 👌 (manual and unit). The code looks good as well. I've only found a few some really minor issues.

@oleq
Copy link
Member Author

oleq commented Oct 31, 2017

FYI: I've just pushed the fixes to the branches.

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

Successfully merging this pull request may close these issues.

[Tests] Broken image toolbar manual test Should first call of view.element render view.template?
2 participants