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

🐛 Fix TypeError for color on nested blocks #96

Merged
merged 1 commit into from
Dec 16, 2024
Merged

🐛 Fix TypeError for color on nested blocks #96

merged 1 commit into from
Dec 16, 2024

Conversation

ralfstx
Copy link
Member

@ralfstx ralfstx commented Dec 16, 2024

Reading a color property on a row or column block with a nested text block lead to a TypeError:

TypeError: Invalid value for "definition/content/0/rows/0/color":
Expected valid color, got: {type: 'RGB', red: 0, green: 0.3, blue:
0.5}

This happened because the readColor() function transforms the input and did not accept its own result type as input. For nested blocks, the inherited color property is parsed twice if not overwritten.

As a quick fix, this commit changes the readColor() function to accept its own result type, i.e. an object with type RGB.

Fixes #95

Reading a `color` property on a row or column block with a nested text
block lead to a TypeError:

> TypeError: Invalid value for "definition/content/0/rows/0/color":
> Expected valid color, got: {type: 'RGB', red: 0, green: 0.3, blue:
> 0.5}

This happened because the `readColor()` function transforms the input
and did not accept its own result type as input. For nested blocks, the
inherited `color` property is parsed twice if not overwritten.

As a quick fix, this commit changes the `readColor()` function to accept
its own result type, i.e. an object with type `RGB`.

Fixes #95
@ralfstx ralfstx merged commit 07fe0c3 into main Dec 16, 2024
1 check passed
@ralfstx ralfstx deleted the fix-color branch December 16, 2024 21:29
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

Successfully merging this pull request may close these issues.

TypeError for color on nested blocks
1 participant