Rename MWImageNode to MWInlineImageNode (get ready for adding MWBlockImageNode soon)

Change-Id: I617e2a17cb6fbd11e486c2981e361ae931ac1870
This commit is contained in:
Inez Korczyński 2013-04-24 16:46:34 -07:00
parent 4d64b0bb8f
commit 6b7d62e4a4
7 changed files with 27 additions and 27 deletions

View file

@ -490,10 +490,10 @@ $wgResourceModules += array(
),
'ext.visualEditor.experimental' => $wgVisualEditorResourceTemplate + array(
'scripts' => array(
've/dm/nodes/ve.dm.MWImageNode.js',
've/dm/nodes/ve.dm.MWInlineImageNode.js',
've/dm/nodes/ve.dm.MWTemplateNode.js',
've/ce/nodes/ve.ce.MWImageNode.js',
've/ce/nodes/ve.ce.MWInlineImageNode.js',
've/ce/nodes/ve.ce.MWTemplateNode.js',
),
'dependencies' => array(

View file

@ -162,7 +162,7 @@ $html = file_get_contents( $page );
<script src="../../modules/ve/dm/nodes/ve.dm.TextNode.js"></script>
<script src="../../modules/ve/dm/nodes/ve.dm.MWEntityNode.js"></script>
<script src="../../modules/ve/dm/nodes/ve.dm.MWHeadingNode.js"></script>
<script src="../../modules/ve/dm/nodes/ve.dm.MWImageNode.js"></script>
<script src="../../modules/ve/dm/nodes/ve.dm.MWInlineImageNode.js"></script>
<script src="../../modules/ve/dm/nodes/ve.dm.MWPreformattedNode.js"></script>
<script src="../../modules/ve/dm/nodes/ve.dm.MWReferenceListNode.js"></script>
<script src="../../modules/ve/dm/nodes/ve.dm.MWReferenceNode.js"></script>
@ -213,7 +213,7 @@ $html = file_get_contents( $page );
<script src="../../modules/ve/ce/nodes/ve.ce.TextNode.js"></script>
<script src="../../modules/ve/ce/nodes/ve.ce.MWEntityNode.js"></script>
<script src="../../modules/ve/ce/nodes/ve.ce.MWHeadingNode.js"></script>
<script src="../../modules/ve/ce/nodes/ve.ce.MWImageNode.js"></script>
<script src="../../modules/ve/ce/nodes/ve.ce.MWInlineImageNode.js"></script>
<script src="../../modules/ve/ce/nodes/ve.ce.MWPreformattedNode.js"></script>
<script src="../../modules/ve/ce/nodes/ve.ce.MWReferenceListNode.js"></script>
<script src="../../modules/ve/ce/nodes/ve.ce.MWReferenceNode.js"></script>

View file

@ -11,9 +11,9 @@
* @class
* @extends ve.ce.ImageNode
* @constructor
* @param {ve.dm.MWImageNode} model Model to observe
* @param {ve.dm.MWInlineImageNode} model Model to observe
*/
ve.ce.MWImageNode = function VeCeMWImageNode( model ) {
ve.ce.MWInlineImageNode = function VeCeMWInlineImageNode( model ) {
// Parent constructor
ve.ce.ImageNode.call( this, model );
@ -23,7 +23,7 @@
// Initialization
this.$
.attr( 'contenteditable', false )
.addClass( 've-ce-mwImageNode' )
.addClass( 've-ce-mwInlineImageNode' )
.append( this.$image )
.data( 'view', this.$image.data( 'view' ) );
this.onUpdate();
@ -31,14 +31,14 @@
/* Inheritance */
ve.inheritClass( ve.ce.MWImageNode, ve.ce.ImageNode );
ve.inheritClass( ve.ce.MWInlineImageNode, ve.ce.ImageNode );
/* Static Properties */
ve.ce.MWImageNode.static.name = 'MWimage';
ve.ce.MWInlineImageNode.static.name = 'MWinlineimage';
/* Methods */
/* Registration */
ve.ce.nodeFactory.register( ve.ce.MWImageNode );
ve.ce.nodeFactory.register( ve.ce.MWInlineImageNode );

View file

@ -14,26 +14,26 @@
* @param {number} [length] Length of content data in document
* @param {Object} [element] Reference to element in linear model
*/
ve.dm.MWImageNode = function VeDmMWImageNode( length, element ) {
ve.dm.MWInlineImageNode = function VeDmMWInlineImageNode( length, element ) {
ve.dm.ImageNode.call( this, 0, element );
};
/* Inheritance */
ve.inheritClass( ve.dm.MWImageNode, ve.dm.ImageNode );
ve.inheritClass( ve.dm.MWInlineImageNode, ve.dm.ImageNode );
/* Static Properties */
ve.dm.MWImageNode.static.name = 'MWimage';
ve.dm.MWInlineImageNode.static.name = 'MWinlineimage';
ve.dm.MWImageNode.static.matchTagNames = null;
ve.dm.MWInlineImageNode.static.matchTagNames = null;
// TODO: Develop better method to test for generated content
ve.dm.MWImageNode.static.generatedContent = true;
ve.dm.MWInlineImageNode.static.generatedContent = true;
ve.dm.MWImageNode.static.matchRdfaTypes = [ 'mw:Image' ];
ve.dm.MWInlineImageNode.static.matchRdfaTypes = [ 'mw:Image' ];
ve.dm.MWImageNode.static.toDataElement = function ( domElements ) {
ve.dm.MWInlineImageNode.static.toDataElement = function ( domElements ) {
var i, j, childNode, children = Array.prototype.slice.call( domElements[0].children, 0 ),
parentResult = ve.dm.ImageNode.static.toDataElement.apply(
this, [ children ].concat( Array.prototype.slice.call( arguments, 1 ) )
@ -50,14 +50,14 @@ ve.dm.MWImageNode.static.toDataElement = function ( domElements ) {
}
return ve.extendObject( true, dataElement, {
'type': 'MWimage',
'type': 'MWinlineimage',
'attributes': {
'isLinked': domElements[0].nodeName.toLowerCase() === 'a'
}
} );
};
ve.dm.MWImageNode.static.toDomElements = function ( dataElement, doc ) {
ve.dm.MWInlineImageNode.static.toDomElements = function ( dataElement, doc ) {
var k, wrapper = doc.createElement( dataElement.attributes.isLinked ? 'a' : 'span' ),
imageDomElement = ve.dm.ImageNode.static.toDomElements.apply( this, arguments )[0];
@ -74,4 +74,4 @@ ve.dm.MWImageNode.static.toDomElements = function ( dataElement, doc ) {
/* Registration */
ve.dm.modelRegistry.register( ve.dm.MWImageNode );
ve.dm.modelRegistry.register( ve.dm.MWInlineImageNode );

View file

@ -735,7 +735,7 @@ ve.dm.example.conversions = {
}
};
ve.dm.example.MWImageHtml = '<a rel="mw:Image" href="./File:Wiki.png" data-parsoid="{&quot;tsr&quot;:[158,216],&quot;src&quot;:&quot;[[Image:Wiki.png|500px|thumb|center|Example wiki file]]&quot;,&quot;optNames&quot;:{&quot;width&quot;:&quot;$1px&quot;},&quot;dsr&quot;:[158,216,null,null]}"><img height="" width="500" src="/index.php?title=Special:FilePath/Wiki.png&amp;width=500" alt="Wiki.png"></a>';
ve.dm.example.MWInlineImageHtml = '<a rel="mw:Image" href="./File:Wiki.png" data-parsoid="{&quot;tsr&quot;:[158,216],&quot;src&quot;:&quot;[[Image:Wiki.png|500px|thumb|center|Example wiki file]]&quot;,&quot;optNames&quot;:{&quot;width&quot;:&quot;$1px&quot;},&quot;dsr&quot;:[158,216,null,null]}"><img height="" width="500" src="/index.php?title=Special:FilePath/Wiki.png&amp;width=500" alt="Wiki.png"></a>';
ve.dm.example.MWTemplate = {
'blockSpan': '<span about="#mwt1" typeof="mw:Object/Template" data-mw="{&quot;id&quot;:&quot;mwt1&quot;,&quot;target&quot;:{&quot;wt&quot;:&quot;Test&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;Hello, world!&quot;}}}" data-parsoid="{&quot;tsr&quot;:[18,40],&quot;src&quot;:&quot;{{Test|Hello, world!}}&quot;,&quot;dsr&quot;:[18,40,null,null]}"></span>',
'blockSpanModified': '<span about="#mwt1" typeof="mw:Object/Template" data-mw="{&quot;id&quot;:&quot;mwt1&quot;,&quot;target&quot;:{&quot;wt&quot;:&quot;Test&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;Hello, globe!&quot;}}}" data-parsoid="{&quot;tsr&quot;:[18,40],&quot;src&quot;:&quot;{{Test|Hello, world!}}&quot;,&quot;dsr&quot;:[18,40,null,null]}"></span>',
@ -842,11 +842,11 @@ ve.dm.example.domToDataCases = {
]
},
'mw:Image': {
'html': '<body><p>' + ve.dm.example.MWImageHtml + '</p></body>',
'html': '<body><p>' + ve.dm.example.MWInlineImageHtml + '</p></body>',
'data': [
{ 'type': 'paragraph' },
{
'type': 'MWimage',
'type': 'MWinlineimage',
'attributes': {
'html/0-0/alt': 'Wiki.png',
'html/0-0/height': '',
@ -861,7 +861,7 @@ ve.dm.example.domToDataCases = {
'isLinked': true
}
},
{ 'type': '/MWimage' },
{ 'type': '/MWinlineimage' },
{ 'type': '/paragraph' }
]
},

View file

@ -105,7 +105,7 @@
<script src="../../ve/dm/nodes/ve.dm.TextNode.js"></script>
<script src="../../ve/dm/nodes/ve.dm.MWEntityNode.js"></script>
<script src="../../ve/dm/nodes/ve.dm.MWHeadingNode.js"></script>
<script src="../../ve/dm/nodes/ve.dm.MWImageNode.js"></script>
<script src="../../ve/dm/nodes/ve.dm.MWInlineImageNode.js"></script>
<script src="../../ve/dm/nodes/ve.dm.MWPreformattedNode.js"></script>
<script src="../../ve/dm/nodes/ve.dm.MWReferenceListNode.js"></script>
<script src="../../ve/dm/nodes/ve.dm.MWReferenceNode.js"></script>
@ -156,7 +156,7 @@
<script src="../../ve/ce/nodes/ve.ce.TextNode.js"></script>
<script src="../../ve/ce/nodes/ve.ce.MWEntityNode.js"></script>
<script src="../../ve/ce/nodes/ve.ce.MWHeadingNode.js"></script>
<script src="../../ve/ce/nodes/ve.ce.MWImageNode.js"></script>
<script src="../../ve/ce/nodes/ve.ce.MWInlineImageNode.js"></script>
<script src="../../ve/ce/nodes/ve.ce.MWPreformattedNode.js"></script>
<script src="../../ve/ce/nodes/ve.ce.MWReferenceListNode.js"></script>
<script src="../../ve/ce/nodes/ve.ce.MWReferenceNode.js"></script>

View file

@ -30,7 +30,7 @@ ve.ui.MediaDialog.static.titleMessage = 'visualeditor-dialog-media-title';
ve.ui.MediaDialog.static.icon = 'picture';
ve.ui.MediaDialog.static.modelClasses = [ ve.dm.MWImageNode ];
ve.ui.MediaDialog.static.modelClasses = [ ve.dm.MWInlineImageNode ];
/* Registration */