portabletext / portabletext/react-portabletext
unknownBlockStyle is not working / does nothing
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 377
- Forks
- 31
- Avg merge
- 23h 42m
- Merged PRs (30d)
- 9
Description
The component override unknownBlockStyle is not working. It seems that when you provide a block component override, it is merged with the default block-styles, so that there never is an "unknown" block.
For instance if you define
block: {
// Ex. 1: customizing common block types
h1: ({children}) => <h1 className="text-2xl">{children}</h1>,
blockquote: ({children}) => <blockquote className="border-l-purple-500">{children}</blockquote>,
},
unknownBlockStyle: ({children}) => <BlockWrapper>{children}</BlockWrapper>,
}
the block style 'normal' should render with BlockWrapper, but instead gets render with the default component (<p>)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied components example with a block style of "normal", then trace the component override handling for block styles and unknownBlockStyle. Done means the normal block style uses the provided BlockWrapper instead of the default paragraph component, with a regression test covering the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100