Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | 1x 40x 1x 1x 1x 1x 48x 48x 48x 1x 1x 10x 10x 10x 10x 1x 15x 15x 15x 9x 15x 12x 15x 1x 3x 1x 2x 1x 1x 1x 42x 1x | /*! * VisualEditor DataModel LanguageAnnotation class. * * @copyright See AUTHORS.txt */ /** * DataModel language annotation. * * Represents `<span>` tags with 'lang' and 'dir' properties. * * @class * @extends ve.dm.TextStyleAnnotation * @constructor * @param {Object} element */ ve.dm.LanguageAnnotation = function VeDmLanguageAnnotation() { // Parent constructor ve.dm.LanguageAnnotation.super.apply( this, arguments ); }; /* Inheritance */ OO.inheritClass( ve.dm.LanguageAnnotation, ve.dm.TextStyleAnnotation ); /* Static Properties */ ve.dm.LanguageAnnotation.static.name = 'meta/language'; ve.dm.LanguageAnnotation.static.matchTagNames = [ 'span', 'bdo' ]; ve.dm.LanguageAnnotation.static.matchFunction = function ( domElement ) { const lang = domElement.getAttribute( 'lang' ), dir = ( domElement.getAttribute( 'dir' ) || '' ).toLowerCase(); return lang || dir === 'ltr' || dir === 'rtl'; }; ve.dm.LanguageAnnotation.static.applyToAppendedContent = true; ve.dm.LanguageAnnotation.static.toDataElement = function ( domElements ) { // Parent method const dataElement = ve.dm.LanguageAnnotation.super.static.toDataElement.apply( this, arguments ); dataElement.attributes.lang = domElements[ 0 ].getAttribute( 'lang' ); dataElement.attributes.dir = domElements[ 0 ].getAttribute( 'dir' ); return dataElement; }; ve.dm.LanguageAnnotation.static.toDomElements = function ( dataElement ) { // Parent method const domElements = ve.dm.LanguageAnnotation.super.static.toDomElements.apply( this, arguments ), domElement = domElements[ 0 ]; if ( dataElement.attributes.lang ) { domElement.setAttribute( 'lang', dataElement.attributes.lang ); } if ( dataElement.attributes.dir ) { domElement.setAttribute( 'dir', dataElement.attributes.dir ); } return domElements; }; ve.dm.LanguageAnnotation.static.describeChange = function ( key, change ) { if ( key === 'lang' ) { return ve.htmlMsg( 'visualeditor-changedesc-language', this.wrapText( 'del', ve.init.platform.getLanguageName( change.from.toLowerCase() ) ), this.wrapText( 'ins', ve.init.platform.getLanguageName( change.to.toLowerCase() ) ) ); } // TODO: Show something nicer than 'null', 'ltr', and 'rtl'. if ( key === 'dir' ) { return ve.htmlMsg( 'visualeditor-changedesc-direction', this.wrapText( 'del', change.from.toLowerCase() ), this.wrapText( 'ins', change.to.toLowerCase() ) ); } // Parent method return ve.dm.LanguageAnnotation.super.static.describeChange.apply( this, arguments ); }; /* Methods */ /** * @return {Object} */ ve.dm.LanguageAnnotation.prototype.getComparableObject = function () { return { type: 'meta/language', lang: this.getAttribute( 'lang' ), dir: this.getAttribute( 'dir' ) }; }; /* Registration */ ve.dm.modelRegistry.register( ve.dm.LanguageAnnotation ); |