From 8a8f3a0f23649604ee7c374482222d20049abf50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Semih=20=C3=96zsoy?= Date: Tue, 14 Jul 2026 11:21:44 +0300 Subject: [PATCH] fix: fall back to originalText in textStorage so Share as Text copies content Backport of #369 (33831ee0) to the 4.x line. When the text view is not attached yet, textStorage returned an empty NSTextStorage, so copying via Share as Text put an empty string on the pasteboard. Co-Authored-By: Claude Fable 5 --- Sources/PulseUI/Views/RichTextView/RichTextViewModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/PulseUI/Views/RichTextView/RichTextViewModel.swift b/Sources/PulseUI/Views/RichTextView/RichTextViewModel.swift index af480bf75..a6ebf9cc0 100644 --- a/Sources/PulseUI/Views/RichTextView/RichTextViewModel.swift +++ b/Sources/PulseUI/Views/RichTextView/RichTextViewModel.swift @@ -30,7 +30,7 @@ final class RichTextViewModel: ObservableObject { var isEmpty: Bool { originalText.length == 0 } weak var textView: UXTextView? // Not proper MVVM - var textStorage: NSTextStorage { textView?.textStorage ?? NSTextStorage(string: "") } + var textStorage: NSTextStorage { textView?.textStorage ?? NSTextStorage(attributedString: originalText) } private var prefilteredText: NSAttributedString? private var isSearchingInBackground = false