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

Added DocumentListStyle command #11232

Conversation

arkflpc
Copy link
Contributor

@arkflpc arkflpc commented Feb 7, 2022

Suggested merge commit message (convention)

Internal (list): Adds DocumentListStyleCommand. See #11166.


Additional information

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

@arkflpc arkflpc requested a review from niegowski February 7, 2022 16:46
Copy link
Contributor

@niegowski niegowski left a comment

Choose a reason for hiding this comment

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

Partial review (tests not verified).

* @protected
*/
execute( options = {} ) {
this._tryToConvertItemsToList( options );
Copy link
Contributor

Choose a reason for hiding this comment

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

You should wrap both model changes (changing the list type and changing the list style) in a single change block, otherwise, it would generate 2 separate undo steps.

}
this._tryToConvertItemsToList( options );

model.enqueueChange( writer.batch, writer => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be required, commands executed inside a change block will automatically be a part of the outermost change block.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you needed this to make the following blocks pass the block.hasAttribute( 'listStyle' ) test that was added by the post-fixer after the first change block and before the enqueueChange block but you could check whether the selected blocks are list items at all.

packages/ckeditor5-list/src/documentlist/utils/model.js Outdated Show resolved Hide resolved
@niegowski
Copy link
Contributor

I pushed some proposals of changes: 6a84586.

@niegowski niegowski merged commit 33c3686 into ck/11065-document-list-properties Feb 9, 2022
@niegowski niegowski deleted the ck/11166-document-list-style-command branch February 9, 2022 10:48
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.

2 participants