Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions ios/utils/TextInsertionUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,7 @@

@implementation TextInsertionUtils
+ (void)insertText:(NSString*)text inView:(UITextView*)textView at:(NSInteger)index additionalAttributes:(NSDictionary<NSAttributedStringKey, id>*)additionalAttrs {
NSMutableDictionary<NSAttributedStringKey, id> *copiedAttrs = [[NSMutableDictionary<NSAttributedStringKey, id> alloc ] init];
if(index == textView.textStorage.length) {
if(index > 0) {
// if we are at the end of the text, we want to use previous style, but only if the index won't be -1 then
copiedAttrs = [textView.textStorage attributesAtIndex:index - 1 effectiveRange:nullptr].mutableCopy;
}
} else {
copiedAttrs = [textView.textStorage attributesAtIndex:index effectiveRange:nullptr].mutableCopy;
}
if([copiedAttrs count] == 0) {
copiedAttrs = textView.typingAttributes.mutableCopy;
}
NSMutableDictionary<NSAttributedStringKey, id> *copiedAttrs = [textView.typingAttributes mutableCopy];
if(additionalAttrs != nullptr) {
[copiedAttrs addEntriesFromDictionary: additionalAttrs];
}
Expand Down
Loading