Set a keyCommandHandler, otherwise the placeholder will never be removed.

This commit is contained in:
Nicolas Mauri
2023-11-14 15:33:51 +01:00
parent 360d710d4f
commit 80ed0a31c4
2 changed files with 16 additions and 5 deletions

View File

@@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Cocoanetics/DTCoreText",
"state" : {
"revision" : "9d2d4d2296e5d2d852a7d3c592b817d913a5d020",
"version" : "1.6.27"
"revision" : "b664664825da565b4c2b7a17dbe2369f68ae43d9",
"version" : "1.6.26"
}
},
{
@@ -50,8 +50,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-wysiwyg-composer-swift",
"state" : {
"revision" : "1100b217c04d096dfe072afb4484660ff794d805",
"version" : "2.2.2"
"revision" : "379ab4d0ff194eba197606c56345e5718b2e3810",
"version" : "2.15.0"
}
},
{

View File

@@ -143,7 +143,7 @@ struct Composer: View {
placeholder: viewModel.viewState.placeholder ?? "",
viewModel: wysiwygViewModel,
itemProviderHelper: nil,
keyCommandHandler: nil,
keyCommandHandler: handleKeyCommand,
pasteHandler: nil
)
.onAppear {
@@ -219,6 +219,17 @@ struct Composer: View {
}
}
func handleKeyCommand(_ keyCommand: WysiwygKeyCommand) -> Bool {
switch keyCommand {
case .enter:
sendMessageAction(wysiwygViewModel.content)
wysiwygViewModel.clearContent()
return true
case .shiftEnter:
return false
}
}
// MARK: Public
init(