mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-19 01:31:06 +00:00
b9b966de6e
See I9addf43b2857de7bcac. Change-Id: Ic1998ab6f7dedf6946d7ae63a985a76031f8eecf
64 lines
1.7 KiB
JavaScript
64 lines
1.7 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MediaWiki LinkInspectorTool classes.
|
|
*
|
|
* @copyright 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() {
|
|
// Parent constructor
|
|
ve.ui.MWLinkInspectorTool.super.apply( this, arguments );
|
|
|
|
const educationPopup = new ve.ui.MWEducationPopupWidget( this.$link, {
|
|
popupTitle: ve.msg( 'visualeditor-linkinspector-educationpopup-title' ),
|
|
popupText: mw.message( 'visualeditor-linkinspector-educationpopup-text' ).parseDom(),
|
|
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,
|
|
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' ] } );
|