From 598b35d8104c942db2310d7d6e1b60ec13a09806 Mon Sep 17 00:00:00 2001 From: GianniCarlo Date: Thu, 9 Jun 2016 23:09:09 -0500 Subject: [PATCH] Updated `canPerformAction:withSender:` in `JSQMessagesComposerTextView` to call super (#1664). Fixes #1663. --- .../Views/JSQMessagesComposerTextView.m | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/JSQMessagesViewController/Views/JSQMessagesComposerTextView.m b/JSQMessagesViewController/Views/JSQMessagesComposerTextView.m index a4aef5a89..6a3471ea1 100644 --- a/JSQMessagesViewController/Views/JSQMessagesComposerTextView.m +++ b/JSQMessagesViewController/Views/JSQMessagesComposerTextView.m @@ -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