Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
BlockNoteを布教するぜ
Search
imaimai17468
August 07, 2024
72
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
BlockNoteを布教するぜ
BlockNoteを紹介するためのスライドです
imaimai17468
August 07, 2024
More Decks by imaimai17468
See All by imaimai17468
オートメーション・バカにならないために
imaimai17468
1
280
MVP先行の探索型DocDD
imaimai17468
1
180
コーディングチェックの自動化がしたい!
imaimai17468
4
1.2k
型パズルを好きになるために、競プロを型システムだけで解いてみることにした
imaimai17468
6
790
フロントエンド設計の所感 1年目
imaimai17468
0
97
Silk Weave -未来研究大会発表資料-
imaimai17468
1
59
Next.jsでクエリパラメータを楽に扱おう nuqsを紹介!
imaimai17468
3
2.1k
TailwindCSSで学ぶ技術批判の気をつけ方
imaimai17468
8
7.1k
Next.js+yjs+BlockNoteでNotionライクな最高の共同編集エディタを作ろう
imaimai17468
0
3.3k
Featured
See All Featured
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
170
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
400
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Test your architecture with Archunit
thirion
1
2.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
420
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Transcript
BlockNoteを布教するぜ いまいまい 1
自己紹介 いまいまい (今井俊希) 株式会社ゆめみ 新卒 フロントエンドエンジニア 勉強中です | お手柔らかに 2
リッチエディタの実装、枯れてない? 技術的知見、 zennでもみない Qiitaでもみない TLでもみない 開発止まってるのもチラホラ TS対応してないのもチラホラ 3
現状 Mantine Editor.js Draft.js 大体見た目同じ ちょっと古臭くない? 4
現時点でのベストプラクティス? Zennやしずかなインターネット メニューバーは非表示 markdown入力でスタイル反映 5
なんかええのないの? 最近使った中で良いテキストエディタ... 6
あ!! 7
そんなあなたに BlockNote 8
BlockNoteって? 美しいテキストエディタ。 ユーザーが気に入るエディタをアプリに簡単に追加できます。 カスタムブロックやAIツールのような独自の機能でカスタマイズできます。 (公式訳) ほぼNotionです 9
百聞は一見に如かず 10
使い勝手良さそう! 11
必要なのはこれだけ! import "@blocknote/core/fonts/inter.css"; import { useCreateBlockNote } from "@blocknote/react"; import
{ BlockNoteView } from "@blocknote/mantine"; import "@blocknote/mantine/style.css"; export default function App() { const editor = useCreateBlockNote(); return <BlockNoteView editor={editor} />; } 12
カスタマイズも豊富! ツールバーやカーソルなどの形や色の変更 カスタムブロックも定義可能! 独自のコードブロックやアラートなど 13
でも、controlどうするの? どうせ面倒でしょ? 14
(前置き) 型構造は複雑 type Block = { id: string; type: string;
props: Record<string, boolean | number | string>; content: InlineContent[] | TableContent | undefined; children: Block[]; }; children: Block[] : 無限入れ子 15
ちゃんと詰まらないように変換できます 16
入出力が簡単! 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<string>(); const onChange = async () => { const markdown = await editor.blocksToMarkdownLossy(editor.document); setMarkdown(markdown); }; return <BlockNoteView editor={editor} onChange={onChange} /> 17
BlockNote、魅力的じゃない? 18
蛇足 1. フロントエンドカンファレンス北海道に登壇します 今回の内容+yjs BlockNoteをオンラインエディタに改造しようというお話 2. このエディタを使ったサイトを作ってます BlockNoteを使って技術のTipsを投稿できるやつ いつ完成するんだろうね 19