s/richTextNode/textNode/g.

ASTextNode's delegate methods are all prefixed with "richTextNode".
Rename these to "textNode" for consistency.
This commit is contained in:
Nadine Salter
2014-10-01 15:54:03 -07:00
parent a82364a54b
commit 17fcca19ce
3 changed files with 28 additions and 28 deletions

View File

@@ -160,44 +160,44 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) {
@optional @optional
/** /**
@abstract Indicates to the delegate that a link was tapped within a rich text node. @abstract Indicates to the delegate that a link was tapped within a text node.
@param richTextNode The ASTextNode containing the link that was tapped. @param textNode The ASTextNode containing the link that was tapped.
@param attribute The attribute that was tapped. Will not be nil. @param attribute The attribute that was tapped. Will not be nil.
@param value The value of the tapped attribute. @param value The value of the tapped attribute.
@param point The point within richTextNode, in richTextNode's coordinate system, that was tapped. @param point The point within textNode, in textNode's coordinate system, that was tapped.
*/ */
- (void)richTextNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange; - (void)textNode:(ASTextNode *)textNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange;
/** /**
@abstract Indicates to the delegate that a link was tapped within a rich text node. @abstract Indicates to the delegate that a link was tapped within a text node.
@param richTextNode The ASTextNode containing the link that was tapped. @param textNode The ASTextNode containing the link that was tapped.
@param attribute The attribute that was tapped. Will not be nil. @param attribute The attribute that was tapped. Will not be nil.
@param value The value of the tapped attribute. @param value The value of the tapped attribute.
@param point The point within richTextNode, in richTextNode's coordinate system, that was tapped. @param point The point within textNode, in textNode's coordinate system, that was tapped.
*/ */
- (void)richTextNode:(ASTextNode *)richTextNode longPressedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange; - (void)textNode:(ASTextNode *)textNode longPressedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange;
//! @abstract Called when the rich text node's truncation string has been tapped. //! @abstract Called when the text node's truncation string has been tapped.
- (void)richTextNodeTappedTruncationToken:(ASTextNode *)richTextNode; - (void)textNodeTappedTruncationToken:(ASTextNode *)textNode;
/** /**
@abstract Indicates to the rich text node if an attribute should be considered a link. @abstract Indicates to the text node if an attribute should be considered a link.
@param richTextNode The rich text node containing the entity attribute. @param textNode The text node containing the entity attribute.
@param attribute The attribute that was tapped. Will not be nil. @param attribute The attribute that was tapped. Will not be nil.
@param value The value of the tapped attribute. @param value The value of the tapped attribute.
@discussion If not implemented, the default value is NO. @discussion If not implemented, the default value is NO.
@return YES if the entity attribute should be a link, NO otherwise. @return YES if the entity attribute should be a link, NO otherwise.
*/ */
- (BOOL)richTextNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value; - (BOOL)textNode:(ASTextNode *)textNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value;
/** /**
@abstract Indicates to the rich text node if an attribute is a valid long-press target @abstract Indicates to the text node if an attribute is a valid long-press target
@param richTextNode The rich text node containing the entity attribute. @param textNode The text node containing the entity attribute.
@param attribute The attribute that was tapped. Will not be nil. @param attribute The attribute that was tapped. Will not be nil.
@param value The value of the tapped attribute. @param value The value of the tapped attribute.
@discussion If not implemented, the default value is NO. @discussion If not implemented, the default value is NO.
@return YES if the entity attribute should be treated as a long-press target, NO otherwise. @return YES if the entity attribute should be treated as a long-press target, NO otherwise.
*/ */
- (BOOL)richTextNode:(ASTextNode *)richTextNode shouldLongPressLinkAttribute:(NSString *)attribute value:(id)value; - (BOOL)textNode:(ASTextNode *)textNode shouldLongPressLinkAttribute:(NSString *)attribute value:(id)value;
@end @end

View File

@@ -430,8 +430,8 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f)
// Check if delegate implements optional method, if not assume NO. // Check if delegate implements optional method, if not assume NO.
// Should the text be highlightable/touchable? // Should the text be highlightable/touchable?
if (![_delegate respondsToSelector:@selector(richTextNode:shouldHighlightLinkAttribute:value:)] || if (![_delegate respondsToSelector:@selector(textNode:shouldHighlightLinkAttribute:value:)] ||
![_delegate richTextNode:self shouldHighlightLinkAttribute:name value:value]) { ![_delegate textNode:self shouldHighlightLinkAttribute:name value:value]) {
value = nil; value = nil;
name = nil; name = nil;
} }
@@ -477,8 +477,8 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f)
} }
// Ask our delegate if a long-press on an attribute is relevant // Ask our delegate if a long-press on an attribute is relevant
if ([self.delegate respondsToSelector:@selector(richTextNode:shouldLongPressLinkAttribute:value:)]) { if ([self.delegate respondsToSelector:@selector(textNode:shouldLongPressLinkAttribute:value:)]) {
return [self.delegate richTextNode:self shouldLongPressLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue]; return [self.delegate textNode:self shouldLongPressLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue];
} }
// Otherwise we are good to go. // Otherwise we are good to go.
@@ -703,14 +703,14 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f)
{ {
[super touchesEnded:touches withEvent:event]; [super touchesEnded:touches withEvent:event];
if ([self _pendingLinkTap] && [_delegate respondsToSelector:@selector(richTextNode:tappedLinkAttribute:value:atPoint:textRange:)]) { if ([self _pendingLinkTap] && [_delegate respondsToSelector:@selector(textNode:tappedLinkAttribute:value:atPoint:textRange:)]) {
CGPoint point = [[touches anyObject] locationInView:self.view]; CGPoint point = [[touches anyObject] locationInView:self.view];
[_delegate richTextNode:self tappedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:point textRange:_highlightRange]; [_delegate textNode:self tappedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:point textRange:_highlightRange];
} }
if ([self _pendingTruncationTap]) { if ([self _pendingTruncationTap]) {
if ([_delegate respondsToSelector:@selector(richTextNodeTappedTruncationToken:)]) { if ([_delegate respondsToSelector:@selector(textNodeTappedTruncationToken:)]) {
[_delegate richTextNodeTappedTruncationToken:self]; [_delegate textNodeTappedTruncationToken:self];
} }
} }
@@ -728,9 +728,9 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f)
{ {
// Respond to long-press when it begins, not when it ends. // Respond to long-press when it begins, not when it ends.
if (longPressRecognizer.state == UIGestureRecognizerStateBegan) { if (longPressRecognizer.state == UIGestureRecognizerStateBegan) {
if ([self.delegate respondsToSelector:@selector(richTextNode:longPressedLinkAttribute:value:atPoint:textRange:)]) { if ([self.delegate respondsToSelector:@selector(textNode:longPressedLinkAttribute:value:atPoint:textRange:)]) {
CGPoint touchPoint = [_longPressGestureRecognizer locationInView:self.view]; CGPoint touchPoint = [_longPressGestureRecognizer locationInView:self.view];
[self.delegate richTextNode:self longPressedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:touchPoint textRange:_highlightRange]; [self.delegate textNode:self longPressedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:touchPoint textRange:_highlightRange];
} }
} }
} }

View File

@@ -24,13 +24,13 @@
@implementation ASTextNodeTestDelegate @implementation ASTextNodeTestDelegate
- (void)richTextNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange - (void)textNode:(ASTextNode *)textNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange
{ {
_tappedLinkAttribute = attribute; _tappedLinkAttribute = attribute;
_tappedLinkValue = value; _tappedLinkValue = value;
} }
- (BOOL)richTextNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value - (BOOL)textNode:(ASTextNode *)textNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value
{ {
return YES; return YES;
} }