jenkins-bot has submitted this change and it was merged.
Change subject: Whitespace between unwrapped inline nodes assigned to paragraph
......................................................................
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
---
M modules/ve/dm/ve.dm.Converter.js
M modules/ve/test/dm/ve.dm.example.js
2 files changed, 38 insertions(+), 0 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/dm/ve.dm.Converter.js b/modules/ve/dm/ve.dm.Converter.js
index dd16935..05425e8 100644
--- a/modules/ve/dm/ve.dm.Converter.js
+++ b/modules/ve/dm/ve.dm.Converter.js
@@ -590,6 +590,12 @@
}
}
+ // 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();
diff --git a/modules/ve/test/dm/ve.dm.example.js
b/modules/ve/test/dm/ve.dm.example.js
index 1dc2f20..378d4c5 100644
--- a/modules/ve/test/dm/ve.dm.example.js
+++ b/modules/ve/test/dm/ve.dm.example.js
@@ -1621,6 +1621,38 @@
{ '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': [
--
To view, visit https://gerrit.wikimedia.org/r/63012
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8b3ee3915044abd6bafda386430bf7f992ca4aa8
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits