iPad keyboard cut/copy/paste buttons (flutter/engine#50923)
The cut/copy/paste buttons above the keyboard on iPad were previously always greyed out, but now they work.
This commit is contained in:
committed by
GitHub
parent
a4c787e072
commit
3a07dc741a
@@ -1145,14 +1145,9 @@ static BOOL IsSelectionRectBoundaryCloserToPoint(CGPoint point,
|
||||
}
|
||||
|
||||
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
|
||||
// When scribble is available, the FlutterTextInputView will display the native toolbar unless
|
||||
// these text editing actions are disabled.
|
||||
if ([self isScribbleAvailable] && sender == NULL) {
|
||||
return NO;
|
||||
}
|
||||
if (action == @selector(paste:)) {
|
||||
// Forbid pasting images, memojis, or other non-string content.
|
||||
return [UIPasteboard generalPasteboard].string != nil;
|
||||
return [UIPasteboard generalPasteboard].hasStrings;
|
||||
}
|
||||
|
||||
return [super canPerformAction:action withSender:sender];
|
||||
|
||||
@@ -1299,15 +1299,15 @@ FLUTTER_ASSERT_ARC
|
||||
[mockInputView insertText:@"aaaa"];
|
||||
[mockInputView selectAll:nil];
|
||||
|
||||
XCTAssertFalse([mockInputView canPerformAction:@selector(copy:) withSender:NULL]);
|
||||
XCTAssertTrue([mockInputView canPerformAction:@selector(copy:) withSender:NULL]);
|
||||
XCTAssertTrue([mockInputView canPerformAction:@selector(copy:) withSender:@"sender"]);
|
||||
XCTAssertFalse([mockInputView canPerformAction:@selector(paste:) withSender:NULL]);
|
||||
XCTAssertFalse([mockInputView canPerformAction:@selector(paste:) withSender:@"sender"]);
|
||||
|
||||
[mockInputView copy:NULL];
|
||||
XCTAssertFalse([mockInputView canPerformAction:@selector(copy:) withSender:NULL]);
|
||||
XCTAssertTrue([mockInputView canPerformAction:@selector(copy:) withSender:NULL]);
|
||||
XCTAssertTrue([mockInputView canPerformAction:@selector(copy:) withSender:@"sender"]);
|
||||
XCTAssertFalse([mockInputView canPerformAction:@selector(paste:) withSender:NULL]);
|
||||
XCTAssertTrue([mockInputView canPerformAction:@selector(paste:) withSender:NULL]);
|
||||
XCTAssertTrue([mockInputView canPerformAction:@selector(paste:) withSender:@"sender"]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user