Fixed: attachment support was missing in CPTextView (#2872)

This commit is contained in:
daboe01
2019-12-19 09:08:33 +01:00
committed by Martin Carlberg
parent 2d96b06d4c
commit 9e289574ff
8 changed files with 202 additions and 123 deletions
+15 -1
View File
@@ -42,6 +42,11 @@ CPTextStorageDidProcessEditingNotification = @"CPTextStorageDidProcessEditingNot
@end
CPAttachmentCharacter = 65532; // "\ufffc";
_CPAttachmentCharacterAsString = String.fromCharCode(CPAttachmentCharacter);
_CPAttachmentView = "_CPAttachmentView";
_CPAttachmentInvisible = "_CPAttachmentInvisible";
var CPTextStorageDelegate_textStorageWillProcessEditing_ = 1 << 1,
CPTextStorageDelegate_textStorageDidProcessEditing_ = 1 << 2;
@@ -257,6 +262,15 @@ var CPTextStorageDelegate_textStorageWillProcessEditing_ = 1 << 1,
return [super attributedSubstringFromRange:aRange];
}
+ (id)attributedStringWithAttachment:(CPView)someView
{
var result = [[self alloc] initWithString:_CPAttachmentCharacterAsString];
[result setAttributes:@{_CPAttachmentView:someView} range:CPMakeRange(0, 1)];
return result;
}
@end
@@ -300,4 +314,4 @@ var CPTextStorageDelegate_textStorageWillProcessEditing_ = 1 << 1,
[super encodeWithCoder:aCoder];
}
@end
@end