mediawiki-extensions-Visual.../modules/ve-mw/ui/tools/ve.ui.MWLinkInspectorTool.js
Ed Sanders 5c84f0cd88 Rewrite EducationPopup so it isn't a mixin
Reference images are moved to Cite and used by Citoid.

Bug: T170919
Bug: T171292
Depends-On: I02041246dda1b3d3ad1bcc0b014fa022e8259b62
Change-Id: Id97659ed1fa64a1223a8957fefaf2a149edd0e9c
2020-09-24 21:33:50 +01:00

66 lines
1.8 KiB
JavaScript

/*!
* VisualEditor UserInterface MediaWiki LinkInspectorTool classes.
*
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* UserInterface link tool. Overrides link tool from core.
*
* Works for both link annotations and link nodes, and fires the 'link' command
* which works for both as well.
*
* @class
* @extends ve.ui.LinkInspectorTool
*
* @constructor
* @param {OO.ui.ToolGroup} toolGroup
* @param {Object} [config] Configuration options
*/
ve.ui.MWLinkInspectorTool = function VeUiMwLinkInspectorTool() {
var educationPopup;
// Parent constructor
ve.ui.MWLinkInspectorTool.super.apply( this, arguments );
educationPopup = new ve.ui.MWEducationPopupWidget( this.$link, {
popupTitle: ve.msg( 'visualeditor-linkinspector-educationpopup-title' ),
popupText: ve.msg( 'visualeditor-linkinspector-educationpopup-text' ),
popupImage: 'link',
trackingName: 'link'
} );
this.$link.after( educationPopup.$element );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWLinkInspectorTool, ve.ui.LinkInspectorTool );
/* Static Properties */
ve.ui.MWLinkInspectorTool.static.modelClasses =
ve.ui.MWLinkInspectorTool.super.static.modelClasses.concat( [
ve.dm.MWNumberedExternalLinkNode,
ve.dm.MWMagicLinkNode
] );
ve.ui.MWLinkInspectorTool.static.associatedWindows = [ 'link', 'linkNode', 'linkMagicNode' ];
/* Registration */
ve.ui.toolFactory.register( ve.ui.MWLinkInspectorTool );
ve.ui.commandRegistry.register(
new ve.ui.Command(
'link', 'link', 'open', { supportedSelections: [ 'linear' ] }
)
);
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'wikitextLink', 'linkNoExpand', '[[', 2 )
);
ve.ui.commandHelpRegistry.register( 'textStyle', 'link', { sequences: [ 'wikitextLink' ] } );