Slide 17
Slide 17 text
入出力が簡単!
Markdown / HTMLで入力・出力できます!
const editor = useCreateBlockNote();
// INPUT: in first rendering (ex. useEffect)
const blocks = await editor.tryParseMarkdownToBlocks(e.target.value);
editor.replaceBlocks(editor.document, blocks);
// OUTPUT: Markdown export handler
const [markdown, setMarkdown] = useState();
const onChange = async () => {
const markdown = await editor.blocksToMarkdownLossy(editor.document);
setMarkdown(markdown);
};
return
17