Cscott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/230973
Change subject: Make ve.ui.MWLinkAction extend ve.ui.LinkAction
......................................................................
Make ve.ui.MWLinkAction extend ve.ui.LinkAction
Also overrides ve.ui.LinkAction.getLinkAnnotation so that autolinks
use the proper ve.ui.MWExternalLinkAnnotation type.
This is a follow-up to I21976ce0cc823af29bdd2a5c163476fea2408488 in
the VE repo.
Change-Id: I934f76158512e2e89b614ed92fef6481f70728e7
---
M modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
M modules/ve-mw/ui/tools/ve.ui.MWLinkInspectorTool.js
2 files changed, 18 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/73/230973/1
diff --git a/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
b/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
index 2d955b0..8c42cc9 100644
--- a/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
+++ b/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
@@ -16,16 +16,14 @@
*/
ve.ui.MWLinkAction = function VeUiMWLinkAction( surface ) {
// Parent constructor
- ve.ui.Action.call( this, surface );
+ ve.ui.MWLinkAction.super.call( this, surface );
};
/* Inheritance */
-OO.inheritClass( ve.ui.MWLinkAction, ve.ui.Action );
+OO.inheritClass( ve.ui.MWLinkAction, ve.ui.LinkAction );
/* Static Properties */
-
-ve.ui.MWLinkAction.static.name = 'mwlink';
/**
* List of allowed methods for the action.
@@ -33,11 +31,25 @@
* @static
* @property
*/
-ve.ui.MWLinkAction.static.methods = [ 'open' ];
+ve.ui.MWLinkAction.static.methods =
ve.ui.MWLinkAction.super.static.methods.concat( [ 'open' ] );
/* Methods */
/**
+ * @method
+ * @inheritdoc
+ * @return {ve.dm.MWExternalLinkAnnotation} The annotation to use.
+ */
+ve.ui.MWLinkAction.prototype.getLinkAnnotation = function ( href ) {
+ return new ve.dm.MWExternalLinkAnnotation( {
+ type: 'link',
+ attributes: {
+ href: href
+ }
+ } );
+};
+
+/**
* Open either the 'link' or 'linkNode' window, depending on what is selected.
*
* @method
diff --git a/modules/ve-mw/ui/tools/ve.ui.MWLinkInspectorTool.js
b/modules/ve-mw/ui/tools/ve.ui.MWLinkInspectorTool.js
index 181605a..e41f1d3 100644
--- a/modules/ve-mw/ui/tools/ve.ui.MWLinkInspectorTool.js
+++ b/modules/ve-mw/ui/tools/ve.ui.MWLinkInspectorTool.js
@@ -38,6 +38,6 @@
ve.ui.commandRegistry.register(
new ve.ui.Command(
- 'link', 'mwlink', 'open', { supportedSelections: [ 'linear' ] }
+ 'link', 'link', 'open', { supportedSelections: [ 'linear' ] }
)
);
--
To view, visit https://gerrit.wikimedia.org/r/230973
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I934f76158512e2e89b614ed92fef6481f70728e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits