mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Add support for configuring on ASEditableTextNode.
This commit is contained in:
@@ -50,6 +50,11 @@
|
|||||||
//! @abstract The text input mode used by the receiver's keyboard, if it is visible. This value is undefined if the receiver is not the first responder.
|
//! @abstract The text input mode used by the receiver's keyboard, if it is visible. This value is undefined if the receiver is not the first responder.
|
||||||
@property (nonatomic, readonly) UITextInputMode *textInputMode;
|
@property (nonatomic, readonly) UITextInputMode *textInputMode;
|
||||||
|
|
||||||
|
/*
|
||||||
|
@abstract The returnKeyType of the keyboard. This value defaults to UIReturnKeyDefault.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, readwrite) UIReturnKeyType returnKeyType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@abstract Indicates whether the receiver's text view is the first responder, and thus has the keyboard visible and is prepared for editing by the user.
|
@abstract Indicates whether the receiver's text view is the first responder, and thus has the keyboard visible and is prepared for editing by the user.
|
||||||
@result YES if the receiver's text view is the first-responder; NO otherwise.
|
@result YES if the receiver's text view is the first-responder; NO otherwise.
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
_textKitComponents = [ASTextKitComponents componentsWithAttributedSeedString:nil textContainerSize:CGSizeZero];
|
_textKitComponents = [ASTextKitComponents componentsWithAttributedSeedString:nil textContainerSize:CGSizeZero];
|
||||||
_textKitComponents.layoutManager.delegate = self;
|
_textKitComponents.layoutManager.delegate = self;
|
||||||
_wordKerner = [[ASTextNodeWordKerner alloc] init];
|
_wordKerner = [[ASTextNodeWordKerner alloc] init];
|
||||||
|
_returnKeyType = UIReturnKeyDefault;
|
||||||
|
|
||||||
// Create the placeholder scaffolding.
|
// Create the placeholder scaffolding.
|
||||||
_placeholderTextKitComponents = [ASTextKitComponents componentsWithAttributedSeedString:nil textContainerSize:CGSizeZero];
|
_placeholderTextKitComponents = [ASTextKitComponents componentsWithAttributedSeedString:nil textContainerSize:CGSizeZero];
|
||||||
@@ -138,6 +139,7 @@
|
|||||||
_textKitComponents.textView.delegate = self;
|
_textKitComponents.textView.delegate = self;
|
||||||
_textKitComponents.textView.editable = YES;
|
_textKitComponents.textView.editable = YES;
|
||||||
_textKitComponents.textView.typingAttributes = _typingAttributes;
|
_textKitComponents.textView.typingAttributes = _typingAttributes;
|
||||||
|
_textKitComponents.textView.returnKeyType = _returnKeyType;
|
||||||
_textKitComponents.textView.accessibilityHint = _placeholderTextKitComponents.textStorage.string;
|
_textKitComponents.textView.accessibilityHint = _placeholderTextKitComponents.textStorage.string;
|
||||||
configureTextView(_textKitComponents.textView);
|
configureTextView(_textKitComponents.textView);
|
||||||
[self.view addSubview:_textKitComponents.textView];
|
[self.view addSubview:_textKitComponents.textView];
|
||||||
@@ -346,6 +348,13 @@
|
|||||||
return [_textKitComponents.textView textInputMode];
|
return [_textKitComponents.textView textInputMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setReturnKeyType:(UIReturnKeyType)returnKeyType
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(_textKitLock);
|
||||||
|
_returnKeyType = returnKeyType;
|
||||||
|
[_textKitComponents.textView setReturnKeyType:_returnKeyType];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)isFirstResponder
|
- (BOOL)isFirstResponder
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_textKitLock);
|
ASDN::MutexLocker l(_textKitLock);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
// simple editable text node. here we use it synchronously, but it fully supports async layout & display
|
// simple editable text node. here we use it synchronously, but it fully supports async layout & display
|
||||||
_textNode = [[ASEditableTextNode alloc] init];
|
_textNode = [[ASEditableTextNode alloc] init];
|
||||||
|
_textNode.returnKeyType = UIReturnKeyDone;
|
||||||
_textNode.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.1f];
|
_textNode.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.1f];
|
||||||
|
|
||||||
// with placeholder text (displayed if the user hasn't entered text)
|
// with placeholder text (displayed if the user hasn't entered text)
|
||||||
|
|||||||
Reference in New Issue
Block a user