mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-05 18:58:51 +00:00
Make textContainerInset configurable for ASEditableTextNode placeholder and typed textViews
Previously, it was only possible to configure the textContainerInset of the typed textView by accessing the textView property on didLoad. This would cause the placeholder and typed textViews to become desynced however, so in this commit we add the ability to configure both.
This commit is contained in:
@@ -78,7 +78,8 @@
|
||||
_textKitComponents.layoutManager.delegate = self;
|
||||
_wordKerner = [[ASTextNodeWordKerner alloc] init];
|
||||
_returnKeyType = UIReturnKeyDefault;
|
||||
|
||||
_textContainerInset = UIEdgeInsetsZero;
|
||||
|
||||
// Create the placeholder scaffolding.
|
||||
_placeholderTextKitComponents = [ASTextKitComponents componentsWithAttributedSeedString:nil textContainerSize:CGSizeZero];
|
||||
_placeholderTextKitComponents.layoutManager.delegate = self;
|
||||
@@ -122,7 +123,7 @@
|
||||
textView.backgroundColor = nil;
|
||||
textView.opaque = NO;
|
||||
}
|
||||
textView.textContainerInset = UIEdgeInsetsZero;
|
||||
textView.textContainerInset = self.textContainerInset;
|
||||
textView.clipsToBounds = NO; // We don't want selection handles cut off.
|
||||
};
|
||||
|
||||
@@ -175,6 +176,15 @@
|
||||
_placeholderTextKitComponents.textView.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset
|
||||
{
|
||||
ASDN::MutexLocker l(_textKitLock);
|
||||
|
||||
_textContainerInset = textContainerInset;
|
||||
_textKitComponents.textView.textContainerInset = textContainerInset;
|
||||
_placeholderTextKitComponents.textView.textContainerInset = textContainerInset;
|
||||
}
|
||||
|
||||
- (void)setOpaque:(BOOL)opaque
|
||||
{
|
||||
[super setOpaque:opaque];
|
||||
|
||||
Reference in New Issue
Block a user