diff --git a/YYKit/Text/YYTextView.h b/YYKit/Text/YYTextView.h index 5ffe218a..ec592e19 100644 --- a/YYKit/Text/YYTextView.h +++ b/YYKit/Text/YYTextView.h @@ -46,6 +46,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)textView:(YYTextView *)textView didTapHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect; - (BOOL)textView:(YYTextView *)textView shouldLongPressHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange; - (void)textView:(YYTextView *)textView didLongPressHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect; +- (BOOL)textView:(YYTextView *)textView customHandlePastedImage:(UIImage *)image; @end diff --git a/YYKit/Text/YYTextView.m b/YYKit/Text/YYTextView.m index 064ea88e..1ecda9e6 100644 --- a/YYKit/Text/YYTextView.m +++ b/YYKit/Text/YYTextView.m @@ -2912,6 +2912,11 @@ - (void)paste:(id)sender { img = [UIImage imageWithData:p.imageData scale:kScreenScale]; } if (img && img.size.width > 1 && img.size.height > 1) { + if ([self.delegate respondsToSelector:@selector(textView:customHandlePastedImage:)]) { + if ([self.delegate textView:self customHandlePastedImage:img]) { + return; + } + } id content = img; if ([img conformsToProtocol:@protocol(YYAnimatedImage)]) { id ani = (id)img;