Catrope has uploaded a new change for review. https://gerrit.wikimedia.org/r/130803
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(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/03/130803/1 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/130803 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2a3fa78b07dadd31963ff716339da5f7b75ff157 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: wmf/1.24wmf2 Gerrit-Owner: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Esanders <esand...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits