Debian Codegraph @

extensions/VisualEditor/lib/ve/src/ui/commands/ve.ui.IndentationCommand.js

raw symbols SCIP
1 /*!
2 * VisualEditor UserInterface IndentationCommand class.
3 *
4 * @copyright See AUTHORS.txt
5 */
6
7 /**
8 * UserInterface indentation command.
9 *
10 * @class
11 * @extends ve.ui.Command
12 *
13 * @constructor
14 * @param {string} name
15 * @param {string} method
16 */
17 ve.ui.IndentationCommand = function VeUiIndentationCommand( name, method ) {
18 // Parent constructor
19 ve.ui.IndentationCommand.super.call(
20 this, name, 'indentation', method,
21 { supportedSelections: [ 'linear' ] }
22 );
23 };
24
25 /* Inheritance */
26
27 OO.inheritClass( ve.ui.IndentationCommand, ve.ui.Command );
28
29 /* Methods */
30
31 /**
32 * @inheritdoc
33 */
34 ve.ui.IndentationCommand.prototype.isExecutable = function ( fragment ) {
35 // Parent method
36 if ( !ve.ui.IndentationCommand.super.prototype.isExecutable.apply( this, arguments ) ) {
37 return false;
38 }
39 return fragment.hasMatchingAncestor( 'listItem' );
40 };
41
42 /* Registration */
43
44 ve.ui.commandRegistry.register( new ve.ui.IndentationCommand( 'indent', 'increase' ) );
45
46 ve.ui.commandRegistry.register( new ve.ui.IndentationCommand( 'outdent', 'decrease' ) );