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

t/152: Implemented FloatingToolbarView and Template.revert() #156

Merged
merged 29 commits into from
Mar 7, 2017
Merged

Conversation

oleq
Copy link
Member

@oleq oleq commented Feb 3, 2017

Proposed merge commit message

Feature: Implemented FloatingToolbarView, Implemented Template.revert(). Closes ckeditor/ckeditor5#5308.

TODO The above message may be outdated. Verify it!

@oleq oleq changed the title Feature: Implemented FloatingToolbarView, Implemented Template.revert(). Closes #152. t/152: Implemented FloatingToolbarView and Template.revert() Feb 3, 2017
*
* @extends module:ui/toolbar/toolbarview~ToolbarView
*/
export default class FloatingToolbarView extends ToolbarView {
Copy link
Member

Choose a reason for hiding this comment

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

I've got doubts about this class.

  1. It fixes that it must be toolbar what floats and nothing more. What if we'd like to add one more element to it?
  2. It fixes that the floating toolbar must be floating in this specific way. "Floating" is just a behaviour and we have at least two floating toolbars already.

This behaviour should rather be implemented similarly to the contextual toolbar – as a container for whatever you want to have inside. Just like the balloon.

* @observable
* @member {Boolean} #isRendered
*/
this.set( 'isRendered', !editableElement );
Copy link
Member

Choose a reason for hiding this comment

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

Kinda misleading name, considering the description. You can do better than that :P


/**
* A default set of positioning functions used by the panel view to float
* around {@link targetElement}.
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect link. Please run gulp docs and fix the errors.

*
* Positioning functions must be compatible with {@link module:utils/dom/position~Position}.
*
* @member {Object} module:ui/floatingpanel/floatingpanelview~FloatingPanelView#defaultPositions
Copy link
Member

Choose a reason for hiding this comment

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

This is a static property so .defaultPositions not #defaultPositions.

Also, don't link to protected properties from public ones. (_updatePosition).

src/template.js Outdated
*
* @protected
* @readonly
* @member {module:ui/template~RenderConfig#renderData}
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect notation.

src/template.js Outdated
* Reverts a template {@link module:ui/template~Template#apply applied} to an existing DOM Node.
*
* @param {Node} node Root node for the template to revert. Must be the same node
* that {@link module:ui/template~Template#apply} has used.
Copy link
Member

Choose a reason for hiding this comment

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

Must be the same node?

src/template.js Outdated
* that {@link module:ui/template~Template#apply} has used.
*/
revert( node ) {
if ( !node ) {
Copy link
Member

Choose a reason for hiding this comment

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

No point in checking this.

src/template.js Outdated
throw new CKEditorError( 'ui-template-revert-not-applied: Attempting reverting a template which has not been applied yet.' );
}

this._revertNode( node, this._revertData );
Copy link
Member

Choose a reason for hiding this comment

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

You do not revert a node. You remove the template from the node or revert template application from node.

src/template.js Outdated
*/
_renderNode( applyNode, intoFragment ) {
_renderNode( config ) {
Copy link
Member

Choose a reason for hiding this comment

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

We rather tend to call such state objects "data".

src/template.js Outdated
/**
* The {@link module:ui/template~Template#_renderNode} config.
*
* @interface module:ui/template~RenderConfig
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this private?

@Reinmar
Copy link
Member

Reinmar commented Mar 2, 2017

Not much to say here. I found some naming and docs issues. Other than that, I'm a bit worried about the Template size and amount of functionality which it brings. Fortunately, it's a simple (i.e. small) piece of API so there's little impact on the rest of the project if we'll need to work on the internals.

In general, are you happy with the stability of apply + remove? Or is it a piece we'll need to polish in the future?

@oleq
Copy link
Member Author

oleq commented Mar 7, 2017

I'm quite happy with how revert() works. It passes tests and works for the particular use case. Besides, it's not gonna be a piece of API which is used very often.

And, yes, Template will need to be split sooner or later into text renderer, element renderer, attribute renderer, etc. Template, much shorter than it is at this moment, would then only glue the pieces and give the nice API to the world.

@Reinmar Reinmar merged commit cb606d7 into master Mar 7, 2017
@Reinmar Reinmar deleted the t/152 branch March 7, 2017 17:59
Reinmar added a commit to ckeditor/ckeditor5-link that referenced this pull request Mar 7, 2017
Other: Fixed import paths after [refactoring in ckeditor5-ui](ckeditor/ckeditor5-ui#156). Closes #83.
Reinmar added a commit to ckeditor/ckeditor5-image that referenced this pull request Mar 7, 2017
Other: Fixed import paths after [refactoring in ckeditor5-ui](ckeditor/ckeditor5-ui#156). Closes #52.
@Reinmar
Copy link
Member

Reinmar commented Mar 7, 2017

I've just noticed that there's no manual test for the floating panel.

@oleq
Copy link
Member Author

oleq commented Mar 8, 2017

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.

API extension and improvements for editor-inline
2 participants