Esanders has uploaded a new change for review.

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


Change subject: Clear paragraph's { generated: wrapper } property when 
unindenting.
......................................................................

Clear paragraph's { generated: wrapper } property when unindenting.

'wrapper' paragraphs should only exist inside listItems and so when
unindenting a listItem to the document - any wrapper paragraphs
should be set to empty so that they aren't merged into one paragraph.

Bug: 45590
Change-Id: I1f47d12db6d57d984fd4607f667a3b62c53f3dd6
---
M modules/ve/actions/ve.IndentationAction.js
1 file changed, 13 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/46/52046/1

diff --git a/modules/ve/actions/ve.IndentationAction.js 
b/modules/ve/actions/ve.IndentationAction.js
index 58d9fb4..c8d1e68 100644
--- a/modules/ve/actions/ve.IndentationAction.js
+++ b/modules/ve/actions/ve.IndentationAction.js
@@ -207,12 +207,13 @@
        // TODO: Child list handling, gotta figure that out.
        var tx,
                surfaceModel = this.surface.getModel(),
+               fragment = surfaceModel.getFragment( listItem.getOuterRange(), 
true ),
                documentModel = surfaceModel.getDocument(),
                list = listItem.getParent(),
                listElement = list.getClonedElement(),
                grandParentType = list.getParent().getType(),
                listItemRange = listItem.getOuterRange(),
-               splitListRange;
+               i, length, children, child, splitListRange;
 
        // CAREFUL: after initializing the variables above, we cannot use the 
model tree!
        // The first transaction will cause rebuilds so the nodes we have 
references to now
@@ -251,6 +252,17 @@
                        []
                );
                surfaceModel.change( tx );
+               children = fragment.getSiblingNodes();
+               for( i = 0, length = children.length; i < length; i++ ) {
+                       child = children[i].node;
+                       if(
+                               child.type === 'paragraph' &&
+                               child.element.internal &&
+                               child.element.internal.generated === 'wrapper'
+                       ) {
+                               child.element.internal.generated = 'empty';
+                       }
+               }
        } else {
                // (3) Split the list away from parentListItem into its own 
listItem
                // TODO factor common split logic somehow?

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f47d12db6d57d984fd4607f667a3b62c53f3dd6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to