diff --git a/cypress/integration/markdown_widget_backspace_spec.js b/cypress/integration/markdown_widget_backspace_spec.js index 67c41d61..79389d4e 100644 --- a/cypress/integration/markdown_widget_backspace_spec.js +++ b/cypress/integration/markdown_widget_backspace_spec.js @@ -25,6 +25,17 @@ describe('Markdown widget', () => {

`); }); + it('moves to previous block when no character left to delete', () => { + cy.focused() + .type('foo') + .enter() + .clickHeadingOneButton() + .type('a') + .backspace({times: 2}) + .confirmMarkdownEditorContent(` +

foo

+ `); + }); it('does nothing at start of first block in document when non-empty and non-default', () => { cy.focused() .clickHeadingOneButton() diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/CloseBlock.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/CloseBlock.js index 9f44685a..4c2b05a7 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/CloseBlock.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/CloseBlock.js @@ -15,7 +15,7 @@ function CloseBlock({ defaultType }) { return next(); } if (startBlock.type !== defaultType) { - return editor.setBlocks(defaultType); + editor.setBlocks(defaultType); } return next(); },