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

Commit

Permalink
Numbered list works now with "1" instead of any digit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Piechaczek committed Mar 20, 2019
1 parent c7741f7 commit 06cb41d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/autoformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class Autoformat extends Plugin {

if ( commands.get( 'numberedList' ) ) {
// eslint-disable-next-line no-new
new BlockAutoformatEditing( this.editor, /^\d+[.|)]\s$/, 'numberedList' );
new BlockAutoformatEditing( this.editor, /^1[.|)]\s$/, 'numberedList' );
}
}

Expand Down
9 changes: 9 additions & 0 deletions tests/autoformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ describe( 'Autoformat', () => {

expect( getData( model ) ).to.equal( '<listItem listIndent="0" listType="numbered">1. []</listItem>' );
} );

it( 'should not replace digit with numbered list item when digit is different than "1"', () => {
setData( model, '<paragraph>3.[]</paragraph>' );
model.change( writer => {
writer.insertText( ' ', doc.selection.getFirstPosition() );
} );

expect( getData( model ) ).to.equal( '<paragraph>3. []</paragraph>' );
} );
} );

describe( 'Heading', () => {
Expand Down

0 comments on commit 06cb41d

Please sign in to comment.