Catrope has uploaded a new change for review.
https://gerrit.wikimedia.org/r/176158
Change subject: Followup 166a52b: don't disable tools that don't have commands
......................................................................
Followup 166a52b: don't disable tools that don't have commands
Using null and undefined to mean different things is ugly,
but I can't think of a better way to get us out of this mess
quickly right now.
Bug: T75965
Change-Id: I5344821ad36c8689c6c0d70e50ac0b3fcf599711
---
M src/ui/ve.ui.Tool.js
1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/58/176158/1
diff --git a/src/ui/ve.ui.Tool.js b/src/ui/ve.ui.Tool.js
index b071c77..4e490be 100644
--- a/src/ui/ve.ui.Tool.js
+++ b/src/ui/ve.ui.Tool.js
@@ -67,7 +67,9 @@
*/
ve.ui.Tool.prototype.onUpdateState = function ( fragment ) {
var command = this.getCommand();
- this.setDisabled( !command || ( fragment && !command.isExecutable(
fragment ) ) );
+ if ( command !== null ) {
+ this.setDisabled( !command || ( fragment &&
!command.isExecutable( fragment ) ) );
+ }
};
/**
@@ -86,8 +88,11 @@
/**
* Get the command for this tool.
*
- * @return {ve.ui.Command|undefined}
+ * @return {ve.ui.Command|null|undefined} Undefined means command not found,
null means no command set
*/
ve.ui.Tool.prototype.getCommand = function () {
+ if ( this.constructor.static.commandName === null ) {
+ return null;
+ }
return ve.ui.commandRegistry.lookup(
this.constructor.static.commandName );
};
--
To view, visit https://gerrit.wikimedia.org/r/176158
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5344821ad36c8689c6c0d70e50ac0b3fcf599711
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits