danielsaidi / RichTextKit

RichTextKit is a Swift SDK that helps you use rich text in Swift and SwiftUI.
MIT License
944 stars 126 forks source link

RichTextViewer .clear background color? #208

Open gerzonc opened 1 month ago

gerzonc commented 1 month ago

Hi there!

I'm trying to achieve the same as #173 but for the RichTextViewer. Since it only takes one parameter, not sure how can we achieve this? I tried with the .richTextEditorStyle() and background(.clear) and they didn't work.

Here is my sample code

 RichTextViewer(thoughts)
    .frame(minHeight: 250)
    .frame(maxWidth: .infinity)
    .scrollDisabled(true)
    .richTextEditorStyle(RichTextEditorStyle(backgroundColor: .clear))
    .background(.clear)
    .cornerRadius(8)
    .id(thoughts.string)
danielsaidi commented 1 month ago

If you want a clear editor, can you use the view configuration parameter when setting up the view?

gerzonc commented 1 month ago

If you want a clear editor, can you use the view configuration parameter when setting up the view?

Not using the editor in this case, just the viewer (this one only receives the NSAttributeString it seems). Or is the RichTextViewer meant to be deprecated? Using a RichTextEditor with editable disabled does the trick here?

danielsaidi commented 1 month ago

The RichTextViewer is basically just a disabled RichTextEditor so I'd say that it should expose the same configuration method as the editor.

Until then, please try with a disabled editor and let me know if that works. I could then add the configuration to the viewer.

gerzonc commented 1 month ago

The RichTextViewer is basically just a disabled RichTextEditor so I'd say that it should expose the same configuration method as the editor.

Until then, please try with a disabled editor and let me know if that works. I could then add the configuration to the viewer.

Oh yeah, it works flawlessly :)

image
danielsaidi commented 1 month ago

That's perfect - I'll make the change then! 🙌