mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Various Fixes
This commit is contained in:
@@ -14,6 +14,7 @@ import TouchDownGesture
|
||||
import ImageTransparency
|
||||
import ActivityIndicator
|
||||
import AnimationUI
|
||||
import Speak
|
||||
|
||||
private let accessoryButtonFont = Font.medium(14.0)
|
||||
private let counterFont = Font.with(size: 14.0, design: .regular, traits: [.monospacedNumbers])
|
||||
@@ -1775,7 +1776,18 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
}
|
||||
|
||||
func editableTextNodeTarget(forAction action: Selector) -> ASEditableTextNodeTargetForAction? {
|
||||
if action == Selector(("_showTextStyleOptions:")) {
|
||||
if action == Selector(("_accessibilitySpeak:")) {
|
||||
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(("_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)
|
||||
@@ -1797,6 +1809,15 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
return nil
|
||||
}
|
||||
|
||||
@objc func _accessibilitySpeak(_ sender: Any) {
|
||||
var text = ""
|
||||
self.interfaceInteraction?.updateTextInputStateAndMode { current, inputMode in
|
||||
text = current.inputText.attributedSubstring(from: NSMakeRange(current.selectionRange.lowerBound, current.selectionRange.count)).string
|
||||
return (current, inputMode)
|
||||
}
|
||||
speakText(text)
|
||||
}
|
||||
|
||||
@objc func _showTextStyleOptions(_ sender: Any) {
|
||||
if let textInputNode = self.textInputNode {
|
||||
self.inputMenu.format(view: textInputNode.view, rect: textInputNode.selectionRect.offsetBy(dx: 0.0, dy: -textInputNode.textView.contentOffset.y).insetBy(dx: 0.0, dy: -1.0))
|
||||
|
||||
Reference in New Issue
Block a user