Only accept service requests when we actually have a selection
This commit is contained in:
parent
c201bac900
commit
1c6bae636b
1 changed files with 7 additions and 3 deletions
|
|
@ -1581,10 +1581,14 @@ - (NSString *)accessibilitySelectedText
|
|||
// Support services receiving "public.utf8-plain-text" and "NSStringPboardType"
|
||||
- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
|
||||
{
|
||||
if ([sendType isEqual:NSPasteboardTypeString] || [sendType isEqual:@"NSStringPboardType"]) {
|
||||
return self;
|
||||
if (
|
||||
(!sendType || [sendType isEqual:NSPasteboardTypeString] || [sendType isEqual:@"NSStringPboardType"]) &&
|
||||
(!returnType || [returnType isEqual:NSPasteboardTypeString] || [returnType isEqual:@"NSStringPboardType"])
|
||||
) {
|
||||
NSString *text = [self accessibilitySelectedText];
|
||||
if (text && text.length > 0) return self;
|
||||
}
|
||||
return nil;
|
||||
return [super validRequestorForSendType:sendType returnType:returnType];
|
||||
}
|
||||
|
||||
// Selected text as input to be sent to Services
|
||||
|
|
|
|||
Loading…
Reference in a new issue