| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
ve.ui.CheckListTool = function VeUiCheckListTool() { |
| 17 |
|
| 18 |
ve.ui.CheckListTool.super.apply( this, arguments ); |
| 19 |
|
| 20 |
|
| 21 |
this.method = null; |
| 22 |
}; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
OO.inheritClass( ve.ui.CheckListTool, ve.ui.Tool ); |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
ve.ui.CheckListTool.static.deactivateOnSelect = false; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
ve.ui.CheckListTool.prototype.onUpdateState = function ( fragment ) { |
| 38 |
|
| 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 |
|
| 53 |
|
| 54 |
ve.ui.toolFactory.register( ve.ui.CheckListTool ); |
| 55 |
|
| 56 |
|
| 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 |
|
| 66 |
|
| 67 |
ve.ui.commandHelpRegistry.register( 'formatting', 'listCheckList', { |
| 68 |
sequences: [ 'checkList' ], label: OO.ui.deferMsg( 'visualeditor-listbutton-check-tooltip' ) |
| 69 |
} ); |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
ve.ui.sequenceRegistry.register( |
| 74 |
new ve.ui.Sequence( 'checkList', 'checkList', [ { type: 'paragraph' }, '[', ']', ' ' ], 3 ) |
| 75 |
); |