SEP-491 prerequisite: add textViewShouldBeginEditing: to ASEditableTextNodeDelegate (#535)

* SEP-491 prerequisite: add textViewShouldBeginEditing: to ASEditableTextNodeDelegate

* - added entry to CHANGELOG.md, addressed nit
This commit is contained in:
Yan S 2017-08-28 11:49:41 -07:00 committed by Huy Nguyen
parent ccc5786032
commit 19a9d29aa8
3 changed files with 22 additions and 0 deletions

View File

@ -14,6 +14,7 @@
- Fix retain cycle between ASImageNode and PINAnimatedImage [Phil Larson](https://github.com/plarson) [#520](https://github.com/TextureGroup/Texture/pull/520) - Fix retain cycle between ASImageNode and PINAnimatedImage [Phil Larson](https://github.com/plarson) [#520](https://github.com/TextureGroup/Texture/pull/520)
- Change the API for disabling logging from a compiler flag to a runtime C function ASDisableLogging(). [Adlai Holler](https://github.com/Adlai-Holler) [#528](https://github.com/TextureGroup/Texture/pull/528) - Change the API for disabling logging from a compiler flag to a runtime C function ASDisableLogging(). [Adlai Holler](https://github.com/Adlai-Holler) [#528](https://github.com/TextureGroup/Texture/pull/528)
- Table and collection views to consider content inset when calculating (default) element size range [Huy Nguyen](https://github.com/nguyenhuy) [#525](https://github.com/TextureGroup/Texture/pull/525) - Table and collection views to consider content inset when calculating (default) element size range [Huy Nguyen](https://github.com/nguyenhuy) [#525](https://github.com/TextureGroup/Texture/pull/525)
- [ASEditableTextNode] added -editableTextNodeShouldBeginEditing to ASEditableTextNodeDelegate to mirror the corresponding method from UITextViewDelegate. [Yan S.](https://github.com/yans) [#535](https://github.com/TextureGroup/Texture/pull/535)
##2.4 ##2.4
- Fix an issue where inserting/deleting sections could lead to inconsistent supplementary element behavior. [Adlai Holler](https://github.com/Adlai-Holler) - Fix an issue where inserting/deleting sections could lead to inconsistent supplementary element behavior. [Adlai Holler](https://github.com/Adlai-Holler)

View File

@ -158,6 +158,13 @@ NS_ASSUME_NONNULL_BEGIN
@protocol ASEditableTextNodeDelegate <NSObject> @protocol ASEditableTextNodeDelegate <NSObject>
@optional @optional
/**
@abstract Asks the delegate if editing should begin for the text node.
@param editableTextNode An editable text node.
@discussion YES if editing should begin; NO if editing should not begin -- the default returns YES.
*/
- (BOOL)editableTextNodeShouldBeginEditing:(ASEditableTextNode *)editableTextNode;
/** /**
@abstract Indicates to the delegate that the text node began editing. @abstract Indicates to the delegate that the text node began editing.
@param editableTextNode An editable text node. @param editableTextNode An editable text node.

View File

@ -699,6 +699,12 @@
} }
#pragma mark - UITextView Delegate #pragma mark - UITextView Delegate
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
// Delegateify.
return [self _delegateShouldBeginEditing];
}
- (void)textViewDidBeginEditing:(UITextView *)textView - (void)textViewDidBeginEditing:(UITextView *)textView
{ {
// Delegateify. // Delegateify.
@ -793,6 +799,14 @@
} }
#pragma mark - #pragma mark -
- (BOOL)_delegateShouldBeginEditing
{
if ([_delegate respondsToSelector:@selector(editableTextNodeShouldBeginEditing:)]) {
return [_delegate editableTextNodeShouldBeginEditing:self];
}
return YES;
}
- (void)_delegateDidBeginEditing - (void)_delegateDidBeginEditing
{ {
if ([_delegate respondsToSelector:@selector(editableTextNodeDidBeginEditing:)]) if ([_delegate respondsToSelector:@selector(editableTextNodeDidBeginEditing:)])