This commit is contained in:
2025-11-04 16:37:24 +08:00
parent 6fb9e56720
commit 3e2dc4bcb6
6 changed files with 92 additions and 26 deletions

View File

@@ -6,6 +6,7 @@
//
#import "KBFunctionView.h"
#import "KBResponderUtils.h" // UIInputViewController
#import "KBFunctionBarView.h"
#import "KBFunctionPasteView.h"
#import "KBFunctionTagCell.h"
@@ -169,7 +170,7 @@ static NSString * const kKBFunctionTagCellId = @"KBFunctionTagCellId";
[KBHUD showInfo:@"处理中…"];
// return;
UIInputViewController *ivc = [self findInputViewController];
UIInputViewController *ivc = KBFindInputViewController(self);
if (!ivc) return;
NSString *title = (indexPath.item < self.itemsInternal.count) ? self.itemsInternal[indexPath.item] : @"";
@@ -268,14 +269,14 @@ static NSString * const kKBFunctionTagCellId = @"KBFunctionTagCellId";
}
- (void)onTapDelete {
NSLog(@"点击:删除");
UIInputViewController *ivc = [self findInputViewController];
UIInputViewController *ivc = KBFindInputViewController(self);
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
[proxy deleteBackward];
}
- (void)onTapClear {
NSLog(@"点击:清空");
// pasteView
UIInputViewController *ivc = [self findInputViewController];
UIInputViewController *ivc = KBFindInputViewController(self);
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
// documentContextBeforeInput 50
NSInteger guard = 0; //
@@ -292,7 +293,7 @@ static NSString * const kKBFunctionTagCellId = @"KBFunctionTagCellId";
- (void)onTapSend {
NSLog(@"点击:发送");
// App
UIInputViewController *ivc = [self findInputViewController];
UIInputViewController *ivc = KBFindInputViewController(self);
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
[proxy insertText:@"\n"];
}
@@ -417,16 +418,6 @@ static NSString * const kKBFunctionTagCellId = @"KBFunctionTagCellId";
#pragma mark - Find Owner Controller
// 宿 UIInputViewControllerKeyboardViewController
- (UIInputViewController *)findInputViewController {
UIResponder *responder = self;
while (responder) {
if ([responder isKindOfClass:[UIInputViewController class]]) {
return (UIInputViewController *)responder;
}
responder = responder.nextResponder;
}
return nil;
}
// KBResponderUtils.h
@end