From b963747a450fb40bcba3745d1a0459b3d40c729c Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sun, 23 Jun 2013 18:21:52 +0100 Subject: [PATCH] Pass full data (including meta) to converter in references Previously we were just passing a slice of the visible data, instead of using getFullData. Bug: 50059 Change-Id: I3bbea49132ef4a720a147ba9b170c39a0c00f711 --- modules/ve/dm/nodes/ve.dm.MWReferenceNode.js | 2 +- modules/ve/test/dm/ve.dm.example.js | 63 ++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/modules/ve/dm/nodes/ve.dm.MWReferenceNode.js b/modules/ve/dm/nodes/ve.dm.MWReferenceNode.js index 63b85f74ed..b594c00bad 100644 --- a/modules/ve/dm/nodes/ve.dm.MWReferenceNode.js +++ b/modules/ve/dm/nodes/ve.dm.MWReferenceNode.js @@ -105,7 +105,7 @@ ve.dm.MWReferenceNode.static.toDomElements = function ( dataElement, doc, conver if ( setContents ) { converter.getDomSubtreeFromData( - itemNode.getDocument().getData().slice( itemNodeRange.start, itemNodeRange.end ), + itemNode.getDocument().getFullData( new ve.Range( itemNodeRange.start, itemNodeRange.end ), true ), itemNodeWrapper ), itemNodeHtml = $( itemNodeWrapper ).html(); diff --git a/modules/ve/test/dm/ve.dm.example.js b/modules/ve/test/dm/ve.dm.example.js index e5c30c7190..50c499863a 100644 --- a/modules/ve/test/dm/ve.dm.example.js +++ b/modules/ve/test/dm/ve.dm.example.js @@ -1348,6 +1348,69 @@ ve.dm.example.domToDataCases = { '
  • u2191Quux
  • ' + '' }, + 'mw:Reference with metadata': { + 'html': '

    ' + + '

    ', + 'data': [ + { 'type': 'paragraph' }, + { + 'type': 'mwReference', + 'attributes': { + 'about': '#mwt2', + 'contentsUsed': true, + 'listGroup': 'mwReference/', + 'listIndex': 0, + 'listKey': null, + 'mw': { + 'attrs': {}, + 'body': { + 'html': 'Foo' + }, + 'name': 'ref' + }, + 'origMw': '{"name":"ref","body":{"html":"Foo"},"attrs":{}}', + 'refGroup': '' + }, + 'htmlAttributes': [ + { + 'values': { + 'about': '#mwt2', + 'class': 'reference', + 'data-mw': '{"name":"ref","body":{"html":"Foo"},"attrs":{}}', + 'data-parsoid': '{}', + 'id': 'cite_ref-1-0', + 'rel': 'dc:references', + 'typeof': 'mw:Extension/ref' + } + } + ] + }, + { 'type': '/mwReference' }, + { 'type': '/paragraph' }, + { 'type': 'internalList' }, + { 'type': 'internalItem' }, + { + 'internal': { + 'generated': 'wrapper' + }, + 'type': 'paragraph' + }, + 'F', 'o', 'o', + { 'type': '/paragraph' }, + { + 'type': 'alienMeta', + 'attributes': { + 'domElements': $( '' ).toArray() + } + }, + { 'type': '/alienMeta' }, + { 'type': '/internalItem' }, + { 'type': '/internalList' } + ] + }, 'paragraph with alienInline inside': { 'html': '

    abc

    ', 'data': [