From 09be5ab7b42e2970c435961e7d4eddc7b8f7e894 Mon Sep 17 00:00:00 2001 From: szydlovsky <9szydlowski9@gmail.com> Date: Mon, 21 Jul 2025 16:52:56 +0200 Subject: [PATCH] fix: make insertion util use only current typing attributes --- ios/utils/TextInsertionUtils.mm | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/ios/utils/TextInsertionUtils.mm b/ios/utils/TextInsertionUtils.mm index fbf3e123e..15ddef299 100644 --- a/ios/utils/TextInsertionUtils.mm +++ b/ios/utils/TextInsertionUtils.mm @@ -5,18 +5,7 @@ @implementation TextInsertionUtils + (void)insertText:(NSString*)text inView:(UITextView*)textView at:(NSInteger)index additionalAttributes:(NSDictionary*)additionalAttrs { - NSMutableDictionary *copiedAttrs = [[NSMutableDictionary 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 *copiedAttrs = [textView.typingAttributes mutableCopy]; if(additionalAttrs != nullptr) { [copiedAttrs addEntriesFromDictionary: additionalAttrs]; }