-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Added DocumentListStyle command #11232
Conversation
There was a problem hiding this 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 ); |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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/documentlistproperties/documentliststylecommand.js
Show resolved
Hide resolved
packages/ckeditor5-list/src/documentlistproperties/documentliststylecommand.js
Show resolved
Hide resolved
packages/ckeditor5-list/tests/documentlist/documentlistcommand.js
Outdated
Show resolved
Hide resolved
packages/ckeditor5-list/tests/documentlistproperties/documentliststylecommand.js
Outdated
Show resolved
Hide resolved
I pushed some proposals of changes: 6a84586. |
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.