From 1dc609bce51eb96fdffae5f0d1e02abcf2b7fa44 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:19:33 +0000 Subject: [PATCH] Fix dictation when using the Rich Text Editor. (#7752) --- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- Riot/Generated/Strings.swift | 4 ++-- .../Modules/Room/Composer/View/Composer.swift | 18 ++++++++---------- changelog.d/7752.bugfix | 1 + project.yml | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 changelog.d/7752.bugfix diff --git a/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved index 47f1e5fe62..2f19e2ddc5 100644 --- a/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/matrix-org/matrix-wysiwyg-composer-swift", "state" : { - "revision" : "0aa1308c43451fd077e332f72d6a32135f258834", - "version" : "2.19.0" + "revision" : "f788fe2482c0b89019f679a1f43dccf9c25a0782", + "version" : "2.29.0" } }, { diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index aa3ca9d725..f5cc6ae5be 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -9599,7 +9599,7 @@ public class VectorL10n: NSObject { public static var wysiwygComposerFormatActionQuote: String { return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_quote") } - /// Apply underline format + /// Apply strikethrough format public static var wysiwygComposerFormatActionStrikethrough: String { return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_strikethrough") } @@ -9607,7 +9607,7 @@ public class VectorL10n: NSObject { public static var wysiwygComposerFormatActionUnIndent: String { return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_un_indent") } - /// Apply strikethrough format + /// Apply underline format public static var wysiwygComposerFormatActionUnderline: String { return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_underline") } diff --git a/RiotSwiftUI/Modules/Room/Composer/View/Composer.swift b/RiotSwiftUI/Modules/Room/Composer/View/Composer.swift index f2a60ce066..5850980920 100644 --- a/RiotSwiftUI/Modules/Room/Composer/View/Composer.swift +++ b/RiotSwiftUI/Modules/Room/Composer/View/Composer.swift @@ -137,7 +137,7 @@ struct Composer: View { placeholder: viewModel.viewState.placeholder ?? "", viewModel: wysiwygViewModel, itemProviderHelper: nil, - keyCommandHandler: handleKeyCommand, + keyCommands: keyCommands, pasteHandler: nil ) .clipped() @@ -228,15 +228,13 @@ struct Composer: View { } } - func handleKeyCommand(_ keyCommand: WysiwygKeyCommand) -> Bool { - switch keyCommand { - case .enter: - sendMessageAction(wysiwygViewModel.content) - wysiwygViewModel.clearContent() - return true - case .shiftEnter: - return false - } + var keyCommands: [WysiwygKeyCommand] { + [ + .enter { + sendMessageAction(wysiwygViewModel.content) + wysiwygViewModel.clearContent() + } + ] } /// Computes the total height of the composer (excluding the RTE formatting bar). diff --git a/changelog.d/7752.bugfix b/changelog.d/7752.bugfix new file mode 100644 index 0000000000..d7660edc8d --- /dev/null +++ b/changelog.d/7752.bugfix @@ -0,0 +1 @@ +Fix dictation when using the Rich Text Editor \ No newline at end of file diff --git a/project.yml b/project.yml index 55f31044e6..3d410864a3 100644 --- a/project.yml +++ b/project.yml @@ -59,7 +59,7 @@ packages: branch: 0.0.1 WysiwygComposer: url: https://github.com/matrix-org/matrix-wysiwyg-composer-swift - version: 2.19.0 + version: 2.29.0 DeviceKit: url: https://github.com/devicekit/DeviceKit majorVersion: 4.7.0