| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
ve.dm.SectionNode = function VeDmSectionNode() { |
| 18 |
|
| 19 |
ve.dm.SectionNode.super.apply( this, arguments ); |
| 20 |
}; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
OO.inheritClass( ve.dm.SectionNode, ve.dm.BranchNode ); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
ve.dm.SectionNode.static.name = 'section'; |
| 29 |
|
| 30 |
ve.dm.SectionNode.static.isUnwrappable = false; |
| 31 |
|
| 32 |
ve.dm.SectionNode.static.defaultAttributes = { |
| 33 |
style: 'section' |
| 34 |
}; |
| 35 |
|
| 36 |
ve.dm.SectionNode.static.matchTagNames = [ 'header', 'section', 'footer' ]; |
| 37 |
|
| 38 |
ve.dm.SectionNode.static.toDataElement = function ( domElements ) { |
| 39 |
return { type: this.name, attributes: { style: domElements[ 0 ].nodeName.toLowerCase() } }; |
| 40 |
}; |
| 41 |
|
| 42 |
ve.dm.SectionNode.static.toDomElements = function ( dataElement, doc ) { |
| 43 |
const style = dataElement.attributes && dataElement.attributes.style || 'section'; |
| 44 |
return [ doc.createElement( style ) ]; |
| 45 |
}; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
ve.dm.SectionNode.prototype.canHaveSlugBefore = function () { |
| 50 |
return false; |
| 51 |
}; |
| 52 |
|
| 53 |
ve.dm.SectionNode.prototype.canHaveSlugAfter = function () { |
| 54 |
return false; |
| 55 |
}; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
ve.dm.modelRegistry.register( ve.dm.SectionNode ); |