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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | 1x 264x 264x 1x 1x 1x 8x 1x 2x 2x 2x 2x 3x 3x 3x 2x 2x 1x 3x 1x 1x 1x 1x 27x | /*! * VisualEditor DataModel ImageNode class. * * @copyright See AUTHORS.txt */ /** * DataModel image node. * * @class * @abstract * @mixes ve.dm.FocusableNode * @mixes ve.dm.ResizableNode * * @constructor */ ve.dm.ImageNode = function VeDmImageNode() { // Mixin constructors ve.dm.FocusableNode.call( this ); ve.dm.ResizableNode.call( this ); }; /* Inheritance */ OO.mixinClass( ve.dm.ImageNode, ve.dm.FocusableNode ); OO.mixinClass( ve.dm.ImageNode, ve.dm.ResizableNode ); /* Static Methods */ // eslint-disable-next-line jsdoc/require-param, jsdoc/require-returns /** * @see ve.dm.Model */ ve.dm.ImageNode.static.isDiffComparable = function ( element, other ) { // Images with different src's shouldn't be diffed return element.type === other.type && element.attributes.src === other.attributes.src; }; // eslint-disable-next-line jsdoc/require-param, jsdoc/require-returns /** * @see ve.dm.Model */ ve.dm.ImageNode.static.describeChanges = function ( attributeChanges, attributes ) { const customKeys = [ 'width', 'height' ], descriptions = []; function describeSize( width, height ) { return width + ve.msg( 'visualeditor-dimensionswidget-times' ) + height + ve.msg( 'visualeditor-dimensionswidget-px' ); } Iif ( 'width' in attributeChanges || 'height' in attributeChanges ) { const sizeFrom = describeSize( 'width' in attributeChanges ? attributeChanges.width.from : attributes.width, 'height' in attributeChanges ? attributeChanges.height.from : attributes.height ); const sizeTo = describeSize( 'width' in attributeChanges ? attributeChanges.width.to : attributes.width, 'height' in attributeChanges ? attributeChanges.height.to : attributes.height ); descriptions.push( ve.htmlMsg( 'visualeditor-changedesc-image-size', this.wrapText( 'del', sizeFrom ), this.wrapText( 'ins', sizeTo ) ) ); } for ( const key in attributeChanges ) { Eif ( customKeys.indexOf( key ) === -1 ) { const change = this.describeChange( key, attributeChanges[ key ] ); if ( change ) { descriptions.push( change ); } } } return descriptions; }; // eslint-disable-next-line jsdoc/require-param, jsdoc/require-returns /** * @see ve.dm.Node */ ve.dm.ImageNode.static.describeChange = function ( key, change ) { switch ( key ) { case 'align': // The following messages are used here: // * visualeditor-align-desc-left // * visualeditor-align-desc-right // * visualeditor-align-desc-center // Also used in ve-mw (consider downstreaming these messages) // * visualeditor-align-desc-default // * visualeditor-align-desc-none return ve.htmlMsg( 'visualeditor-changedesc-align', this.wrapText( 'del', ve.msg( 'visualeditor-align-desc-' + change.from ) ), this.wrapText( 'ins', ve.msg( 'visualeditor-align-desc-' + change.to ) ) ); // ClassAttributeNode attributes case 'originalClasses': case 'unrecognizedClasses': return; } // Parent method return ve.dm.Node.static.describeChange.apply( this, arguments ); }; /* Methods */ /** * @inheritdoc */ ve.dm.ImageNode.prototype.createScalable = function () { return new ve.dm.Scalable( { currentDimensions: { width: this.getAttribute( 'width' ), height: this.getAttribute( 'height' ) }, minDimensions: { width: 1, height: 1 } } ); }; |