1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-28 15:22:05 +03:00

Happily handle empty text messages (#6825)

This commig refactors the message-deletion modal and reuses it for case of removing
the entire message and trying to send it, which should trigger removal flow instead.

Fix vector-im/element-web#18873
This commit is contained in:
Dariusz Niemczyk
2021-09-28 16:04:25 +02:00
committed by GitHub
parent e95e59e2eb
commit 8331d4c7b7
4 changed files with 57 additions and 31 deletions

View File

@ -185,7 +185,7 @@ export function startsWith(model: EditorModel, prefix: string, caseSensitive = t
const firstPart = model.parts[0];
// part type will be "plain" while editing,
// and "command" while composing a message.
let text = firstPart && firstPart.text;
let text = firstPart?.text || '';
if (!caseSensitive) {
prefix = prefix.toLowerCase();
text = text.toLowerCase();