All checks were successful
CD / Build and push images (push) Successful in 2m3s
CI / Lint, typecheck, test (push) Successful in 1m41s
CI / Auth e2e pack (push) Successful in 1m46s
CI / Build container images (push) Has been skipped
CD / Deploy to Test (push) Successful in 8s
CD / Smoke tests against Test (push) Successful in 1m10s
CD / Promote to Int (push) Successful in 10s
Wires docToMarkdown/markdownToDoc into the editor clipboard: copying selected content puts Markdown on text/plain alongside the browser's own HTML (so pasting into a plain-text destination yields Markdown), and pasting plain text that looks like a Markdown document converts it to rich nodes; content with real HTML on the clipboard is left to ProseMirror's normal HTML-based paste, and the heuristic requires two or more distinct Markdown-shaped lines (or a fenced code block) so ordinary prose is never mangled. Both directions need the parsed/selected doc re-hydrated against whichever schema instance is on the other side of the boundary: the canonical editorSchema (packages/shared) for markdownToDoc's output before inserting it into the live view, and the live view's schema wrapped back into editorSchema before handing a slice to docToMarkdown — they're structurally identical but not the same object, and ProseMirror's content checks are identity-based. Adds GET /pages/:id/export/markdown (downloads <slug>.md), serving the already-derived page_content_cache.markdown (#23) rather than re-decoding the Yjs state. "Copy as Markdown" and "Download as Markdown" actions in the page header both read from that same endpoint, so they always agree with each other and with the last saved state. Closes #30
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import type { AnyExtension } from '@tiptap/core';
|
|
|
|
import { MarkdownClipboard } from './markdown-clipboard';
|
|
import { Bold, CodeMark, Italic, LinkMark, Strikethrough } from './marks';
|
|
import { Image } from './nodes/image';
|
|
import { BulletList, ListItem, OrderedList, TaskList } from './nodes/lists';
|
|
import { Table, TableCell, TableHeader, TableRow } from './nodes/table';
|
|
import { TaskItem } from './nodes/task-item';
|
|
import {
|
|
Blockquote,
|
|
CodeBlock,
|
|
Doc,
|
|
HardBreak,
|
|
Heading,
|
|
HorizontalRule,
|
|
Paragraph,
|
|
Text,
|
|
} from './nodes/text-basics';
|
|
|
|
/**
|
|
* The full node/mark set for `editorSchema` (packages/shared, issue #24),
|
|
* minus `Collaboration` — that extension needs a per-page `Y.Doc` and is
|
|
* added by the caller (`PageEditorPage`, issue #25).
|
|
*/
|
|
export const documentExtensions: AnyExtension[] = [
|
|
Doc,
|
|
Text,
|
|
Paragraph,
|
|
Heading,
|
|
Blockquote,
|
|
CodeBlock,
|
|
HorizontalRule,
|
|
BulletList,
|
|
OrderedList,
|
|
ListItem,
|
|
TaskList,
|
|
TaskItem,
|
|
HardBreak,
|
|
Image,
|
|
Table,
|
|
TableRow,
|
|
TableCell,
|
|
TableHeader,
|
|
Bold,
|
|
Italic,
|
|
CodeMark,
|
|
Strikethrough,
|
|
LinkMark,
|
|
MarkdownClipboard,
|
|
];
|