Skip to content

Commit

Permalink
Fixed #32
Browse files Browse the repository at this point in the history
Inserting an image loses the attributed and won't apply to text being typed after the image
  • Loading branch information
aryaxt committed Nov 4, 2013
1 parent e7c27f1 commit f9582d3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RichTextEditor/Source/RichTextEditor.m
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,11 @@ - (void)richTextEditorToolbarDidSelectTextAttachment:(UIImage *)textAttachment
[attachment setImage:textAttachment];
NSAttributedString *attributedStringAttachment = [NSAttributedString attributedStringWithAttachment:attachment];

NSDictionary *previousAttributes = [self dictionaryAtIndex:self.selectedRange.location];

NSMutableAttributedString *attributedString = [self.attributedText mutableCopy];
[attributedString insertAttributedString:attributedStringAttachment atIndex:self.selectedRange.location];
[attributedString addAttributes:previousAttributes range:NSMakeRange(self.selectedRange.location, 1)];
self.attributedText = attributedString;
}

Expand Down

2 comments on commit f9582d3

@ZoeESummers
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this so quickly.

@aryaxt
Copy link
Owner Author

@aryaxt aryaxt commented on f9582d3 Nov 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem

Please sign in to comment.