Skip to content

Commit dff493e

Browse files
SergioEstevaojkmassel
authored andcommitted
Fix copy method to keep other text data when adding custom attributed string data.
1 parent 72cb0c4 commit dff493e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Aztec/Classes/TextKit/TextView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,11 @@ open class TextView: UITextView {
555555
// MARK: - Pasteboard Helpers
556556

557557
internal func storeInPasteboard(encoded data: Data, pasteboard: UIPasteboard = UIPasteboard.general) {
558-
pasteboard.setData(data, forPasteboardType: NSAttributedString.pastesboardUTI)
558+
if pasteboard.numberOfItems > 0 {
559+
pasteboard.items[0][NSAttributedString.pastesboardUTI] = data;
560+
} else {
561+
pasteboard.addItems([[NSAttributedString.pastesboardUTI: data]])
562+
}
559563
}
560564

561565
// MARK: - Intercept keyboard operations

0 commit comments

Comments
 (0)