Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315548

Change subject: Don't strip empty paragraphs on paste if they are generated
......................................................................

Don't strip empty paragraphs on paste if they are generated

Bug: T147949
Change-Id: I36547da07294bfc138c71f37533f6e5e0bd6e5e5
---
M src/dm/lineardata/ve.dm.ElementLinearData.js
M tests/dm/lineardata/ve.dm.ElementLinearData.test.js
2 files changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/48/315548/1

diff --git a/src/dm/lineardata/ve.dm.ElementLinearData.js 
b/src/dm/lineardata/ve.dm.ElementLinearData.js
index 4485d41..b080ed7 100644
--- a/src/dm/lineardata/ve.dm.ElementLinearData.js
+++ b/src/dm/lineardata/ve.dm.ElementLinearData.js
@@ -1126,6 +1126,7 @@
                        if (
                                !rules.keepEmptyContentBranches &&
                                i > 0 && !isOpen && this.isOpenElementData( i - 
1 ) &&
+                               !ve.getProp( this.getData( i - 1 ), 'internal', 
'generated' ) &&
                                canContainContent
                        ) {
                                this.splice( i - 1, 2 );
diff --git a/tests/dm/lineardata/ve.dm.ElementLinearData.test.js 
b/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
index e65456a..8d4f48a 100644
--- a/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
+++ b/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
@@ -1623,6 +1623,20 @@
                                msg: 'Empty content nodes are stripped'
                        },
                        {
+                               html: '<ul><li></li></ul>',
+                               data: [
+                                       { type: 'list', attributes: { style: 
'bullet' } },
+                                       { type: 'listItem' },
+                                       { type: 'paragraph', internal: { 
generated: 'empty' } },
+                                       { type: '/paragraph' },
+                                       { type: '/listItem' },
+                                       { type: '/list' },
+                                       { type: 'internalList' },
+                                       { type: '/internalList' }
+                               ],
+                               msg: 'Empty, but generated, content nodes are 
preserved'
+                       },
+                       {
                                html: '<div>Foo</div>',
                                data: [
                                        { type: 'paragraph' },

-- 
To view, visit https://gerrit.wikimedia.org/r/315548
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36547da07294bfc138c71f37533f6e5e0bd6e5e5
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to