| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
ve.dm.MWAnnotationNode = function VeDmMWAnnotationNode() { |
| 17 |
|
| 18 |
ve.dm.MWAnnotationNode.super.apply( this, arguments ); |
| 19 |
}; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
OO.inheritClass( ve.dm.MWAnnotationNode, ve.dm.AlienInlineNode ); |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
ve.dm.MWAnnotationNode.static.name = 'mwAnnotation'; |
| 28 |
|
| 29 |
ve.dm.MWAnnotationNode.static.preserveHtmlAttributes = true; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
ve.dm.MWAnnotationNode.static.toDataElement = function ( domElements ) { |
| 37 |
const mwDataJSON = domElements[ 0 ].getAttribute( 'data-mw' ), |
| 38 |
type = domElements[ 0 ].getAttribute( 'typeof' ); |
| 39 |
|
| 40 |
const dataElement = { |
| 41 |
type: 'mwAnnotation', |
| 42 |
attributes: { |
| 43 |
type: type |
| 44 |
} |
| 45 |
}; |
| 46 |
|
| 47 |
if ( mwDataJSON !== null ) { |
| 48 |
dataElement.attributes.mw = JSON.parse( mwDataJSON ); |
| 49 |
} |
| 50 |
|
| 51 |
return dataElement; |
| 52 |
}; |
| 53 |
|
| 54 |
ve.dm.MWAnnotationNode.static.toDomElements = function ( dataElement, doc ) { |
| 55 |
const el = doc.createElement( 'meta' ); |
| 56 |
el.setAttribute( 'typeof', dataElement.attributes.type ); |
| 57 |
if ( dataElement.attributes.mw ) { |
| 58 |
el.setAttribute( 'data-mw', JSON.stringify( dataElement.attributes.mw ) ); |
| 59 |
} |
| 60 |
|
| 61 |
return [ el ]; |
| 62 |
}; |