Skip to content

Commit

Permalink
Set text color when setting up text view with empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Apr 2, 2023
1 parent 6166c4c commit 6c80002
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ Until then, deprecated features may be removed in the next minor version.



## 0.5.1

### 🐛 Bug Fixes
* Initial text color is only applied when setting up rich text with an empty string.



## 0.5

### 💥 Breaking Changes
Expand Down
3 changes: 3 additions & 0 deletions Sources/RichTextKit/RichTextView_AppKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ open class RichTextView: NSTextView, RichTextViewComponent {
allowsImageEditing = true
allowsUndo = true
backgroundColor = .clear
if text.string.isEmpty {
textColor = .textColor
}
imageConfiguration = standardImageConfiguration(for: format)
layoutManager?.defaultAttachmentScaling = NSImageScaling.scaleProportionallyDown
setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
Expand Down
4 changes: 3 additions & 1 deletion Sources/RichTextKit/RichTextView_UIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ open class RichTextView: UITextView, RichTextViewComponent {
text.autosizeImageAttachments(maxSize: imageAttachmentMaxSize)
richTextDataFormat = format
spellCheckingType = .no
//textColor = .label
if text.string.isEmpty {
textColor = .label
}
setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
}

Expand Down

0 comments on commit 6c80002

Please sign in to comment.