Skip to content

Commit

Permalink
Updated canPerformAction:withSender: in `JSQMessagesComposerTextVie…
Browse files Browse the repository at this point in the history
…w` to call super (jessesquires#1664). Fixes jessesquires#1663.
  • Loading branch information
GianniCarlo authored and Edward Sammut Alessi committed Aug 22, 2016
1 parent 04c737b commit 598b35d
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions JSQMessagesViewController/Views/JSQMessagesComposerTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -226,35 +226,8 @@ - (BOOL)becomeFirstResponder
return [super becomeFirstResponder];
}

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
[UIMenuController sharedMenuController].menuItems = nil;

if ([self.text length] == 0) {
if (action == @selector(paste:)) {
return YES;
}
} else {
NSRange range = self.selectedRange;
if (range.length > 0) {
if (action == @selector(cut:)
|| action == @selector(copy:)
|| action == @selector(select:)
|| action == @selector(selectAll:)
|| action == @selector(paste:)
|| action ==@selector(delete:)) {
return YES;
}
}
else {
if (action == @selector(select:)
|| action == @selector(selectAll:)
|| action == @selector(paste:)) {
return YES;
}
}
}
return NO;
return [super canPerformAction:action withSender:sender];
}

@end

0 comments on commit 598b35d

Please sign in to comment.