exit list more sanely on backspace

pull/21833/head
Matthew Hodgson 2018-05-19 21:14:39 +01:00
parent a4d9338cf0
commit 58670cc3e5
1 changed files with 3 additions and 2 deletions

View File

@ -572,8 +572,9 @@ export default class MessageComposerInput extends React.Component {
if (this.state.isRichtextEnabled) {
// let backspace exit lists
const isList = this.hasBlock('list-item');
if (isList) {
const change = this.state.editorState.change();
const { editorState } = this.state;
if (isList && editorState.anchorOffset == 0) {
const change = editorState.change();
change
.setBlocks(DEFAULT_NODE)
.unwrapBlock('bulleted-list')