-
Notifications
You must be signed in to change notification settings - Fork 18
t/152: Implemented FloatingToolbarView and Template.revert() #156
Conversation
…mented Template#revert()
…d as an argument.
* | ||
* @extends module:ui/toolbar/toolbarview~ToolbarView | ||
*/ | ||
export default class FloatingToolbarView extends ToolbarView { |
There was a problem hiding this comment.
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.
- It fixes that it must be toolbar what floats and nothing more. What if we'd like to add one more element to it?
- 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.
…w styles instead.
src/editableui/editableuiview.js
Outdated
* @observable | ||
* @member {Boolean} #isRendered | ||
*/ | ||
this.set( 'isRendered', !editableElement ); |
There was a problem hiding this comment.
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}. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 ) { |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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 ) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this private?
Not much to say here. I found some naming and docs issues. Other than that, I'm a bit worried about the In general, are you happy with the stability of apply + remove? Or is it a piece we'll need to polish in the future? |
I'm quite happy with how And, yes, |
Other: Fixed import paths after [refactoring in ckeditor5-ui](ckeditor/ckeditor5-ui#156). Closes #83.
Other: Fixed import paths after [refactoring in ckeditor5-ui](ckeditor/ckeditor5-ui#156). Closes #52.
I've just noticed that there's no manual test for the floating panel. |
Proposed merge commit message
Feature: Implemented FloatingToolbarView, Implemented Template.revert(). Closes ckeditor/ckeditor5#5308.
TODO The above message may be outdated. Verify it!