jenkins-bot has submitted this change and it was merged.
Change subject: CommandRegistry: Provide getNames method in command registry
......................................................................
CommandRegistry: Provide getNames method in command registry
Change-Id: I724a73738a23e07888cf24f674cb3ce5ab64d839
---
M src/ui/ve.ui.CommandRegistry.js
M src/ui/ve.ui.Surface.js
2 files changed, 13 insertions(+), 3 deletions(-)
Approvals:
Jforrester: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ui/ve.ui.CommandRegistry.js b/src/ui/ve.ui.CommandRegistry.js
index 1f795a1..4fbb20e 100644
--- a/src/ui/ve.ui.CommandRegistry.js
+++ b/src/ui/ve.ui.CommandRegistry.js
@@ -13,7 +13,7 @@
*/
ve.ui.CommandRegistry = function VeUiCommandRegistry() {
// Parent constructor
- OO.Registry.call( this );
+ ve.ui.CommandRegistry.super.apply( this, arguments );
};
/* Inheritance */
@@ -37,7 +37,8 @@
);
}
- OO.Registry.prototype.register.call( this, command.getName(), command );
+ // Parent method
+ ve.ui.CommandRegistry.super.prototype.register.call( this,
command.getName(), command );
};
/**
@@ -50,6 +51,15 @@
return this.lookup( node.constructor.static.primaryCommandName );
};
+/**
+ * Get a list of registered command names.
+ *
+ * @return {string[]}
+ */
+ve.ui.CommandRegistry.prototype.getNames = function () {
+ return Object.keys( this.registry );
+};
+
/* Initialization */
ve.ui.commandRegistry = new ve.ui.CommandRegistry();
diff --git a/src/ui/ve.ui.Surface.js b/src/ui/ve.ui.Surface.js
index bddfefb..8766821 100644
--- a/src/ui/ve.ui.Surface.js
+++ b/src/ui/ve.ui.Surface.js
@@ -44,7 +44,7 @@
this.commandRegistry = config.commandRegistry ||
ve.init.target.commandRegistry;
this.sequenceRegistry = config.sequenceRegistry ||
ve.init.target.sequenceRegistry;
this.commands = OO.simpleArrayDifference(
- config.includeCommands || Object.keys(
this.commandRegistry.registry ), config.excludeCommands || []
+ config.includeCommands || this.commandRegistry.getNames(),
config.excludeCommands || []
);
this.triggerListener = new ve.TriggerListener( this.commands,
this.commandRegistry );
if ( dataOrDoc instanceof ve.dm.Document ) {
--
To view, visit https://gerrit.wikimedia.org/r/276463
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I724a73738a23e07888cf24f674cb3ce5ab64d839
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits