修改逻辑

This commit is contained in:
2025-10-30 18:28:36 +08:00
parent 482756f6f0
commit 4f23118ec0

View File

@@ -234,29 +234,26 @@ static NSString * const kKBFunctionTagCellId = @"KBFunctionTagCellId";
} }
- (void)onTapDelete { - (void)onTapDelete {
NSLog(@"点击:删除"); NSLog(@"点击:删除");
// 宿 App
UIInputViewController *ivc = [self findInputViewController]; UIInputViewController *ivc = [self findInputViewController];
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy; id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
[proxy deleteBackward]; [proxy deleteBackward];
} }
- (void)onTapClear { - (void)onTapClear {
NSLog(@"点击:清空"); NSLog(@"点击:清空");
// // pasteView
UIInputViewController *ivc = [self findInputViewController]; UIInputViewController *ivc = [self findInputViewController];
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy; id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
// // documentContextBeforeInput 50
NSInteger guard = 0; NSInteger guard = 0; //
while (proxy.hasText && guard < 10000) { // while (guard < 10000) {
NSString *before = proxy.documentContextBeforeInput ?: @""; NSString *before = proxy.documentContextBeforeInput ?: @"";
// before NSInteger count = before.length;
NSInteger count = before.length > 0 ? before.length : 1; if (count <= 0) { break; } //
for (NSInteger i = 0; i < count; i++) { for (NSInteger i = 0; i < count; i++) {
[proxy deleteBackward]; [proxy deleteBackward];
} }
guard += count; guard += count;
} }
//
self.pasteView.placeholderLabel.text = @"点击粘贴TA的话";
} }
- (void)onTapSend { - (void)onTapSend {
NSLog(@"点击:发送"); NSLog(@"点击:发送");