mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-22 02:23:16 +00:00
Various improvements
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
@property (nonatomic, copy) bool (^ _Nullable shouldPaste)();
|
||||
@property (nonatomic, copy) bool (^ _Nullable shouldRespondToAction)(SEL _Nullable);
|
||||
@property (nonatomic, copy) ChatInputTextViewImplTargetForAction * _Nullable (^ _Nullable targetForAction)(SEL _Nullable);
|
||||
@property (nonatomic, copy) bool (^ _Nullable shouldReturn)();
|
||||
@property (nonatomic, copy) bool (^ _Nullable shouldReturn)(UIKeyModifierFlags);
|
||||
@property (nonatomic, copy) void (^ _Nullable backspaceWhileEmpty)();
|
||||
@property (nonatomic, copy) void (^ _Nullable dropAutocorrectioniOS16)();
|
||||
|
||||
|
||||
@@ -136,15 +136,22 @@
|
||||
}
|
||||
|
||||
- (NSArray *)keyCommands {
|
||||
UIKeyCommand *plainReturn = [UIKeyCommand keyCommandWithInput:@"\r" modifierFlags:kNilOptions action:@selector(handlePlainReturn:)];
|
||||
UIKeyCommand *plainReturn = [UIKeyCommand keyCommandWithInput:@"\r" modifierFlags:kNilOptions action:@selector(handleReturn:)];
|
||||
UIKeyCommand *cmdReturn = [UIKeyCommand keyCommandWithInput:@"\r" modifierFlags:UIKeyModifierCommand action:@selector(handleReturn:)];
|
||||
return @[
|
||||
plainReturn
|
||||
plainReturn,
|
||||
cmdReturn
|
||||
];
|
||||
}
|
||||
|
||||
- (void)handlePlainReturn:(id)__unused sender {
|
||||
- (void)handleReturn:(UIKeyCommand *)__unused sender {
|
||||
UIKeyModifierFlags modifierFlags = 0;
|
||||
if ([sender isKindOfClass:[UIKeyCommand class]]) {
|
||||
modifierFlags = sender.modifierFlags;
|
||||
}
|
||||
|
||||
if (_shouldReturn) {
|
||||
_shouldReturn();
|
||||
_shouldReturn(modifierFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user