mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-27 12:16:51 +00:00
Whitespace between unwrapped inline nodes assigned to paragraph
In stopWrapping we assign any left over whitespace to the paragraph in position 3, however we weren't clearing this whitespace buffer if an inline content node followed it. Change-Id: I8b3ee3915044abd6bafda386430bf7f992ca4aa8
This commit is contained in:
parent
9c37181788
commit
328dd8e21f
|
@ -590,6 +590,12 @@ ve.dm.Converter.prototype.getDataFromDomRecursion = function ( domElement, wrapp
|
|||
}
|
||||
}
|
||||
|
||||
// If we're inserting content into a wrapper, any wrappedWhitespace
|
||||
// up to this point can be considered dealt with
|
||||
if ( context.inWrapper && childIsContent ) {
|
||||
wrappedWhitespace = '';
|
||||
}
|
||||
|
||||
// Annotate child
|
||||
if ( childIsContent && !context.annotations.isEmpty() ) {
|
||||
childDataElements[0].annotations = context.annotations.getIndexes().slice();
|
||||
|
|
|
@ -1621,6 +1621,38 @@ ve.dm.example.domToDataCases = {
|
|||
{ 'type': '/paragraph' }
|
||||
]
|
||||
},
|
||||
'whitespace between unwrapped inline nodes': {
|
||||
'html':
|
||||
'<body>' +
|
||||
'<span typeof="mw:Entity">c</span> <span typeof="mw:Entity">d</span>\n<span typeof="mw:Entity">e</span>' +
|
||||
'</body>',
|
||||
'data': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'internal': {
|
||||
'generated': 'wrapper'
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'MWentity',
|
||||
'attributes': { 'character': 'c', 'html/0/typeof': 'mw:Entity' }
|
||||
},
|
||||
{ 'type': '/MWentity' },
|
||||
' ',
|
||||
{
|
||||
'type': 'MWentity',
|
||||
'attributes': { 'character': 'd', 'html/0/typeof': 'mw:Entity' }
|
||||
},
|
||||
{ 'type': '/MWentity' },
|
||||
'\n',
|
||||
{
|
||||
'type': 'MWentity',
|
||||
'attributes': { 'character': 'e', 'html/0/typeof': 'mw:Entity' }
|
||||
},
|
||||
{ 'type': '/MWentity' },
|
||||
{ 'type': '/paragraph' },
|
||||
]
|
||||
},
|
||||
'whitespace preservation in headings': {
|
||||
'html': '<body><h2>Foo</h2><h2> Bar</h2><h2>Baz </h2><h2> Quux </h2></body>',
|
||||
'data': [
|
||||
|
|
Loading…
Reference in a new issue