diff --git a/web/src/ui/composer/MessageComposer.tsx b/web/src/ui/composer/MessageComposer.tsx index 6a3b880..5585570 100644 --- a/web/src/ui/composer/MessageComposer.tsx +++ b/web/src/ui/composer/MessageComposer.tsx @@ -68,7 +68,7 @@ const draftStore = { } }, set: (roomID: RoomID, data: ComposerState) => localStorage.setItem(`draft-${roomID}`, JSON.stringify(data)), - clear: (roomID: RoomID)=> localStorage.removeItem(`draft-${roomID}`), + clear: (roomID: RoomID) => localStorage.removeItem(`draft-${roomID}`), } type CaretEvent = React.MouseEvent | React.KeyboardEvent | React.ChangeEvent @@ -175,7 +175,13 @@ const MessageComposer = () => { } } else if (area.selectionStart === area.selectionEnd) { const acType = charToAutocompleteType(newText?.slice(area.selectionStart - 1, area.selectionStart)) - if (acType && (area.selectionStart === 1 || newText?.[area.selectionStart - 2] === " ")) { + if ( + acType && ( + area.selectionStart === 1 + || newText?.[area.selectionStart - 2] === " " + || newText?.[area.selectionStart - 2] === "\n" + ) + ) { setAutocomplete({ type: acType, query: "",