You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-06 10:22:45 +03:00
rte: special return handling for some block types
This commit is contained in:
@@ -513,9 +513,16 @@ export default class MessageComposerInput extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handleReturn = (ev) => {
|
handleReturn = (ev) => {
|
||||||
if (ev.shiftKey) {
|
const currentBlockType = RichUtils.getCurrentBlockType(this.state.editorState);
|
||||||
this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState));
|
// If we're in any of these three types of blocks, shift enter should insert soft newlines
|
||||||
return true;
|
// And just enter should end the block
|
||||||
|
if(['blockquote', 'unordered-list-item', 'ordered-list-item'].includes(currentBlockType)) {
|
||||||
|
if(ev.shiftKey) {
|
||||||
|
this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentState = this.state.editorState.getCurrentContent();
|
const contentState = this.state.editorState.getCurrentContent();
|
||||||
|
Reference in New Issue
Block a user