fix: do not error on invalid backgroundColor or textColor #2176 #2179
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
There can be invalid
textColororbackgroundColorin a document. We were assuming that it always was a valid color. This changes all of the places where we read the backgroundColor or textColor to not make that assumption & access a property which does not actually exist.There is some digging to be done here to understand whether we can prevent these invalid values from getting within the document, but at this point I think having this defensive code is still needed as I'm unsure that we can actually fully validate these string attributes in prosemirror.
Perhaps this is helped with the zod props, so this may not be required soon.
Rationale
Changes
Impact
Testing
Screenshots/Video
Checklist
Additional Notes
#2176