mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
prevent exception if there is no text node at anchor
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
688776bc10
commit
414908611d
@ -382,7 +382,8 @@ export default class MessageComposerInput extends React.Component {
|
||||
const quote = Block.create('block-quote');
|
||||
if (this.state.isRichTextEnabled) {
|
||||
let change = editorState.change();
|
||||
if (editorState.anchorText.text === '' && editorState.anchorBlock.nodes.size === 1) {
|
||||
const anchorText = editorState.anchorText;
|
||||
if ((!anchorText || anchorText.text === '') && editorState.anchorBlock.nodes.size === 1) {
|
||||
// replace the current block rather than split the block
|
||||
change = change.replaceNodeByKey(editorState.anchorBlock.key, quote);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user