| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
ve.ce.ListNode = function VeCeListNode() { |
| 17 |
|
| 18 |
ve.ce.ListNode.super.apply( this, arguments ); |
| 19 |
|
| 20 |
|
| 21 |
this.model.connect( this, { update: 'onUpdate' } ); |
| 22 |
}; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
OO.inheritClass( ve.ce.ListNode, ve.ce.BranchNode ); |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
ve.ce.ListNode.static.name = 'list'; |
| 31 |
|
| 32 |
ve.ce.ListNode.static.removeEmptyLastChildOnEnter = true; |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
ve.ce.ListNode.prototype.getTagName = function () { |
| 45 |
const style = this.model.getAttribute( 'style' ), |
| 46 |
types = { bullet: 'ul', number: 'ol' }; |
| 47 |
|
| 48 |
if ( !Object.prototype.hasOwnProperty.call( types, style ) ) { |
| 49 |
throw new Error( 'Invalid style' ); |
| 50 |
} |
| 51 |
return types[ style ]; |
| 52 |
}; |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
ve.ce.ListNode.prototype.onUpdate = function () { |
| 60 |
this.updateTagName(); |
| 61 |
}; |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
ve.ce.nodeFactory.register( ve.ce.ListNode ); |