mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix text input layout
This commit is contained in:
parent
68ab84bed4
commit
58c7102007
@ -172,8 +172,10 @@
|
|||||||
|
|
||||||
// If our text-view's width is already the constrained width, we can use our existing TextKit stack for this sizing calculation.
|
// If our text-view's width is already the constrained width, we can use our existing TextKit stack for this sizing calculation.
|
||||||
// Otherwise, we create a temporary stack to size for `constrainedWidth`.
|
// Otherwise, we create a temporary stack to size for `constrainedWidth`.
|
||||||
|
UIEdgeInsets additionalInsets = UIEdgeInsetsZero;
|
||||||
if (CGRectGetWidth(components.textView.threadSafeBounds) != constrainedWidth) {
|
if (CGRectGetWidth(components.textView.threadSafeBounds) != constrainedWidth) {
|
||||||
components = [ASTextKitComponents componentsWithAttributedSeedString:components.textStorage textContainerSize:CGSizeMake(constrainedWidth, CGFLOAT_MAX)];
|
additionalInsets = self.textView.textContainerInset;
|
||||||
|
components = [ASTextKitComponents componentsWithAttributedSeedString:components.textStorage textContainerSize:CGSizeMake(constrainedWidth - additionalInsets.left - additionalInsets.right, CGFLOAT_MAX)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force glyph generation and layout, which may not have happened yet (and isn't triggered by -usedRectForTextContainer:).
|
// Force glyph generation and layout, which may not have happened yet (and isn't triggered by -usedRectForTextContainer:).
|
||||||
|
@ -581,13 +581,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateInputTextState(_ state: ChatTextInputState, keepSendButtonEnabled: Bool, extendedSearchLayout: Bool, accessoryItems: [ChatTextInputAccessoryItem], animated: Bool) {
|
func updateInputTextState(_ state: ChatTextInputState, keepSendButtonEnabled: Bool, extendedSearchLayout: Bool, accessoryItems: [ChatTextInputAccessoryItem], animated: Bool) {
|
||||||
if state.inputText.length != 0 && self.textInputNode == nil {
|
if let currentState = self.presentationInterfaceState {
|
||||||
self.loadTextInputNode()
|
|
||||||
}
|
|
||||||
|
|
||||||
if let textInputNode = self.textInputNode, let currentState = self.presentationInterfaceState {
|
|
||||||
self.updatingInputState = true
|
|
||||||
|
|
||||||
var updateAccessoryButtons = false
|
var updateAccessoryButtons = false
|
||||||
if accessoryItems.count == self.accessoryItemButtons.count {
|
if accessoryItems.count == self.accessoryItemButtons.count {
|
||||||
for i in 0 ..< accessoryItems.count {
|
for i in 0 ..< accessoryItems.count {
|
||||||
@ -624,6 +618,14 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
|||||||
}
|
}
|
||||||
self.accessoryItemButtons = updatedButtons
|
self.accessoryItemButtons = updatedButtons
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if state.inputText.length != 0 && self.textInputNode == nil {
|
||||||
|
self.loadTextInputNode()
|
||||||
|
}
|
||||||
|
|
||||||
|
if let textInputNode = self.textInputNode, let _ = self.presentationInterfaceState {
|
||||||
|
self.updatingInputState = true
|
||||||
|
|
||||||
var textColor: UIColor = .black
|
var textColor: UIColor = .black
|
||||||
var accentTextColor: UIColor = .blue
|
var accentTextColor: UIColor = .blue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user