fix: auto complete in Compose scene not trigger delegate issue. resolve #300

This commit is contained in:
CMK 2021-10-25 16:59:31 +08:00
parent 2f3cd5b8eb
commit 6b12adb9c5
1 changed files with 3 additions and 1 deletions

View File

@ -1275,7 +1275,6 @@ extension ComposeViewController: AutoCompleteViewControllerDelegate {
case .bottomLoader:
return nil
}
text.append(" ")
return text
}()
guard let replacedText = _replacedText else { return }
@ -1286,6 +1285,9 @@ extension ComposeViewController: AutoCompleteViewControllerDelegate {
let range = NSRange(info.toHighlightEndRange, in: text)
textEditorView.textStorage.replaceCharacters(in: range, with: replacedText)
DispatchQueue.main.async {
textEditorView.textView.insertText(" ") // trigger textView delegate update
}
viewModel.autoCompleteInfo.value = nil
switch item {