jenkins-bot has submitted this change and it was merged. Change subject: Move toolbar updateState code into separate method ......................................................................
Move toolbar updateState code into separate method So that it can be called on intialize without a contextChange. Change-Id: I2a3fa78b07dadd31963ff716339da5f7b75ff157 --- M modules/ve/ui/ve.ui.Toolbar.js 1 file changed, 10 insertions(+), 1 deletion(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ve/ui/ve.ui.Toolbar.js b/modules/ve/ui/ve.ui.Toolbar.js index 8d99a8e..d904ad9 100644 --- a/modules/ve/ui/ve.ui.Toolbar.js +++ b/modules/ve/ui/ve.ui.Toolbar.js @@ -156,6 +156,13 @@ * @fires updateState */ ve.ui.Toolbar.prototype.onContextChange = function () { + this.updateToolState(); +}; + +/** + * Update the state of the tools + */ +ve.ui.Toolbar.prototype.updateToolState = function () { var i, len, leafNodes, dirInline, dirBlock, fragmentAnnotation, fragment = this.surface.getModel().getFragment( null, false ), nodes = []; @@ -166,8 +173,8 @@ nodes.push( leafNodes[i].node ); } } - // Update context direction for button icons UI + // Update context direction for button icons UI // by default, inline and block directions are the same if ( !fragment.isNull() ) { dirInline = dirBlock = this.surface.getView().documentView.getDirectionFromRange( fragment.getRange() ); @@ -254,6 +261,8 @@ 'floating': false, 'offset': this.elementOffset } ); + // Initial state + this.updateToolState(); if ( this.floatable ) { this.$window.on( this.windowEvents ); -- To view, visit https://gerrit.wikimedia.org/r/129806 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2a3fa78b07dadd31963ff716339da5f7b75ff157 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits