mdx-editor / mdx-editor/editor
useRealm must be used within a RealmContextProvider
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 307
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 5
Description
I'm trying to add a single h1 button instead of BlockTypeSelect, but I keep getting this error.
Here's my code
`export function WysiwygEditor() {
const ref = React.useRef(null);
const [value, setValue] = useState('');
const applyBlockType = usePublisher(applyBlockType$);
return (
<MDXEditor
ref={ref}
iconComponentFor={(name) => WysiwygEditorIconByName[name]}
plugins={[
toolbarPlugin({
toolbarContents: () => (
<>
<BoldItalicUnderlineToggles />
<StrikeThroughSupSubToggles
options={['Strikethrough']}
/>
<BlockTypeSelect />
<Separator />
<Button
onClick={() => {
applyBlockType('h1');
}}
>
<TextHeading1Icon />
</Button>
</>
),
}),
headingsPlugin({ allowedHeadingLevels: [1, 2] }),
]}
markdown={value}
onChange={(markdown) => setValue(markdown)}
/>
);
}`
Contributor guide
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 with the WysiwygEditor example and compare the custom applyBlockType button with BlockTypeSelect. Trace usePublisher(applyBlockType$) and RealmContextProvider usage in the editor entry points, then reproduce the reported error. Done means the supported custom heading-button usage is clarified or the reported failure is fixed and covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100