Debian Codegraph @

extensions/VisualEditor/lib/ve/src/ui/tools/ve.ui.CheckListTool.js

raw symbols SCIP
1 /*!
2 * VisualEditor UserInterface CheckListTool classes.
3 *
4 * @copyright See AUTHORS.txt
5 */
6
7 /**
8 * UserInterface list tool.
9 *
10 * @class
11 * @extends ve.ui.Tool
12 * @constructor
13 * @param {OO.ui.ToolGroup} toolGroup
14 * @param {Object} [config] Configuration options
15 */
16 ve.ui.CheckListTool = function VeUiCheckListTool() {
17 // Parent constructor
18 ve.ui.CheckListTool.super.apply( this, arguments );
19
20 // Properties
21 this.method = null;
22 };
23
24 /* Inheritance */
25
26 OO.inheritClass( ve.ui.CheckListTool, ve.ui.Tool );
27
28 /* Static Properties */
29
30 ve.ui.CheckListTool.static.deactivateOnSelect = false;
31
32 /* Methods */
33
34 /**
35 * @inheritdoc
36 */
37 ve.ui.CheckListTool.prototype.onUpdateState = function ( fragment ) {
38 // Parent method
39 ve.ui.CheckListTool.super.prototype.onUpdateState.apply( this, arguments );
40
41 const isMatching = fragment.hasMatchingAncestor( 'checkList' );
42 this.setActive( isMatching );
43 };
44
45 ve.ui.CheckListTool.static.name = 'checkList';
46 ve.ui.CheckListTool.static.group = 'structure';
47 ve.ui.CheckListTool.static.icon = 'checkAll';
48 ve.ui.CheckListTool.static.title =
49 OO.ui.deferMsg( 'visualeditor-listbutton-check-tooltip' );
50 ve.ui.CheckListTool.static.commandName = 'checkList';
51
52 /* Registration */
53
54 ve.ui.toolFactory.register( ve.ui.CheckListTool );
55
56 /* Command */
57
58 ve.ui.commandRegistry.register(
59 new ve.ui.Command(
60 'checkList', 'list', 'toggle',
61 { args: [ null, false, 'checkList' ], supportedSelections: [ 'linear' ] }
62 )
63 );
64
65 /* Command help */
66
67 ve.ui.commandHelpRegistry.register( 'formatting', 'listCheckList', {
68 sequences: [ 'checkList' ], label: OO.ui.deferMsg( 'visualeditor-listbutton-check-tooltip' )
69 } );
70
71 /* Sequence */
72
73 ve.ui.sequenceRegistry.register(
74 new ve.ui.Sequence( 'checkList', 'checkList', [ { type: 'paragraph' }, '[', ']', ' ' ], 3 )
75 );