Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit d594038

Browse files
authored
Merge pull request #80 from ckeditor/t/ckeditor5-list/115
Other: Remove the `fixListIndentation()` filter in favor of improved list converters fix. See ckeditor/ckeditor5-list#115.
2 parents 47ce5df + bd95f5b commit d594038

File tree

10 files changed

+1
-210
lines changed

10 files changed

+1
-210
lines changed

src/filters/list.js

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -70,65 +70,6 @@ export function unwrapParagraphInListItem( documentFragment, writer ) {
7070
}
7171
}
7272

73-
/**
74-
* Fix structure of nested lists to follow HTML guidelines and normalize content in predictable way.
75-
*
76-
* 1. Move nested lists to have sure that list items are the only children of lists.
77-
*
78-
* before: after:
79-
* OL OL
80-
* |-> LI |-> LI
81-
* |-> OL |-> OL
82-
* |-> LI |-> LI
83-
*
84-
* 2. Remove additional indentation which cannot be recreated in HTML structure.
85-
*
86-
* before: after:
87-
* OL OL
88-
* |-> LI |-> LI
89-
* |-> OL |-> OL
90-
* |-> OL |-> LI
91-
* | |-> OL |-> LI
92-
* | |-> OL
93-
* | |-> LI
94-
* |-> LI
95-
*
96-
* before: after:
97-
* OL OL
98-
* |-> OL |-> LI
99-
* |-> OL
100-
* |-> OL
101-
* |-> LI
102-
*
103-
* @param {module:engine/view/documentfragment~DocumentFragment} documentFragment
104-
* @param {module:engine/view/upcastwriter~UpcastWriter} writer
105-
*/
106-
export function fixListIndentation( documentFragment, writer ) {
107-
for ( const value of writer.createRangeIn( documentFragment ) ) {
108-
const element = value.item;
109-
110-
// case 1: The previous sibling of a list is a list item.
111-
if ( element.is( 'li' ) ) {
112-
const next = element.nextSibling;
113-
114-
if ( next && isList( next ) ) {
115-
writer.remove( next );
116-
writer.insertChild( element.childCount, next, element );
117-
}
118-
}
119-
120-
// case 2: The list is the first child of another list.
121-
if ( isList( element ) ) {
122-
let firstChild = element.getChild( 0 );
123-
124-
while ( isList( firstChild ) ) {
125-
writer.unwrapElement( firstChild );
126-
firstChild = element.getChild( 0 );
127-
}
128-
}
129-
}
130-
}
131-
13273
// Finds all list-like elements in a given document fragment.
13374
//
13475
// @param {module:engine/view/documentfragment~DocumentFragment} documentFragment Document fragment

src/normalizers/googledocsnormalizer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export default class GoogleDocsNormalizer {
3333
const writer = new UpcastWriter();
3434

3535
removeBoldWrapper( data.content, writer );
36-
fixListIndentation( data.content, writer );
3736
unwrapParagraphInListItem( data.content, writer );
3837
}
3938
}

tests/_data/paste-from-google-docs/lists/index.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44
*/
55

66
import nestedOrderedList from './nested-ordered-lists/input.html';
7-
import nestedOrderedListNormalized from './nested-ordered-lists/normalized.html';
87
import nestedOrderedListModel from './nested-ordered-lists/model.html';
98

109
import mixedList from './mixed-list/input.html';
11-
import mixedListNormalized from './mixed-list/normalized.html';
1210
import mixedListModel from './mixed-list/model.html';
1311

1412
import repeatedlyNestedList from './repeatedly-nested-list/input.html';
15-
import repeatedlyNestedListNormalized from './repeatedly-nested-list/normalized.html';
1613
import repeatedlyNestedListModel from './repeatedly-nested-list/model.html';
1714

1815
import partiallySelected from './partially-selected/input.html';
19-
import partiallySelectedNormalized from './partially-selected/normalized.html';
2016
import partiallySelectedModel from './partially-selected/model.html';
2117

2218
export const fixtures = {
@@ -26,12 +22,6 @@ export const fixtures = {
2622
repeatedlyNestedList,
2723
partiallySelected
2824
},
29-
normalized: {
30-
nestedOrderedList: nestedOrderedListNormalized,
31-
mixedList: mixedListNormalized,
32-
repeatedlyNestedList: repeatedlyNestedListNormalized,
33-
partiallySelected: partiallySelectedNormalized
34-
},
3525
model: {
3626
nestedOrderedList: nestedOrderedListModel,
3727
mixedList: mixedListModel,

tests/_data/paste-from-google-docs/lists/mixed-list/normalized.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)