Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
Updated canPerformAction:withSender: in `JSQMessagesComposerTextVie…
Browse files Browse the repository at this point in the history
…w` to call super (#1664). Fixes #1663.
  • Loading branch information
GianniCarlo authored and jessesquires committed Jun 10, 2016
1 parent ef5c87f commit 0622f6f
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 0622f6f

Please sign in to comment.