Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/273583
Change subject: VE: Lookup the correct command for the node
......................................................................
VE: Lookup the correct command for the node
Bug: T128198
Change-Id: I564b0b3e8cf6906d108ee876cff03196065bd164
---
M modules/ve-cite/ve.ce.MWReferenceNode.js
M modules/ve-cite/ve.ui.MWReference.init.js
2 files changed, 20 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cite
refs/changes/83/273583/1
diff --git a/modules/ve-cite/ve.ce.MWReferenceNode.js
b/modules/ve-cite/ve.ce.MWReferenceNode.js
index 8cd455c..bc1e5b9 100644
--- a/modules/ve-cite/ve.ce.MWReferenceNode.js
+++ b/modules/ve-cite/ve.ce.MWReferenceNode.js
@@ -62,8 +62,6 @@
/**
* Handle setup event.
- *
- * @method
*/
ve.ce.MWReferenceNode.prototype.onSetup = function () {
ve.ce.MWReferenceNode.super.prototype.onSetup.call( this );
@@ -72,8 +70,6 @@
/**
* Handle teardown event.
- *
- * @method
*/
ve.ce.MWReferenceNode.prototype.onTeardown = function () {
// As we are listening to the internal list, we need to make sure
@@ -88,7 +84,6 @@
*
* This will occur after a document transaction.
*
- * @method
* @param {string[]} groupsChanged A list of groups which have changed in this
transaction
*/
ve.ce.MWReferenceNode.prototype.onInternalListUpdate = function (
groupsChanged ) {
@@ -99,9 +94,25 @@
};
/**
- * Handle update events.
- *
- * @method
+ * Update the rendering
+ */
+ve.ce.MWReferenceNode.prototype.executeCommand = function () {
+ var command, contextItem,
+ items = ve.ui.contextItemFactory.getRelatedItems( [ this.model
] );
+
+ if ( items.length ) {
+ contextItem = ve.ui.contextItemFactory.lookup( items[ 0 ].name
);
+ if ( contextItem ) {
+ command = ve.init.target.commandRegistry.lookup(
contextItem.static.commandName );
+ if ( command ) {
+ command.execute(
this.focusableSurface.getSurface() );
+ }
+ }
+ }
+};
+
+/**
+ * Update the rendering
*/
ve.ce.MWReferenceNode.prototype.update = function () {
var group = this.model.getGroup();
diff --git a/modules/ve-cite/ve.ui.MWReference.init.js
b/modules/ve-cite/ve.ui.MWReference.init.js
index f92adef..8ac6f25 100644
--- a/modules/ve-cite/ve.ui.MWReference.init.js
+++ b/modules/ve-cite/ve.ui.MWReference.init.js
@@ -76,7 +76,7 @@
try {
// Must use mw.message to avoid JSON being parsed as
Wikitext
tools = JSON.parse( mw.message(
'visualeditor-cite-tool-definition.json' ).plain() );
- } catch ( e ) { }
+ } catch ( e ) {}
if ( Array.isArray( tools ) ) {
for ( i = 0, len = Math.min( limit, tools.length ); i <
len; i++ ) {
--
To view, visit https://gerrit.wikimedia.org/r/273583
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I564b0b3e8cf6906d108ee876cff03196065bd164
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits