| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
ve.dm.TextStyleAnnotation = function VeDmTextStyleAnnotation() { |
| 17 |
|
| 18 |
ve.dm.TextStyleAnnotation.super.apply( this, arguments ); |
| 19 |
}; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
OO.inheritClass( ve.dm.TextStyleAnnotation, ve.dm.Annotation ); |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
ve.dm.TextStyleAnnotation.static.name = 'textStyle'; |
| 28 |
|
| 29 |
ve.dm.TextStyleAnnotation.static.matchTagNames = []; |
| 30 |
|
| 31 |
ve.dm.TextStyleAnnotation.static.toDataElement = function ( domElements, converter ) { |
| 32 |
const nodeName = converter.isFromClipboard() ? this.matchTagNames[ 0 ] : domElements[ 0 ].nodeName.toLowerCase(); |
| 33 |
return { |
| 34 |
type: this.name, |
| 35 |
attributes: { |
| 36 |
nodeName: nodeName |
| 37 |
} |
| 38 |
}; |
| 39 |
}; |
| 40 |
|
| 41 |
ve.dm.TextStyleAnnotation.static.toDomElements = function ( dataElement, doc ) { |
| 42 |
const nodeName = ve.getProp( dataElement, 'attributes', 'nodeName' ); |
| 43 |
|
| 44 |
return [ doc.createElement( nodeName || this.matchTagNames[ 0 ] ) ]; |
| 45 |
}; |
| 46 |
|
| 47 |
ve.dm.TextStyleAnnotation.static.description = null; |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
ve.dm.TextStyleAnnotation.prototype.getComparableObject = function () { |
| 55 |
return { type: this.getType() }; |
| 56 |
}; |
| 57 |
|
| 58 |
ve.dm.TextStyleAnnotation.prototype.describeAdded = function () { |
| 59 |
if ( this.constructor.static.description ) { |
| 60 |
return [ ve.msg( 'visualeditor-changedesc-textstyle-added', OO.ui.resolveMsg( this.constructor.static.description ) ) ]; |
| 61 |
} |
| 62 |
return []; |
| 63 |
}; |
| 64 |
|
| 65 |
ve.dm.TextStyleAnnotation.prototype.describeRemoved = function () { |
| 66 |
if ( this.constructor.static.description ) { |
| 67 |
return [ ve.msg( 'visualeditor-changedesc-textstyle-removed', OO.ui.resolveMsg( this.constructor.static.description ) ) ]; |
| 68 |
} |
| 69 |
return []; |
| 70 |
}; |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
ve.dm.modelRegistry.register( ve.dm.TextStyleAnnotation ); |