Skip to content

Commit

Permalink
Clear field entirely with backspace/delete
Browse files Browse the repository at this point in the history
  • Loading branch information
oarod committed Jul 19, 2017
1 parent 4ba4fff commit bed4605
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@
// Firefox thrown an error when calling `formatBlock` on an empty editable blockContainer that's not a <div>
if (MediumEditor.util.isMediumEditorElement(node) && node.children.length === 0 && !MediumEditor.util.isBlockContainer(node)) {
this.options.ownerDocument.execCommand('formatBlock', false, 'p');

// https://github.com/yabwe/medium-editor/issues/1350
// Pressing backspace/delete once more on an already empty field will clear it entirely
if (MediumEditor.util.isKey(event, [MediumEditor.util.keyCode.DELETE, MediumEditor.util.keyCode.BACKSPACE])) {
this.setContent(null);
}
}

// https://github.com/yabwe/medium-editor/issues/834
Expand Down

1 comment on commit bed4605

@clemsontiger
Copy link

Choose a reason for hiding this comment

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

anyone have the dist medium-editor.min.js file including this fix?

Please sign in to comment.