forked from Mirrors/gomuks
web/composer: allow autocompleting after newline
This commit is contained in:
parent
72e1bd428e
commit
1e73867b9b
1 changed files with 8 additions and 2 deletions
|
@ -175,7 +175,13 @@ const MessageComposer = () => {
|
||||||
}
|
}
|
||||||
} else if (area.selectionStart === area.selectionEnd) {
|
} else if (area.selectionStart === area.selectionEnd) {
|
||||||
const acType = charToAutocompleteType(newText?.slice(area.selectionStart - 1, area.selectionStart))
|
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({
|
setAutocomplete({
|
||||||
type: acType,
|
type: acType,
|
||||||
query: "",
|
query: "",
|
||||||
|
|
Loading…
Add table
Reference in a new issue