Various improvements

This commit is contained in:
Ilya Laktyushin
2026-01-27 22:24:31 +04:00
parent 8be8491b84
commit 142d59cf8f
55 changed files with 1851 additions and 1293 deletions

View File

@@ -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)();

View File

@@ -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);
}
}