Skip to content

Commit

Permalink
Add modifier key exceptions to prevent deletion or merge of blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Aug 6, 2018
1 parent 6d7e4b1 commit f088914
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,12 @@ export class RichText extends Component {
( keyCode === BACKSPACE && isHorizontalEdge( rootNode, true ) ) ||
( keyCode === DELETE && isHorizontalEdge( rootNode, false ) )
) {
// These modifiers would not result in modification of text content,
// if they're pressed they should not cause merge or deletion of blocks.
if ( ( event.metaKey || event.ctrlKey || event.altKey ) && event.shiftKey ) {
return;
}

if ( ! this.props.onMerge && ! this.props.onRemove ) {
return;
}
Expand Down

0 comments on commit f088914

Please sign in to comment.