| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
ve.ce.SectionNode = function VeCeSectionNode() { |
| 18 |
|
| 19 |
ve.ce.SectionNode.super.apply( this, arguments ); |
| 20 |
|
| 21 |
|
| 22 |
this.model.connect( this, { update: 'onUpdate' } ); |
| 23 |
|
| 24 |
|
| 25 |
ve.ce.ActiveNode.call( this ); |
| 26 |
|
| 27 |
|
| 28 |
this.$element.addClass( 've-ce-sectionNode' ); |
| 29 |
}; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
OO.inheritClass( ve.ce.SectionNode, ve.ce.BranchNode ); |
| 34 |
|
| 35 |
OO.mixinClass( ve.ce.SectionNode, ve.ce.ActiveNode ); |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
ve.ce.SectionNode.static.name = 'section'; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
ve.ce.SectionNode.prototype.getTagName = function () { |
| 51 |
const style = this.model.getAttribute( 'style' ); |
| 52 |
|
| 53 |
if ( this.model.constructor.static.matchTagNames.indexOf( style ) === -1 ) { |
| 54 |
throw new Error( 'Invalid style' ); |
| 55 |
} |
| 56 |
return style; |
| 57 |
}; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
ve.ce.SectionNode.prototype.onUpdate = function () { |
| 65 |
this.updateTagName(); |
| 66 |
}; |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
ve.ce.nodeFactory.register( ve.ce.SectionNode ); |