Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTE loses text color with empty text/string #228

Open
karlmira opened this issue Jan 20, 2025 · 1 comment
Open

RTE loses text color with empty text/string #228

karlmira opened this issue Jan 20, 2025 · 1 comment

Comments

@karlmira
Copy link

karlmira commented Jan 20, 2025

Hi,

When I start the RTE with empty text and assign a color to it using context.setColor(), the text color remains black. Even if I modify the NSAttributedString during .onAppear(), the text color stays black.

Better to say: I can't set a fontColor while text is empty.

@S1D1T1
Copy link

S1D1T1 commented Jan 20, 2025

I have seen the same thing. I apply color directly to the attributedString from the RichTextWriter-

var aString = myRichTextWriter.mutableRichText

let range =  NSRange(location: 0, length: aString.length)

let attributes:[NSAttributedString.Key : Any] = [
  .font:myFont,
  .foregroundColor:ColorRepresentable.textColor,
]

aString.setAttributes(attributes, range: range)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants