Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ck/11065 document list properties #11099

Merged
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
c495ba2
Introducing conversion for DocumentListProperties.
niegowski Jan 5, 2022
d51046a
Added support for data downcast.
niegowski Jan 5, 2022
410ce8a
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Jan 11, 2022
6a6e4ff
WiP.
niegowski Jan 11, 2022
90e77dc
WiP.
niegowski Jan 11, 2022
279054a
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Jan 12, 2022
da35c95
The modelList() helper accepts string as input.
niegowski Jan 13, 2022
68f8ee9
Adding tests.
niegowski Jan 13, 2022
ce1228e
Adding tests.
niegowski Jan 13, 2022
8a5bd88
Adding tests.
niegowski Jan 18, 2022
2dc04e2
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Jan 20, 2022
f5c7cb7
Updated copyright header.
niegowski Jan 20, 2022
0eb44d8
Adding tests.
niegowski Jan 24, 2022
542cc94
WiP.
niegowski Jan 26, 2022
fed5396
WiP.
niegowski Jan 27, 2022
e71e1c6
Refactored bogus paragraph handling.
niegowski Jan 27, 2022
27881e3
Resolved conflicts.
oleq Jan 27, 2022
dc1ade4
Updating tests.
niegowski Jan 27, 2022
9ebcd36
WiP.
niegowski Jan 31, 2022
ca6ade7
Added option to inject custom callbacks for post-fixer and change han…
niegowski Jan 31, 2022
7175091
Code cleanup.
niegowski Feb 1, 2022
fd08e37
Added post-fixing of the missing list properties attributes.
niegowski Feb 1, 2022
9c54b05
Code cleanup.
niegowski Feb 2, 2022
029517a
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 2, 2022
a1adfab
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 2, 2022
6b3c3ba
Fix tests.
niegowski Feb 2, 2022
ae884ef
Re-wrapping lists on the indentation change.
niegowski Feb 3, 2022
3bd4478
Adding tests.
niegowski Feb 6, 2022
dc221f9
Code cleaning.
niegowski Feb 6, 2022
4695246
Code cleaning.
niegowski Feb 6, 2022
6fafd82
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
arkflpc Feb 7, 2022
bbac39b
Added DocumentListStyle command
arkflpc Feb 7, 2022
20fc76d
Added DocumentListStartCommand
arkflpc Feb 8, 2022
c63dac8
Converting to list and style application in single batch
arkflpc Feb 8, 2022
dfe7b36
Moved some checks out of listwalker
arkflpc Feb 8, 2022
6a84586
Code refactoring.
niegowski Feb 8, 2022
c63648a
Fix after code-review
arkflpc Feb 9, 2022
ab4baf4
Apply review comment.
niegowski Feb 9, 2022
76f2f50
Fix after code-review
arkflpc Feb 9, 2022
3eb6716
Fix after code-review
arkflpc Feb 9, 2022
2631672
Reordered imports.
niegowski Feb 9, 2022
fe4e747
Fix after code-review
arkflpc Feb 9, 2022
33c3686
Merge pull request #11232 from ckeditor/ck/11166-document-list-style-…
niegowski Feb 9, 2022
b961f99
Merge branch 'ck/11065-document-list-properties' into ck/11166-docume…
arkflpc Feb 9, 2022
f44ea13
Fix after merge
arkflpc Feb 9, 2022
99d688d
Added tests.
niegowski Feb 9, 2022
48c07b0
Added tests.
niegowski Feb 9, 2022
4f53064
Docs: human-oriented description expansion.
godai78 Feb 10, 2022
6903f8a
Docs: human-oriented description expansion.
godai78 Feb 10, 2022
4b79e9c
Added DocumentListStartCommand
arkflpc Feb 10, 2022
4b6e77f
Add manual test for document list properties
arkflpc Feb 10, 2022
6d75d82
Add manual test for document list properties
arkflpc Feb 10, 2022
b3d6658
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 10, 2022
cf0e4fd
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 10, 2022
5166ee3
Code refactor - extracted isListItemBlock helper.
niegowski Feb 10, 2022
d17f314
Extracted list of base list attributes to a common const.
niegowski Feb 10, 2022
6a94cbf
Merge branch 'ck/11065-document-list-properties' into ck/11166-docume…
niegowski Feb 10, 2022
201e679
Added support for selected block widgets in a document list.
niegowski Feb 10, 2022
077e447
Added support for selected block widgets in a document list.
niegowski Feb 10, 2022
8b3b559
Document list properties: tests for selected block widgets
arkflpc Feb 14, 2022
64aa574
Merge pull request #11249 from ckeditor/ck/11166-document-list-start-…
niegowski Feb 15, 2022
6ae2416
Docs fixes.
niegowski Feb 16, 2022
db1b775
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 16, 2022
5488430
Review fixes.
oleq Feb 17, 2022
0736e1c
Apply suggestions from code review.
oleq Feb 17, 2022
7ab1b7c
Docs.
oleq Feb 17, 2022
f9c4f4b
Generic post-fixer for DocumentLists (impementation)
arkflpc Feb 21, 2022
379e75e
Generic post-fixer for DocumentLists (tests & fixes)
arkflpc Feb 22, 2022
0d79394
Generic post-fixer for DocumentLists (test coverage)
arkflpc Feb 22, 2022
00f8853
Generic post-fixer for DocumentLists (more tests)
arkflpc Feb 22, 2022
7d2c2dd
Generic post-fixer for DocumentLists (removing paragraph between lists)
arkflpc Feb 23, 2022
dc28106
Review fixes.
niegowski Feb 23, 2022
3348b80
Apply suggestions from code review
arkflpc Feb 24, 2022
3a7ab88
Generic post-fixer for DocumentLists (more tests)
arkflpc Feb 24, 2022
51440d3
Generic post-fixer for DocumentLists (fixes after code review)
arkflpc Feb 24, 2022
57d92f5
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 24, 2022
5848160
Code cleaning.
niegowski Feb 24, 2022
7487cb6
Merge pull request #11329 from ckeditor/ck/11167-document-list-proper…
niegowski Feb 24, 2022
0de26c6
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 27, 2022
04bfd90
Reset document list properties after indent
arkflpc Mar 2, 2022
08d3d29
Fix docs
arkflpc Mar 3, 2022
ec1cb19
Merge pull request #11380 from ckeditor/ck/11357-reset-list-propertie…
oleq Mar 3, 2022
ae53fd5
Review fixes.
niegowski Mar 7, 2022
02d3ca7
Fixed test names.
niegowski Mar 7, 2022
d7e6729
Docs fixes.
niegowski Mar 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion packages/ckeditor5-engine/src/view/domconverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,22 @@ export default class DomConverter {
yield this._getBlockFiller( domDocument );
}

yield this.viewToDom( childView, domDocument, options );
const transparentRendering = childView.is( 'element' ) && childView.getCustomProperty( 'dataPipeline:transparentRendering' );

if ( transparentRendering && this.renderingMode == 'data' ) {
yield* this.viewChildrenToDom( childView, domDocument, options );
} else {
if ( transparentRendering ) {
/**
* The `dataPipeline:transparentRendering` flag is supported only in the data pipeline.
*
* @error domconverter-transparent-rendering-unsupported-in-editing-pipeline
*/
logWarning( 'domconverter-transparent-rendering-unsupported-in-editing-pipeline', { viewElement: childView } );
}

yield this.viewToDom( childView, domDocument, options );
}

offset++;
}
Expand Down
114 changes: 114 additions & 0 deletions packages/ckeditor5-engine/tests/view/domconverter/view-to-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,120 @@ describe( 'DomConverter', () => {
expect( domChildren[ 1 ].tagName.toLowerCase() ).to.equal( 'b' );
expect( domChildren[ 1 ].childNodes.length ).to.equal( 0 );
} );

describe( 'transparentRendering custom property', () => {
it( 'should be transparent in the data pipeline', () => {
converter.renderingMode = 'data';
converter.blockFillerMode = 'nbsp';

const warnStub = testUtils.sinon.stub( console, 'warn' );

const viewList = parse(
'<container:div>' +
'<attribute:ul>' +
'<attribute:li>' +
'<container:p>foo<attribute:b>bar</attribute:b></container:p>' +
'</attribute:li>' +
'<attribute:li>' +
'<container:p>abc</container:p>' +
'<container:p>123</container:p>' +
'</attribute:li>' +
'</attribute:ul>' +
'</container:div>'
);

const bogusParagraph = viewList.getChild( 0 ).getChild( 0 ).getChild( 0 );

bogusParagraph._setCustomProperty( 'dataPipeline:transparentRendering', true );

const domDivChildren = Array.from( converter.viewChildrenToDom( viewList, document ) );

expect( domDivChildren.length ).to.equal( 1 );
expect( domDivChildren[ 0 ].tagName.toLowerCase() ).to.equal( 'ul' );

const domUlChildren = Array.from( domDivChildren[ 0 ].childNodes );

expect( domUlChildren.length ).to.equal( 2 );
expect( domUlChildren[ 0 ].tagName.toLowerCase() ).to.equal( 'li' );
expect( domUlChildren[ 1 ].tagName.toLowerCase() ).to.equal( 'li' );

const domUl1Children = Array.from( domUlChildren[ 0 ].childNodes );
const domUl2Children = Array.from( domUlChildren[ 1 ].childNodes );

expect( domUl1Children.length ).to.equal( 2 );
expect( domUl1Children[ 0 ].data ).to.equal( 'foo' );
expect( domUl1Children[ 1 ].tagName.toLowerCase() ).to.equal( 'b' );
expect( domUl1Children[ 1 ].firstChild.data ).to.equal( 'bar' );

expect( domUl2Children.length ).to.equal( 2 );
expect( domUl2Children[ 0 ].tagName.toLowerCase() ).to.equal( 'p' );
expect( domUl2Children[ 1 ].tagName.toLowerCase() ).to.equal( 'p' );
expect( domUl2Children[ 0 ].firstChild.data ).to.equal( 'abc' );
expect( domUl2Children[ 1 ].firstChild.data ).to.equal( '123' );

sinon.assert.notCalled( warnStub );
} );

it( 'should not be transparent in the editing pipeline', () => {
converter.renderingMode = 'editing';
converter.blockFillerMode = 'br';

const warnStub = testUtils.sinon.stub( console, 'warn' );

const viewList = parse(
'<container:div>' +
'<attribute:ul>' +
'<attribute:li>' +
'<container:p>foo<attribute:b>bar</attribute:b></container:p>' +
'</attribute:li>' +
'<attribute:li>' +
'<container:p>abc</container:p>' +
'<container:p>123</container:p>' +
'</attribute:li>' +
'</attribute:ul>' +
'</container:div>'
);

const bogusParagraph = viewList.getChild( 0 ).getChild( 0 ).getChild( 0 );

bogusParagraph._setCustomProperty( 'dataPipeline:transparentRendering', true );

const domDivChildren = Array.from( converter.viewChildrenToDom( viewList, document ) );

expect( domDivChildren.length ).to.equal( 1 );
expect( domDivChildren[ 0 ].tagName.toLowerCase() ).to.equal( 'ul' );

const domUlChildren = Array.from( domDivChildren[ 0 ].childNodes );

expect( domUlChildren.length ).to.equal( 2 );
expect( domUlChildren[ 0 ].tagName.toLowerCase() ).to.equal( 'li' );
expect( domUlChildren[ 1 ].tagName.toLowerCase() ).to.equal( 'li' );

const domUl1Children = Array.from( domUlChildren[ 0 ].childNodes );
const domUl2Children = Array.from( domUlChildren[ 1 ].childNodes );

expect( domUl1Children.length ).to.equal( 1 );
expect( domUl1Children[ 0 ].tagName.toLowerCase() ).to.equal( 'p' );
expect( domUl1Children[ 0 ].childNodes[ 0 ].data ).to.equal( 'foo' );
expect( domUl1Children[ 0 ].childNodes[ 1 ].tagName.toLowerCase() ).to.equal( 'b' );
expect( domUl1Children[ 0 ].childNodes[ 1 ].firstChild.data ).to.equal( 'bar' );

expect( domUl2Children.length ).to.equal( 2 );
expect( domUl2Children[ 0 ].tagName.toLowerCase() ).to.equal( 'p' );
expect( domUl2Children[ 1 ].tagName.toLowerCase() ).to.equal( 'p' );
expect( domUl2Children[ 0 ].firstChild.data ).to.equal( 'abc' );
expect( domUl2Children[ 1 ].firstChild.data ).to.equal( '123' );

sinon.assert.calledOnce( warnStub );
sinon.assert.calledWithExactly( warnStub,
sinon.match( /^domconverter-transparent-rendering-unsupported-in-editing-pipeline/ ),
{
viewElement: bogusParagraph
},
sinon.match.string // Link to the documentation
);
} );
} );
} );

describe( 'viewPositionToDom()', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@ckeditor/ckeditor5-html-support": "^32.0.0",
"@ckeditor/ckeditor5-image": "^32.0.0",
"@ckeditor/ckeditor5-indent": "^32.0.0",
"@ckeditor/ckeditor5-inspector": "^3.0.0",
niegowski marked this conversation as resolved.
Show resolved Hide resolved
"@ckeditor/ckeditor5-link": "^32.0.0",
"@ckeditor/ckeditor5-media-embed": "^32.0.0",
"@ckeditor/ckeditor5-page-break": "^32.0.0",
Expand Down
Loading