Merge pull request #1275 from matrix-org/luke/fix-rte-ctrl-a-backspace

Fix ctrl+a, backspace toggling block format
pull/21833/head
Luke Barnard 2017-08-07 17:58:07 +01:00 committed by GitHub
commit aa4cc882e9
1 changed files with 2 additions and 1 deletions

View File

@ -519,7 +519,8 @@ export default class MessageComposerInput extends React.Component {
newState = RichUtils.toggleInlineStyle(this.state.editorState, 'STRIKETHROUGH'); newState = RichUtils.toggleInlineStyle(this.state.editorState, 'STRIKETHROUGH');
} else if (shouldToggleBlockFormat) { } else if (shouldToggleBlockFormat) {
const currentStartOffset = this.state.editorState.getSelection().getStartOffset(); const currentStartOffset = this.state.editorState.getSelection().getStartOffset();
if (currentStartOffset === 0) { const currentEndOffset = this.state.editorState.getSelection().getEndOffset();
if (currentStartOffset === 0 && currentEndOffset === 0) {
// Toggle current block type (setting it to 'unstyled') // Toggle current block type (setting it to 'unstyled')
newState = RichUtils.toggleBlockType(this.state.editorState, currentBlockType); newState = RichUtils.toggleBlockType(this.state.editorState, currentBlockType);
} }