diff --git a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift index c8fa228555..87449c1cba 100644 --- a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift @@ -679,7 +679,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { if let previousAdditionalSideInsets = previousAdditionalSideInsets, previousAdditionalSideInsets.right != additionalSideInsets.right { additionalOffset = (previousAdditionalSideInsets.right - additionalSideInsets.right) / 3.0 - if case let .animated(duration, _) = transition { + if case .animated = transition { transition = .animated(duration: 0.2, curve: .easeInOut) } } @@ -1777,17 +1777,25 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { func editableTextNodeTarget(forAction action: Selector) -> ASEditableTextNodeTargetForAction? { if action == Selector(("_accessibilitySpeak:")) { - if let textInputNode = self.textInputNode, textInputNode.selectedRange.length > 0 { + if case .format = self.inputMenu.state { + return ASEditableTextNodeTargetForAction(target: nil) + } else if let textInputNode = self.textInputNode, textInputNode.selectedRange.length > 0 { return ASEditableTextNodeTargetForAction(target: self) } else { return ASEditableTextNodeTargetForAction(target: nil) } - } else if action == Selector("_accessibilitySpeakLanguageSelection:") { - return ASEditableTextNodeTargetForAction(target: nil) - } else if action == Selector("_accessibilityPauseSpeaking:") { - return ASEditableTextNodeTargetForAction(target: nil) + } else if action == Selector(("_accessibilitySpeakSpellOut:")) { + if case .format = self.inputMenu.state { + return ASEditableTextNodeTargetForAction(target: nil) + } else if let textInputNode = self.textInputNode, textInputNode.selectedRange.length > 0 { + return nil + } else { + return ASEditableTextNodeTargetForAction(target: nil) + } } - else if action == Selector(("_showTextStyleOptions:")) { + else if action == Selector("_accessibilitySpeakLanguageSelection:") || action == Selector("_accessibilityPauseSpeaking:") || action == Selector("_accessibilitySpeakSentence:") { + return ASEditableTextNodeTargetForAction(target: nil) + } else if action == Selector(("_showTextStyleOptions:")) { if case .general = self.inputMenu.state { if let textInputNode = self.textInputNode, textInputNode.attributedText == nil || textInputNode.attributedText!.length == 0 || textInputNode.selectedRange.length == 0 { return ASEditableTextNodeTargetForAction(target: nil) @@ -1816,6 +1824,13 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { return (current, inputMode) } speakText(text) + + if #available(iOS 13.0, *) { + UIMenuController.shared.hideMenu() + } else { + UIMenuController.shared.isMenuVisible = false + UIMenuController.shared.update() + } } @objc func _showTextStyleOptions(_ sender: Any) {