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

Group changes into one batch #14060

Merged

Conversation

illia-stv
Copy link
Contributor

@illia-stv illia-stv commented May 8, 2023

Suggested merge commit message (convention)

Feature: Group changes into one batch. Closes #3162.


Additional information

For example – encountered issues, assumptions you had to make, other affected tickets, etc.

@illia-stv illia-stv changed the base branch from master to ck/epic/2356-color-picker May 8, 2023 10:18
@Dumluregn Dumluregn self-requested a review May 8, 2023 12:25
Copy link
Contributor

@Dumluregn Dumluregn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally it's ok (solution propagated from table cell properties UI), but let's improve its architecture a bit. Tests will need to be updated probably.

packages/ckeditor5-font/src/ui/colorui.ts Outdated Show resolved Hide resolved
packages/ckeditor5-font/src/ui/colorui.ts Outdated Show resolved Hide resolved
packages/ckeditor5-font/src/ui/colorui.ts Outdated Show resolved Hide resolved
Comment on lines 227 to 236
it( 'should use parent batch for storing undo steps', () => {
it( 'should use provided batch', () => {
setData( model, '<paragraph>a[bc<$text font="foo">fo]obar</$text>xyz</paragraph>' );
const batch = model.createBatch();
const spy = sinon.spy( model, 'enqueueChange' );

model.change( writer => {
expect( writer.batch.operations.length ).to.equal( 0 );
command.execute( { value: 'foo' } );
expect( writer.batch.operations.length ).to.equal( 1 );
} );

expect( getData( model ) ).to.equal( '<paragraph>a[<$text font="foo">bcfo]obar</$text>xyz</paragraph>' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having both tests (the old one and new one) makes sense - depending on whether you've passed the batch as a parameter.

packages/ckeditor5-font/src/ui/colortableview.ts Outdated Show resolved Hide resolved
packages/ckeditor5-font/tests/ui/colorui.js Outdated Show resolved Hide resolved
packages/ckeditor5-font/tests/ui/colorui.js Show resolved Hide resolved
@illia-stv illia-stv requested a review from Dumluregn May 8, 2023 15:38
@@ -20,7 +21,7 @@ describe( 'Integration test Font', () => {

return ClassicTestEditor
.create( element, {
plugins: [ Font, ArticlePluginSet ],
plugins: [ Font, ArticlePluginSet, Undo ],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo is included in Essentials which are included in ArticlePluginSet.

@Dumluregn Dumluregn merged commit 8eb9509 into ck/epic/2356-color-picker May 8, 2023
@Dumluregn Dumluregn deleted the ck/3162-group-changes-inot-one-batch branch May 8, 2023 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants