Debian Codegraph @

extensions/VisualEditor/modules/ve-mw/ui/tools/ve.ui.MWLinkInspectorTool.js

raw symbols SCIP
1 /*!
2 * VisualEditor UserInterface MediaWiki LinkInspectorTool classes.
3 *
4 * @copyright See AUTHORS.txt
5 * @license The MIT License (MIT); see LICENSE.txt
6 */
7
8 /**
9 * UserInterface link tool. Overrides link tool from core.
10 *
11 * Works for both link annotations and link nodes, and fires the 'link' command
12 * which works for both as well.
13 *
14 * @class
15 * @extends ve.ui.LinkInspectorTool
16 *
17 * @constructor
18 * @param {OO.ui.ToolGroup} toolGroup
19 * @param {Object} [config] Configuration options
20 */
21 ve.ui.MWLinkInspectorTool = function VeUiMwLinkInspectorTool() {
22 // Parent constructor
23 ve.ui.MWLinkInspectorTool.super.apply( this, arguments );
24
25 const educationPopup = new ve.ui.MWEducationPopupWidget( this.$link, {
26 popupTitle: ve.msg( 'visualeditor-linkinspector-educationpopup-title' ),
27 popupText: mw.message( 'visualeditor-linkinspector-educationpopup-text' ).parseDom(),
28 popupImage: 'link',
29 trackingName: 'link'
30 } );
31
32 this.$link.after( educationPopup.$element );
33 };
34
35 /* Inheritance */
36
37 OO.inheritClass( ve.ui.MWLinkInspectorTool, ve.ui.LinkInspectorTool );
38
39 /* Static Properties */
40
41 ve.ui.MWLinkInspectorTool.static.modelClasses = [
42 ...ve.ui.MWLinkInspectorTool.super.static.modelClasses,
43 ve.dm.MWNumberedExternalLinkNode,
44 ve.dm.MWMagicLinkNode
45 ];
46
47 ve.ui.MWLinkInspectorTool.static.associatedWindows = [ 'link', 'linkNode', 'linkMagicNode' ];
48
49 /* Registration */
50
51 ve.ui.toolFactory.register( ve.ui.MWLinkInspectorTool );
52
53 ve.ui.commandRegistry.register(
54 new ve.ui.Command(
55 'link', 'link', 'open', { supportedSelections: [ 'linear' ] }
56 )
57 );
58
59 ve.ui.sequenceRegistry.register(
60 new ve.ui.Sequence( 'wikitextLink', 'linkNoExpand', '[[', 2 )
61 );
62
63 ve.ui.commandHelpRegistry.register( 'textStyle', 'link', { sequences: [ 'wikitextLink' ] } );