2014-10-22 02:44:27 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor UserInterface MediaWiki LinkInspectorTool classes.
|
|
|
|
*
|
2023-12-01 16:06:11 +00:00
|
|
|
* @copyright See AUTHORS.txt
|
2014-10-22 02:44:27 +00:00
|
|
|
* @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
|
2015-08-06 14:22:15 +00:00
|
|
|
*
|
2014-10-22 02:44:27 +00:00
|
|
|
* @constructor
|
|
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
*/
|
2015-08-06 14:22:15 +00:00
|
|
|
ve.ui.MWLinkInspectorTool = function VeUiMwLinkInspectorTool() {
|
2016-08-22 21:44:59 +00:00
|
|
|
// Parent constructor
|
2015-08-06 14:22:15 +00:00
|
|
|
ve.ui.MWLinkInspectorTool.super.apply( this, arguments );
|
2016-08-22 21:44:59 +00:00
|
|
|
|
2022-02-21 18:07:07 +00:00
|
|
|
var educationPopup = new ve.ui.MWEducationPopupWidget( this.$link, {
|
2020-09-24 16:30:32 +00:00
|
|
|
popupTitle: ve.msg( 'visualeditor-linkinspector-educationpopup-title' ),
|
2022-01-20 21:56:59 +00:00
|
|
|
popupText: mw.message( 'visualeditor-linkinspector-educationpopup-text' ).parseDom(),
|
2020-09-24 16:30:32 +00:00
|
|
|
popupImage: 'link',
|
|
|
|
trackingName: 'link'
|
2015-09-01 16:47:18 +00:00
|
|
|
} );
|
2020-09-24 16:30:32 +00:00
|
|
|
|
|
|
|
this.$link.after( educationPopup.$element );
|
2014-10-22 02:44:27 +00:00
|
|
|
};
|
|
|
|
|
2015-09-01 20:41:50 +00:00
|
|
|
/* Inheritance */
|
|
|
|
|
2014-10-22 02:44:27 +00:00
|
|
|
OO.inheritClass( ve.ui.MWLinkInspectorTool, ve.ui.LinkInspectorTool );
|
2016-08-22 21:44:59 +00:00
|
|
|
|
2015-09-01 20:41:50 +00:00
|
|
|
/* Static Properties */
|
|
|
|
|
2014-10-22 02:44:27 +00:00
|
|
|
ve.ui.MWLinkInspectorTool.static.modelClasses =
|
|
|
|
ve.ui.MWLinkInspectorTool.super.static.modelClasses.concat( [
|
2015-08-25 05:48:16 +00:00
|
|
|
ve.dm.MWNumberedExternalLinkNode,
|
|
|
|
ve.dm.MWMagicLinkNode
|
2014-10-22 02:44:27 +00:00
|
|
|
] );
|
|
|
|
|
2015-08-25 05:48:16 +00:00
|
|
|
ve.ui.MWLinkInspectorTool.static.associatedWindows = [ 'link', 'linkNode', 'linkMagicNode' ];
|
|
|
|
|
2015-09-01 20:41:50 +00:00
|
|
|
/* Registration */
|
|
|
|
|
2014-10-22 02:44:27 +00:00
|
|
|
ve.ui.toolFactory.register( ve.ui.MWLinkInspectorTool );
|
2015-08-02 11:24:15 +00:00
|
|
|
|
|
|
|
ve.ui.commandRegistry.register(
|
|
|
|
new ve.ui.Command(
|
2015-08-12 20:55:31 +00:00
|
|
|
'link', 'link', 'open', { supportedSelections: [ 'linear' ] }
|
2015-08-02 11:24:15 +00:00
|
|
|
)
|
|
|
|
);
|
2015-10-22 10:44:54 +00:00
|
|
|
|
|
|
|
ve.ui.sequenceRegistry.register(
|
2016-04-25 10:36:50 +00:00
|
|
|
new ve.ui.Sequence( 'wikitextLink', 'linkNoExpand', '[[', 2 )
|
2015-10-22 10:44:54 +00:00
|
|
|
);
|
2015-11-03 11:22:42 +00:00
|
|
|
|
2015-11-05 10:11:35 +00:00
|
|
|
ve.ui.commandHelpRegistry.register( 'textStyle', 'link', { sequences: [ 'wikitextLink' ] } );
|