move to biome (#297)
* switch to biome * writer format * migrate format * packages format * hudozka format * writer fix * biome config updated * migrate fix * packages fix * hudozka fix * claude updated
This commit is contained in:
1 parent
98dcaaa237
commit
467a218d00
112 files changed
+1472
-5914
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useCallback } from "react"
|
||||
import type { Editor } from "@tiptap/react"
|
||||
import { Fragment } from "@tiptap/pm/model"
|
||||
import type { Editor } from "@tiptap/react"
|
||||
import { useCallback, useEffect } from "react"
|
||||
import "./BlockActions.css"
|
||||
|
||||
export type BlockActionsProps = {
|
||||
@@ -68,10 +68,14 @@ export function BlockActions({ editor, getPos, showSplit }: BlockActionsProps) {
|
||||
if (typeof pos !== "number") return
|
||||
const node = editor.state.doc.nodeAt(pos)
|
||||
if (!node) return
|
||||
editor.chain().focus().deleteRange({
|
||||
from: pos,
|
||||
to: pos + node.nodeSize,
|
||||
}).run()
|
||||
editor
|
||||
.chain()
|
||||
.focus()
|
||||
.deleteRange({
|
||||
from: pos,
|
||||
to: pos + node.nodeSize,
|
||||
})
|
||||
.run()
|
||||
}
|
||||
|
||||
const handleSplit = (e: React.MouseEvent) => {
|
||||
@@ -120,6 +124,7 @@ export function BlockActions({ editor, getPos, showSplit }: BlockActionsProps) {
|
||||
return (
|
||||
<div className="block-actions" contentEditable={false}>
|
||||
<button
|
||||
type="button"
|
||||
className="block-action-btn block-action-delete"
|
||||
title="Delete block"
|
||||
onClick={handleDelete}
|
||||
@@ -128,6 +133,7 @@ export function BlockActions({ editor, getPos, showSplit }: BlockActionsProps) {
|
||||
</button>
|
||||
{showSplit && (
|
||||
<button
|
||||
type="button"
|
||||
className="block-action-btn block-action-split"
|
||||
title="Split block"
|
||||
onClick={handleSplit}
|
||||
@@ -135,12 +141,7 @@ export function BlockActions({ editor, getPos, showSplit }: BlockActionsProps) {
|
||||
✂
|
||||
</button>
|
||||
)}
|
||||
<div
|
||||
className="block-action-btn block-drag-handle"
|
||||
data-drag-handle
|
||||
draggable
|
||||
title="Drag to reorder"
|
||||
>
|
||||
<div className="block-action-btn block-drag-handle" data-drag-handle draggable title="Drag to reorder">
|
||||
⠇
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react"
|
||||
import type { Editor } from "@tiptap/react"
|
||||
import { useState } from "react"
|
||||
import { BlockMenu } from "./BlockMenu"
|
||||
import "./BlockInsert.css"
|
||||
|
||||
@@ -30,20 +30,12 @@ export function BlockInsert({ editor, getPos }: BlockInsertProps) {
|
||||
|
||||
return (
|
||||
<div className="block-insert" contentEditable={false}>
|
||||
<button
|
||||
className="block-insert-btn"
|
||||
title="Add block"
|
||||
onClick={handleToggle}
|
||||
>
|
||||
<button type="button" className="block-insert-btn" title="Add block" onClick={handleToggle}>
|
||||
+
|
||||
</button>
|
||||
{menuOpen && (
|
||||
<div className="block-insert-menu">
|
||||
<BlockMenu
|
||||
editor={editor}
|
||||
position={insertPos}
|
||||
onClose={handleClose}
|
||||
/>
|
||||
<BlockMenu editor={editor} position={insertPos} onClose={handleClose} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -25,21 +25,29 @@ export type BlockMenuProps = {
|
||||
|
||||
export function BlockMenu({ editor, position, onClose, filter }: BlockMenuProps) {
|
||||
const filtered = filter
|
||||
? BLOCK_TYPES.filter((b) => b.label.toLowerCase().includes(filter.toLowerCase()))
|
||||
? BLOCK_TYPES.filter(b => b.label.toLowerCase().includes(filter.toLowerCase()))
|
||||
: BLOCK_TYPES
|
||||
|
||||
function handleInsert(block: BlockType) {
|
||||
const id = generateBlockId()
|
||||
if (block.type === "textBlock") {
|
||||
editor.chain().focus().insertContentAt(position, {
|
||||
type: "textBlock",
|
||||
content: [{ type: "paragraph" }],
|
||||
}).run()
|
||||
editor
|
||||
.chain()
|
||||
.focus()
|
||||
.insertContentAt(position, {
|
||||
type: "textBlock",
|
||||
content: [{ type: "paragraph" }],
|
||||
})
|
||||
.run()
|
||||
} else {
|
||||
editor.chain().focus().insertContentAt(position, {
|
||||
type: block.type,
|
||||
attrs: { ...block.attrs, id },
|
||||
}).run()
|
||||
editor
|
||||
.chain()
|
||||
.focus()
|
||||
.insertContentAt(position, {
|
||||
type: block.type,
|
||||
attrs: { ...block.attrs, id },
|
||||
})
|
||||
.run()
|
||||
}
|
||||
onClose()
|
||||
}
|
||||
@@ -48,12 +56,8 @@ export function BlockMenu({ editor, position, onClose, filter }: BlockMenuProps)
|
||||
|
||||
return (
|
||||
<div className="block-menu">
|
||||
{filtered.map((block) => (
|
||||
<button
|
||||
key={block.type}
|
||||
className="block-menu-item"
|
||||
onClick={() => handleInsert(block)}
|
||||
>
|
||||
{filtered.map(block => (
|
||||
<button type="button" key={block.type} className="block-menu-item" onClick={() => handleInsert(block)}>
|
||||
{block.label}
|
||||
</button>
|
||||
))}
|
||||
@@ -61,5 +65,5 @@ export function BlockMenu({ editor, position, onClose, filter }: BlockMenuProps)
|
||||
)
|
||||
}
|
||||
|
||||
export { BLOCK_TYPES }
|
||||
export type { BlockType }
|
||||
export { BLOCK_TYPES }
|
||||
@@ -8,7 +8,7 @@ export function DraftBanner({ onDiscard }: DraftBannerProps) {
|
||||
return (
|
||||
<div className="draft-banner">
|
||||
<span>You have unpublished changes</span>
|
||||
<button onClick={onDiscard} className="draft-banner-discard">
|
||||
<button type="button" onClick={onDiscard} className="draft-banner-discard">
|
||||
Discard
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
import { useEditor, EditorContent } from "@tiptap/react"
|
||||
import StarterKit from "@tiptap/starter-kit"
|
||||
import { Markdown } from "@tiptap/markdown"
|
||||
import Link from "@tiptap/extension-link"
|
||||
import { useState, useCallback, useRef, useEffect } from "react"
|
||||
import { pb } from "../pb"
|
||||
import { docToTiptap, tiptapToDoc } from "../lib/serialize"
|
||||
import { Toolbar } from "./Toolbar"
|
||||
import { DraftBanner } from "./DraftBanner"
|
||||
import {
|
||||
WriterDocument,
|
||||
TextBlock,
|
||||
ImageBlock,
|
||||
DocumentBlock,
|
||||
EmbedBlock,
|
||||
CardGridBlock,
|
||||
} from "../nodes"
|
||||
import { Markdown } from "@tiptap/markdown"
|
||||
import { EditorContent, useEditor } from "@tiptap/react"
|
||||
import StarterKit from "@tiptap/starter-kit"
|
||||
import { useCallback, useRef, useState } from "react"
|
||||
import { SlashCommands } from "../extensions/SlashCommands"
|
||||
import { docToTiptap, tiptapToDoc } from "../lib/serialize"
|
||||
import { CardGridBlock, DocumentBlock, EmbedBlock, ImageBlock, TextBlock, WriterDocument } from "../nodes"
|
||||
import { pb } from "../pb"
|
||||
import { DraftBanner } from "./DraftBanner"
|
||||
import { Toolbar } from "./Toolbar"
|
||||
import "../nodes/nodes.css"
|
||||
import "./Editor.css"
|
||||
import type { PbPage, DocV1 } from "../types"
|
||||
import type { DocV1, PbPage } from "../types"
|
||||
|
||||
function serializeDoc(doc: DocV1): string {
|
||||
return JSON.stringify(doc)
|
||||
@@ -37,15 +30,10 @@ export function Editor({ page }: EditorProps) {
|
||||
const [hasDraft, setHasDraft] = useState(page.draft !== null)
|
||||
const [publishedDoc, setPublishedDoc] = useState(page.doc)
|
||||
|
||||
const snapshotRef = useRef("")
|
||||
|
||||
const initialDoc = page.draft ?? page.doc
|
||||
const tiptapDoc = docToTiptap(initialDoc)
|
||||
|
||||
// Set initial snapshot
|
||||
useEffect(() => {
|
||||
snapshotRef.current = serializeDoc(initialDoc)
|
||||
}, []) // eslint-disable-line react-hooks/exhaustive-deps
|
||||
const snapshotRef = useRef(serializeDoc(initialDoc))
|
||||
|
||||
const editor = useEditor({
|
||||
extensions: [
|
||||
@@ -157,14 +145,12 @@ export function Editor({ page }: EditorProps) {
|
||||
markdownMode={markdownMode}
|
||||
onToggleMarkdown={handleToggleMarkdown}
|
||||
/>
|
||||
{hasDraft && (
|
||||
<DraftBanner onDiscard={handleDiscard} />
|
||||
)}
|
||||
{hasDraft && <DraftBanner onDiscard={handleDiscard} />}
|
||||
{markdownMode ? (
|
||||
<textarea
|
||||
className="editor-markdown"
|
||||
value={markdownText}
|
||||
onChange={(e) => setMarkdownText(e.target.value)}
|
||||
onChange={e => setMarkdownText(e.target.value)}
|
||||
/>
|
||||
) : (
|
||||
<EditorContent editor={editor} className="editor-content" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, useRef } from "react"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { pb } from "../pb"
|
||||
import type { PbFile } from "../types"
|
||||
import "./FilePicker.css"
|
||||
@@ -18,23 +18,25 @@ export function FilePicker({ onSelect, onClose }: FilePickerProps) {
|
||||
const fileRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
loadFiles(page)
|
||||
}, [page])
|
||||
|
||||
async function loadFiles(p: number) {
|
||||
let cancelled = false
|
||||
setLoading(true)
|
||||
try {
|
||||
const result = await pb.collection("files").getList<PbFile>(p, 20, {
|
||||
sort: "-created",
|
||||
pb.collection("files")
|
||||
.getList<PbFile>(page, 20, { sort: "-created" })
|
||||
.then(result => {
|
||||
if (cancelled) return
|
||||
setFiles(result.items)
|
||||
setTotalPages(result.totalPages)
|
||||
})
|
||||
setFiles(result.items)
|
||||
setTotalPages(result.totalPages)
|
||||
} catch (err) {
|
||||
console.error("Failed to load files:", err)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
.catch(err => {
|
||||
if (!cancelled) console.error("Failed to load files:", err)
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setLoading(false)
|
||||
})
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}
|
||||
}, [page])
|
||||
|
||||
async function handleUpload() {
|
||||
const file = fileRef.current?.files?.[0]
|
||||
@@ -55,22 +57,30 @@ export function FilePicker({ onSelect, onClose }: FilePickerProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="picker-overlay" onClick={onClose}>
|
||||
<div className="picker" onClick={(e) => e.stopPropagation()}>
|
||||
<div
|
||||
className="picker-overlay"
|
||||
onClick={onClose}
|
||||
onKeyDown={e => {
|
||||
if (e.key === "Escape") onClose()
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="picker"
|
||||
onClick={e => e.stopPropagation()}
|
||||
onKeyDown={e => {
|
||||
e.stopPropagation()
|
||||
}}
|
||||
>
|
||||
<div className="picker-header">
|
||||
<button
|
||||
className={tab === "browse" ? "active" : ""}
|
||||
onClick={() => setTab("browse")}
|
||||
>
|
||||
<button type="button" className={tab === "browse" ? "active" : ""} onClick={() => setTab("browse")}>
|
||||
Browse
|
||||
</button>
|
||||
<button
|
||||
className={tab === "upload" ? "active" : ""}
|
||||
onClick={() => setTab("upload")}
|
||||
>
|
||||
<button type="button" className={tab === "upload" ? "active" : ""} onClick={() => setTab("upload")}>
|
||||
Upload
|
||||
</button>
|
||||
<button className="picker-close" onClick={onClose}>×</button>
|
||||
<button type="button" className="picker-close" onClick={onClose}>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{tab === "browse" && (
|
||||
@@ -79,8 +89,9 @@ export function FilePicker({ onSelect, onClose }: FilePickerProps) {
|
||||
<div className="picker-loading">Loading...</div>
|
||||
) : (
|
||||
<div className="file-picker-list">
|
||||
{files.map((f) => (
|
||||
{files.map(f => (
|
||||
<button
|
||||
type="button"
|
||||
key={f.id}
|
||||
className="file-picker-item"
|
||||
onClick={() => onSelect(f.id)}
|
||||
@@ -92,17 +103,13 @@ export function FilePicker({ onSelect, onClose }: FilePickerProps) {
|
||||
</div>
|
||||
)}
|
||||
<div className="picker-pagination">
|
||||
<button
|
||||
disabled={page <= 1}
|
||||
onClick={() => setPage((p) => p - 1)}
|
||||
>
|
||||
<button type="button" disabled={page <= 1} onClick={() => setPage(p => p - 1)}>
|
||||
Prev
|
||||
</button>
|
||||
<span>{page} / {totalPages}</span>
|
||||
<button
|
||||
disabled={page >= totalPages}
|
||||
onClick={() => setPage((p) => p + 1)}
|
||||
>
|
||||
<span>
|
||||
{page} / {totalPages}
|
||||
</span>
|
||||
<button type="button" disabled={page >= totalPages} onClick={() => setPage(p => p + 1)}>
|
||||
Next
|
||||
</button>
|
||||
</div>
|
||||
@@ -112,7 +119,7 @@ export function FilePicker({ onSelect, onClose }: FilePickerProps) {
|
||||
{tab === "upload" && (
|
||||
<div className="picker-upload">
|
||||
<input type="file" ref={fileRef} />
|
||||
<button onClick={handleUpload} disabled={uploading}>
|
||||
<button type="button" onClick={handleUpload} disabled={uploading}>
|
||||
{uploading ? "Uploading..." : "Upload"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, useRef } from "react"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { pb } from "../pb"
|
||||
import type { PbImage } from "../types"
|
||||
import "./ImagePicker.css"
|
||||
@@ -18,23 +18,25 @@ export function ImagePicker({ onSelect, onClose }: ImagePickerProps) {
|
||||
const fileRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
loadImages(page)
|
||||
}, [page])
|
||||
|
||||
async function loadImages(p: number) {
|
||||
let cancelled = false
|
||||
setLoading(true)
|
||||
try {
|
||||
const result = await pb.collection("images").getList<PbImage>(p, 20, {
|
||||
sort: "-created",
|
||||
pb.collection("images")
|
||||
.getList<PbImage>(page, 20, { sort: "-created" })
|
||||
.then(result => {
|
||||
if (cancelled) return
|
||||
setImages(result.items)
|
||||
setTotalPages(result.totalPages)
|
||||
})
|
||||
setImages(result.items)
|
||||
setTotalPages(result.totalPages)
|
||||
} catch (err) {
|
||||
console.error("Failed to load images:", err)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
.catch(err => {
|
||||
if (!cancelled) console.error("Failed to load images:", err)
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setLoading(false)
|
||||
})
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}
|
||||
}, [page])
|
||||
|
||||
async function handleUpload() {
|
||||
const file = fileRef.current?.files?.[0]
|
||||
@@ -64,22 +66,30 @@ export function ImagePicker({ onSelect, onClose }: ImagePickerProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="picker-overlay" onClick={onClose}>
|
||||
<div className="picker" onClick={(e) => e.stopPropagation()}>
|
||||
<div
|
||||
className="picker-overlay"
|
||||
onClick={onClose}
|
||||
onKeyDown={e => {
|
||||
if (e.key === "Escape") onClose()
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="picker"
|
||||
onClick={e => e.stopPropagation()}
|
||||
onKeyDown={e => {
|
||||
e.stopPropagation()
|
||||
}}
|
||||
>
|
||||
<div className="picker-header">
|
||||
<button
|
||||
className={tab === "browse" ? "active" : ""}
|
||||
onClick={() => setTab("browse")}
|
||||
>
|
||||
<button type="button" className={tab === "browse" ? "active" : ""} onClick={() => setTab("browse")}>
|
||||
Browse
|
||||
</button>
|
||||
<button
|
||||
className={tab === "upload" ? "active" : ""}
|
||||
onClick={() => setTab("upload")}
|
||||
>
|
||||
<button type="button" className={tab === "upload" ? "active" : ""} onClick={() => setTab("upload")}>
|
||||
Upload
|
||||
</button>
|
||||
<button className="picker-close" onClick={onClose}>×</button>
|
||||
<button type="button" className="picker-close" onClick={onClose}>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{tab === "browse" && (
|
||||
@@ -88,8 +98,9 @@ export function ImagePicker({ onSelect, onClose }: ImagePickerProps) {
|
||||
<div className="picker-loading">Loading...</div>
|
||||
) : (
|
||||
<div className="picker-grid">
|
||||
{images.map((img) => (
|
||||
{images.map(img => (
|
||||
<button
|
||||
type="button"
|
||||
key={img.id}
|
||||
className="picker-thumb"
|
||||
onClick={() => onSelect(img.id)}
|
||||
@@ -100,17 +111,13 @@ export function ImagePicker({ onSelect, onClose }: ImagePickerProps) {
|
||||
</div>
|
||||
)}
|
||||
<div className="picker-pagination">
|
||||
<button
|
||||
disabled={page <= 1}
|
||||
onClick={() => setPage((p) => p - 1)}
|
||||
>
|
||||
<button type="button" disabled={page <= 1} onClick={() => setPage(p => p - 1)}>
|
||||
Prev
|
||||
</button>
|
||||
<span>{page} / {totalPages}</span>
|
||||
<button
|
||||
disabled={page >= totalPages}
|
||||
onClick={() => setPage((p) => p + 1)}
|
||||
>
|
||||
<span>
|
||||
{page} / {totalPages}
|
||||
</span>
|
||||
<button type="button" disabled={page >= totalPages} onClick={() => setPage(p => p + 1)}>
|
||||
Next
|
||||
</button>
|
||||
</div>
|
||||
@@ -120,7 +127,7 @@ export function ImagePicker({ onSelect, onClose }: ImagePickerProps) {
|
||||
{tab === "upload" && (
|
||||
<div className="picker-upload">
|
||||
<input type="file" accept="image/*" ref={fileRef} />
|
||||
<button onClick={handleUpload} disabled={uploading}>
|
||||
<button type="button" onClick={handleUpload} disabled={uploading}>
|
||||
{uploading ? "Uploading..." : "Upload"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react"
|
||||
import type { FormEvent } from "react"
|
||||
import { useState } from "react"
|
||||
import { pb } from "../pb"
|
||||
import "./Login.css"
|
||||
|
||||
@@ -36,14 +36,14 @@ export function Login({ onLogin }: LoginProps) {
|
||||
type="email"
|
||||
placeholder="Email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
onChange={e => setEmail(e.target.value)}
|
||||
required
|
||||
/>
|
||||
<input
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
onChange={e => setPassword(e.target.value)}
|
||||
required
|
||||
/>
|
||||
<button type="submit" disabled={loading}>
|
||||
|
||||
@@ -33,6 +33,7 @@ export function Toolbar({
|
||||
<div className="toolbar">
|
||||
<div className="toolbar-group">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleBold().run()}
|
||||
className={editor.isActive("bold") ? "active" : ""}
|
||||
title="Bold"
|
||||
@@ -40,6 +41,7 @@ export function Toolbar({
|
||||
B
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleItalic().run()}
|
||||
className={editor.isActive("italic") ? "active" : ""}
|
||||
title="Italic"
|
||||
@@ -47,6 +49,7 @@ export function Toolbar({
|
||||
I
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleStrike().run()}
|
||||
className={editor.isActive("strike") ? "active" : ""}
|
||||
title="Strikethrough"
|
||||
@@ -54,6 +57,7 @@ export function Toolbar({
|
||||
S
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleCode().run()}
|
||||
className={editor.isActive("code") ? "active" : ""}
|
||||
title="Inline code"
|
||||
@@ -64,18 +68,21 @@ export function Toolbar({
|
||||
|
||||
<div className="toolbar-group">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
|
||||
className={editor.isActive("heading", { level: 1 }) ? "active" : ""}
|
||||
>
|
||||
H1
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleHeading({ level: 2 }).run()}
|
||||
className={editor.isActive("heading", { level: 2 }) ? "active" : ""}
|
||||
>
|
||||
H2
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleHeading({ level: 3 }).run()}
|
||||
className={editor.isActive("heading", { level: 3 }) ? "active" : ""}
|
||||
>
|
||||
@@ -85,6 +92,7 @@ export function Toolbar({
|
||||
|
||||
<div className="toolbar-group">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleBulletList().run()}
|
||||
className={editor.isActive("bulletList") ? "active" : ""}
|
||||
title="Bullet list"
|
||||
@@ -92,6 +100,7 @@ export function Toolbar({
|
||||
List
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleOrderedList().run()}
|
||||
className={editor.isActive("orderedList") ? "active" : ""}
|
||||
title="Numbered list"
|
||||
@@ -99,6 +108,7 @@ export function Toolbar({
|
||||
1.
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleBlockquote().run()}
|
||||
className={editor.isActive("blockquote") ? "active" : ""}
|
||||
title="Blockquote"
|
||||
@@ -106,6 +116,7 @@ export function Toolbar({
|
||||
“
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().toggleCodeBlock().run()}
|
||||
className={editor.isActive("codeBlock") ? "active" : ""}
|
||||
title="Code block"
|
||||
@@ -113,6 +124,7 @@ export function Toolbar({
|
||||
Code
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => editor.chain().focus().setHorizontalRule().run()}
|
||||
title="Horizontal rule"
|
||||
>
|
||||
@@ -122,6 +134,7 @@ export function Toolbar({
|
||||
|
||||
<div className="toolbar-group">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onToggleMarkdown}
|
||||
className={markdownMode ? "active" : ""}
|
||||
title="Toggle markdown view"
|
||||
@@ -131,14 +144,11 @@ export function Toolbar({
|
||||
</div>
|
||||
|
||||
<div className="toolbar-group toolbar-actions">
|
||||
<button
|
||||
onClick={onSave}
|
||||
disabled={!canSave || saving}
|
||||
className="toolbar-save-btn"
|
||||
>
|
||||
<button type="button" onClick={onSave} disabled={!canSave || saving} className="toolbar-save-btn">
|
||||
{saving ? "Saving..." : "Save"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onPublish}
|
||||
disabled={!canPublish || publishing}
|
||||
className="toolbar-publish-btn"
|
||||
|
||||
Reference in new issue
Block a user