@arbidocs/blocks 0.4.12 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{StreamedArtifactEditor-6ETUHNQN.js → StreamedArtifactEditor-7JHF4JIY.js} +3 -3
- package/dist/{StreamedArtifactEditor-6ETUHNQN.js.map → StreamedArtifactEditor-7JHF4JIY.js.map} +1 -1
- package/dist/{StreamedArtifactEditor-5BMNWSS4.cjs → StreamedArtifactEditor-L2AZZORU.cjs} +4 -4
- package/dist/{StreamedArtifactEditor-5BMNWSS4.cjs.map → StreamedArtifactEditor-L2AZZORU.cjs.map} +1 -1
- package/dist/agents/index.cjs +160 -160
- package/dist/agents/index.js +3 -3
- package/dist/artifacts/editor/index.cjs +3 -3
- package/dist/artifacts/editor/index.js +1 -1
- package/dist/{chunk-557EU3G4.js → chunk-JLOYWXRB.js} +3 -3
- package/dist/{chunk-557EU3G4.js.map → chunk-JLOYWXRB.js.map} +1 -1
- package/dist/{chunk-HSFGOA6V.js → chunk-NEFHQHQV.js} +18 -3
- package/dist/chunk-NEFHQHQV.js.map +1 -0
- package/dist/{chunk-RUNQFXPH.cjs → chunk-QS4RV3MA.cjs} +17 -2
- package/dist/chunk-QS4RV3MA.cjs.map +1 -0
- package/dist/{chunk-67HGXV4I.cjs → chunk-SY7UURF7.cjs} +3 -3
- package/dist/{chunk-67HGXV4I.cjs.map → chunk-SY7UURF7.cjs.map} +1 -1
- package/dist/{chunk-CVFBSUXL.js → chunk-YP264PVL.js} +3 -3
- package/dist/{chunk-CVFBSUXL.js.map → chunk-YP264PVL.js.map} +1 -1
- package/dist/{chunk-DCEI37AX.cjs → chunk-YVIOCITQ.cjs} +3 -3
- package/dist/{chunk-DCEI37AX.cjs.map → chunk-YVIOCITQ.cjs.map} +1 -1
- package/dist/connect/index.cjs +23 -23
- package/dist/connect/index.js +3 -3
- package/dist/facts/index.cjs +1 -1
- package/dist/facts/index.js +1 -1
- package/dist/files/index.cjs +2 -2
- package/dist/files/index.js +2 -2
- package/dist/index.cjs +375 -375
- package/dist/index.js +6 -6
- package/dist/settings/index.cjs +31 -31
- package/dist/settings/index.js +2 -2
- package/dist/shell/index.cjs +1 -1
- package/dist/shell/index.js +1 -1
- package/dist/workspaces/index.cjs +1 -1
- package/dist/workspaces/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-HSFGOA6V.js.map +0 -1
- package/dist/chunk-RUNQFXPH.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { testIdOr } from './chunk-7F6CBP3Z.js';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
|
-
import { MDXEditor, headingsPlugin, listsPlugin, quotePlugin, thematicBreakPlugin, linkPlugin, linkDialogPlugin, tablePlugin, markdownShortcutPlugin, toolbarPlugin, UndoRedo, Separator, BoldItalicUnderlineToggles, BlockTypeSelect, ListsToggle, CreateLink, InsertTable, InsertThematicBreak, usePublisher, insertMarkdown$ } from '@mdxeditor/editor';
|
|
4
|
+
import { MDXEditor, headingsPlugin, listsPlugin, quotePlugin, thematicBreakPlugin, linkPlugin, linkDialogPlugin, tablePlugin, codeBlockPlugin, markdownShortcutPlugin, toolbarPlugin, UndoRedo, Separator, BoldItalicUnderlineToggles, BlockTypeSelect, ListsToggle, CreateLink, InsertTable, InsertThematicBreak, useCodeBlockEditorContext, usePublisher, insertMarkdown$ } from '@mdxeditor/editor';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
function DictationSlot({
|
|
@@ -10,6 +10,20 @@ function DictationSlot({
|
|
|
10
10
|
const insertMarkdown = usePublisher(insertMarkdown$);
|
|
11
11
|
return /* @__PURE__ */ jsx(Fragment, { children: render(insertMarkdown) });
|
|
12
12
|
}
|
|
13
|
+
function PlainCodeBlockEditor({ code }) {
|
|
14
|
+
const { setCode } = useCodeBlockEditorContext();
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"textarea",
|
|
17
|
+
{
|
|
18
|
+
className: "w-full rounded-md border border-border bg-muted p-3 font-mono text-sm",
|
|
19
|
+
rows: Math.max(2, code.split("\n").length),
|
|
20
|
+
value: code,
|
|
21
|
+
spellCheck: false,
|
|
22
|
+
onChange: (e) => setCode(e.target.value)
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
var CODE_BLOCK_DESCRIPTORS = [{ priority: -10, match: () => true, Editor: PlainCodeBlockEditor }];
|
|
13
27
|
var DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS = {
|
|
14
28
|
editor: "Document editor",
|
|
15
29
|
placeholder: "Start typing\u2026"
|
|
@@ -55,6 +69,7 @@ function ArtifactMarkdownEditor({
|
|
|
55
69
|
linkPlugin(),
|
|
56
70
|
linkDialogPlugin(),
|
|
57
71
|
tablePlugin(),
|
|
72
|
+
codeBlockPlugin({ codeBlockEditorDescriptors: CODE_BLOCK_DESCRIPTORS }),
|
|
58
73
|
markdownShortcutPlugin(),
|
|
59
74
|
toolbarPlugin({
|
|
60
75
|
toolbarContents: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -82,5 +97,5 @@ function ArtifactMarkdownEditor({
|
|
|
82
97
|
}
|
|
83
98
|
|
|
84
99
|
export { ArtifactMarkdownEditor, DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS };
|
|
85
|
-
//# sourceMappingURL=chunk-
|
|
86
|
-
//# sourceMappingURL=chunk-
|
|
100
|
+
//# sourceMappingURL=chunk-NEFHQHQV.js.map
|
|
101
|
+
//# sourceMappingURL=chunk-NEFHQHQV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/artifacts/editor/ArtifactMarkdownEditor.tsx"],"names":[],"mappings":";;;;;AA8BA,SAAS,aAAA,CAAc;AAAA,EACrB;AACF,CAAA,EAEuB;AACrB,EAAA,MAAM,cAAA,GAAiB,aAAa,eAA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AAA,EAAA,EAAW,CAAA;AAAA,oCACX,WAAA,EAAA,EAAY,CAAA;AAAA,oCACZ,mBAAA,EAAA,EAAoB,CAAA;AAAA,gBACpB,6BACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,kCAAA,GAAA,CAAC,SAAA,EAAA,EAAU,CAAA;AAAA,kCACX,GAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EAAQ,SAAA,EAAW;AAAA,iBAAA,EACpC;AAAA,eAAA,EAEJ;AAAA,aAEH;AAAA;AACH;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-NEFHQHQV.js","sourcesContent":["import { useRef, type ReactNode } from 'react'\nimport {\n MDXEditor,\n type MDXEditorMethods,\n headingsPlugin,\n listsPlugin,\n quotePlugin,\n thematicBreakPlugin,\n linkPlugin,\n linkDialogPlugin,\n tablePlugin,\n codeBlockPlugin,\n markdownShortcutPlugin,\n toolbarPlugin,\n UndoRedo,\n BoldItalicUnderlineToggles,\n BlockTypeSelect,\n ListsToggle,\n CreateLink,\n InsertTable,\n InsertThematicBreak,\n Separator,\n insertMarkdown$,\n usePublisher,\n useCodeBlockEditorContext,\n type CodeBlockEditorProps,\n} from '@mdxeditor/editor'\nimport { testIdOr } from '../../chat/test-id'\n\n/** Renders the host's dictation control; `insert` puts text at the cursor. */\nfunction DictationSlot({\n render,\n}: {\n render: (insert: (markdown: string) => void) => ReactNode\n}): React.ReactElement {\n const insertMarkdown = usePublisher(insertMarkdown$)\n return <>{render(insertMarkdown)}</>\n}\n\n/** A plain-text editor for a fenced code block (no syntax highlighting, so no extra bundle). */\nfunction PlainCodeBlockEditor({ code }: CodeBlockEditorProps): React.ReactElement {\n const { setCode } = useCodeBlockEditorContext()\n return (\n <textarea\n className=\"w-full rounded-md border border-border bg-muted p-3 font-mono text-sm\"\n rows={Math.max(2, code.split('\\n').length)}\n value={code}\n spellCheck={false}\n onChange={(e) => setCode(e.target.value)}\n />\n )\n}\n\n// MDXEditor stops importing at a construct it has no plugin for (a code fence), flags a\n// processing error and from then on never calls `onChange`: the rest of the document disappears\n// and no edit can be saved. A catch-all code block editor keeps such documents editable.\nconst CODE_BLOCK_DESCRIPTORS = [{ priority: -10, match: () => true, Editor: PlainCodeBlockEditor }]\n\nexport interface ArtifactMarkdownEditorLabels {\n /** The accessible name of the editor region. */\n editor: string\n placeholder: string\n}\n\nexport const DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS: ArtifactMarkdownEditorLabels = {\n editor: 'Document editor',\n placeholder: 'Start typing…',\n}\n\nexport interface ArtifactMarkdownEditorProps {\n /** Current markdown (controlled by the parent). */\n markdown: string\n /** Called with the new markdown whenever the document changes. */\n onChange: (markdown: string) => void\n /**\n * Fired exactly once per editor instance, with the markdown the editor produces on mount.\n * MDXEditor canonicalises the source as it parses (table padding, escapes, thematic-break\n * style), so the first `onChange` after mount is the round-tripped form of the input, not a\n * user edit. Use it to adopt the normalised form as the baseline so entering edit mode does\n * not look dirty. Remount via `key` to receive it for the next document.\n */\n onNormalized?: (normalized: string) => void\n /**\n * A dictation control for the toolbar (the host owns recording and transcription, for example\n * `@arbidocs/react`'s `InlineMicButton`). It gets a function that inserts text at the cursor.\n */\n dictation?: (insert: (markdown: string) => void) => ReactNode\n labels?: Partial<ArtifactMarkdownEditorLabels>\n testId?: string\n}\n\n/**\n * WYSIWYG editor for artifact documents: the user edits the rendered document directly and the\n * editor round-trips Markdown, so `onChange` always yields markdown a save can persist unchanged.\n *\n *\n * Heavy (Lexical via MDXEditor): mount it behind a lazy boundary. The host imports\n * `@mdxeditor/editor/style.css` once and, from the module that lazily imports this one, a module\n * that defines the global `Prism` FIRST (assign the prismjs core to `globalThis.Prism`):\n * `@lexical/code` reads it while it evaluates, and a library cannot order that in every bundler.\n */\nexport function ArtifactMarkdownEditor({\n markdown,\n onChange,\n onNormalized,\n dictation,\n labels,\n testId,\n}: ArtifactMarkdownEditorProps): React.ReactElement {\n const l = { ...DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS, ...labels }\n const ref = useRef<MDXEditorMethods>(null)\n // Latched until MDXEditor fires its first onChange after mount: that is the canonicalisation\n // round-trip, not a user edit.\n const pendingNormalizationRef = useRef(true)\n\n return (\n <div\n role=\"group\"\n aria-label={l.editor}\n data-testid={testIdOr(testId, { testId: 'artifact-markdown-editor' })}\n className=\"h-full pointer-coarse:[&_[role=toolbar]_button]:min-h-11 pointer-coarse:[&_[role=toolbar]_button]:min-w-11\"\n >\n <MDXEditor\n ref={ref}\n markdown={markdown}\n onChange={(next) => {\n if (pendingNormalizationRef.current) {\n pendingNormalizationRef.current = false\n onNormalized?.(next)\n }\n onChange(next)\n }}\n contentEditableClassName=\"markdown-content max-w-none px-6 py-4 outline-none min-h-full\"\n className=\"h-full overflow-auto bg-background\"\n placeholder={<span className=\"text-muted-foreground\">{l.placeholder}</span>}\n plugins={[\n headingsPlugin(),\n listsPlugin(),\n quotePlugin(),\n thematicBreakPlugin(),\n linkPlugin(),\n linkDialogPlugin(),\n tablePlugin(),\n codeBlockPlugin({ codeBlockEditorDescriptors: CODE_BLOCK_DESCRIPTORS }),\n markdownShortcutPlugin(),\n toolbarPlugin({\n toolbarContents: () => (\n <>\n <UndoRedo />\n <Separator />\n <BoldItalicUnderlineToggles />\n <Separator />\n <BlockTypeSelect />\n <ListsToggle />\n <Separator />\n <CreateLink />\n <InsertTable />\n <InsertThematicBreak />\n {dictation && (\n <>\n <Separator />\n <DictationSlot render={dictation} />\n </>\n )}\n </>\n ),\n }),\n ]}\n />\n </div>\n )\n}\n"]}
|
|
@@ -12,6 +12,20 @@ function DictationSlot({
|
|
|
12
12
|
const insertMarkdown = editor.usePublisher(editor.insertMarkdown$);
|
|
13
13
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: render(insertMarkdown) });
|
|
14
14
|
}
|
|
15
|
+
function PlainCodeBlockEditor({ code }) {
|
|
16
|
+
const { setCode } = editor.useCodeBlockEditorContext();
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
|
+
"textarea",
|
|
19
|
+
{
|
|
20
|
+
className: "w-full rounded-md border border-border bg-muted p-3 font-mono text-sm",
|
|
21
|
+
rows: Math.max(2, code.split("\n").length),
|
|
22
|
+
value: code,
|
|
23
|
+
spellCheck: false,
|
|
24
|
+
onChange: (e) => setCode(e.target.value)
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
var CODE_BLOCK_DESCRIPTORS = [{ priority: -10, match: () => true, Editor: PlainCodeBlockEditor }];
|
|
15
29
|
var DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS = {
|
|
16
30
|
editor: "Document editor",
|
|
17
31
|
placeholder: "Start typing\u2026"
|
|
@@ -57,6 +71,7 @@ function ArtifactMarkdownEditor({
|
|
|
57
71
|
editor.linkPlugin(),
|
|
58
72
|
editor.linkDialogPlugin(),
|
|
59
73
|
editor.tablePlugin(),
|
|
74
|
+
editor.codeBlockPlugin({ codeBlockEditorDescriptors: CODE_BLOCK_DESCRIPTORS }),
|
|
60
75
|
editor.markdownShortcutPlugin(),
|
|
61
76
|
editor.toolbarPlugin({
|
|
62
77
|
toolbarContents: () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -85,5 +100,5 @@ function ArtifactMarkdownEditor({
|
|
|
85
100
|
|
|
86
101
|
exports.ArtifactMarkdownEditor = ArtifactMarkdownEditor;
|
|
87
102
|
exports.DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS = DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS;
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
103
|
+
//# sourceMappingURL=chunk-QS4RV3MA.cjs.map
|
|
104
|
+
//# sourceMappingURL=chunk-QS4RV3MA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/artifacts/editor/ArtifactMarkdownEditor.tsx"],"names":["usePublisher","insertMarkdown$","jsx","Fragment","useCodeBlockEditorContext","useRef","testIdOr","MDXEditor","headingsPlugin","listsPlugin","quotePlugin","thematicBreakPlugin","linkPlugin","linkDialogPlugin","tablePlugin","codeBlockPlugin","markdownShortcutPlugin","toolbarPlugin","jsxs","UndoRedo","Separator","BoldItalicUnderlineToggles","BlockTypeSelect","ListsToggle","CreateLink","InsertTable","InsertThematicBreak"],"mappings":";;;;;;;AA8BA,SAAS,aAAA,CAAc;AAAA,EACrB;AACF,CAAA,EAEuB;AACrB,EAAA,MAAM,cAAA,GAAiBA,oBAAaC,sBAAe,CAAA;AACnD,EAAA,uBAAOC,cAAA,CAAAC,mBAAA,EAAA,EAAG,QAAA,EAAA,MAAA,CAAO,cAAc,CAAA,EAAE,CAAA;AACnC;AAGA,SAAS,oBAAA,CAAqB,EAAE,IAAA,EAAK,EAA6C;AAChF,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAIC,gCAAA,EAA0B;AAC9C,EAAA,uBACEF,cAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,uEAAA;AAAA,MACV,IAAA,EAAM,KAAK,GAAA,CAAI,CAAA,EAAG,KAAK,KAAA,CAAM,IAAI,EAAE,MAAM,CAAA;AAAA,MACzC,KAAA,EAAO,IAAA;AAAA,MACP,UAAA,EAAY,KAAA;AAAA,MACZ,UAAU,CAAC,CAAA,KAAM,OAAA,CAAQ,CAAA,CAAE,OAAO,KAAK;AAAA;AAAA,GACzC;AAEJ;AAKA,IAAM,sBAAA,GAAyB,CAAC,EAAE,QAAA,EAAU,GAAA,EAAK,OAAO,MAAM,IAAA,EAAM,MAAA,EAAQ,oBAAA,EAAsB,CAAA;AAQ3F,IAAM,uCAAA,GAAwE;AAAA,EACnF,MAAA,EAAQ,iBAAA;AAAA,EACR,WAAA,EAAa;AACf;AAkCO,SAAS,sBAAA,CAAuB;AAAA,EACrC,QAAA;AAAA,EACA,QAAA;AAAA,EACA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AAA;AAAA,YACtEC,6BAAA,EAAuB;AAAA,YACvBC,oBAAA,CAAc;AAAA,cACZ,eAAA,EAAiB,sBACfC,eAAA,CAAAf,mBAAA,EAAA,EACE,QAAA,EAAA;AAAA,gCAAAD,cAAA,CAACiB,eAAA,EAAA,EAAS,CAAA;AAAA,+CACTC,gBAAA,EAAA,EAAU,CAAA;AAAA,+CACVC,iCAAA,EAAA,EAA2B,CAAA;AAAA,+CAC3BD,gBAAA,EAAA,EAAU,CAAA;AAAA,+CACVE,sBAAA,EAAA,EAAgB,CAAA;AAAA,+CAChBC,kBAAA,EAAA,EAAY,CAAA;AAAA,+CACZH,gBAAA,EAAA,EAAU,CAAA;AAAA,+CACVI,iBAAA,EAAA,EAAW,CAAA;AAAA,+CACXC,kBAAA,EAAA,EAAY,CAAA;AAAA,+CACZC,0BAAA,EAAA,EAAoB,CAAA;AAAA,gBACpB,6BACCR,eAAA,CAAAf,mBAAA,EAAA,EACE,QAAA,EAAA;AAAA,kCAAAD,cAAA,CAACkB,gBAAA,EAAA,EAAU,CAAA;AAAA,kCACXlB,cAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EAAQ,SAAA,EAAW;AAAA,iBAAA,EACpC;AAAA,eAAA,EAEJ;AAAA,aAEH;AAAA;AACH;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-QS4RV3MA.cjs","sourcesContent":["import { useRef, type ReactNode } from 'react'\nimport {\n MDXEditor,\n type MDXEditorMethods,\n headingsPlugin,\n listsPlugin,\n quotePlugin,\n thematicBreakPlugin,\n linkPlugin,\n linkDialogPlugin,\n tablePlugin,\n codeBlockPlugin,\n markdownShortcutPlugin,\n toolbarPlugin,\n UndoRedo,\n BoldItalicUnderlineToggles,\n BlockTypeSelect,\n ListsToggle,\n CreateLink,\n InsertTable,\n InsertThematicBreak,\n Separator,\n insertMarkdown$,\n usePublisher,\n useCodeBlockEditorContext,\n type CodeBlockEditorProps,\n} from '@mdxeditor/editor'\nimport { testIdOr } from '../../chat/test-id'\n\n/** Renders the host's dictation control; `insert` puts text at the cursor. */\nfunction DictationSlot({\n render,\n}: {\n render: (insert: (markdown: string) => void) => ReactNode\n}): React.ReactElement {\n const insertMarkdown = usePublisher(insertMarkdown$)\n return <>{render(insertMarkdown)}</>\n}\n\n/** A plain-text editor for a fenced code block (no syntax highlighting, so no extra bundle). */\nfunction PlainCodeBlockEditor({ code }: CodeBlockEditorProps): React.ReactElement {\n const { setCode } = useCodeBlockEditorContext()\n return (\n <textarea\n className=\"w-full rounded-md border border-border bg-muted p-3 font-mono text-sm\"\n rows={Math.max(2, code.split('\\n').length)}\n value={code}\n spellCheck={false}\n onChange={(e) => setCode(e.target.value)}\n />\n )\n}\n\n// MDXEditor stops importing at a construct it has no plugin for (a code fence), flags a\n// processing error and from then on never calls `onChange`: the rest of the document disappears\n// and no edit can be saved. A catch-all code block editor keeps such documents editable.\nconst CODE_BLOCK_DESCRIPTORS = [{ priority: -10, match: () => true, Editor: PlainCodeBlockEditor }]\n\nexport interface ArtifactMarkdownEditorLabels {\n /** The accessible name of the editor region. */\n editor: string\n placeholder: string\n}\n\nexport const DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS: ArtifactMarkdownEditorLabels = {\n editor: 'Document editor',\n placeholder: 'Start typing…',\n}\n\nexport interface ArtifactMarkdownEditorProps {\n /** Current markdown (controlled by the parent). */\n markdown: string\n /** Called with the new markdown whenever the document changes. */\n onChange: (markdown: string) => void\n /**\n * Fired exactly once per editor instance, with the markdown the editor produces on mount.\n * MDXEditor canonicalises the source as it parses (table padding, escapes, thematic-break\n * style), so the first `onChange` after mount is the round-tripped form of the input, not a\n * user edit. Use it to adopt the normalised form as the baseline so entering edit mode does\n * not look dirty. Remount via `key` to receive it for the next document.\n */\n onNormalized?: (normalized: string) => void\n /**\n * A dictation control for the toolbar (the host owns recording and transcription, for example\n * `@arbidocs/react`'s `InlineMicButton`). It gets a function that inserts text at the cursor.\n */\n dictation?: (insert: (markdown: string) => void) => ReactNode\n labels?: Partial<ArtifactMarkdownEditorLabels>\n testId?: string\n}\n\n/**\n * WYSIWYG editor for artifact documents: the user edits the rendered document directly and the\n * editor round-trips Markdown, so `onChange` always yields markdown a save can persist unchanged.\n *\n *\n * Heavy (Lexical via MDXEditor): mount it behind a lazy boundary. The host imports\n * `@mdxeditor/editor/style.css` once and, from the module that lazily imports this one, a module\n * that defines the global `Prism` FIRST (assign the prismjs core to `globalThis.Prism`):\n * `@lexical/code` reads it while it evaluates, and a library cannot order that in every bundler.\n */\nexport function ArtifactMarkdownEditor({\n markdown,\n onChange,\n onNormalized,\n dictation,\n labels,\n testId,\n}: ArtifactMarkdownEditorProps): React.ReactElement {\n const l = { ...DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS, ...labels }\n const ref = useRef<MDXEditorMethods>(null)\n // Latched until MDXEditor fires its first onChange after mount: that is the canonicalisation\n // round-trip, not a user edit.\n const pendingNormalizationRef = useRef(true)\n\n return (\n <div\n role=\"group\"\n aria-label={l.editor}\n data-testid={testIdOr(testId, { testId: 'artifact-markdown-editor' })}\n className=\"h-full pointer-coarse:[&_[role=toolbar]_button]:min-h-11 pointer-coarse:[&_[role=toolbar]_button]:min-w-11\"\n >\n <MDXEditor\n ref={ref}\n markdown={markdown}\n onChange={(next) => {\n if (pendingNormalizationRef.current) {\n pendingNormalizationRef.current = false\n onNormalized?.(next)\n }\n onChange(next)\n }}\n contentEditableClassName=\"markdown-content max-w-none px-6 py-4 outline-none min-h-full\"\n className=\"h-full overflow-auto bg-background\"\n placeholder={<span className=\"text-muted-foreground\">{l.placeholder}</span>}\n plugins={[\n headingsPlugin(),\n listsPlugin(),\n quotePlugin(),\n thematicBreakPlugin(),\n linkPlugin(),\n linkDialogPlugin(),\n tablePlugin(),\n codeBlockPlugin({ codeBlockEditorDescriptors: CODE_BLOCK_DESCRIPTORS }),\n markdownShortcutPlugin(),\n toolbarPlugin({\n toolbarContents: () => (\n <>\n <UndoRedo />\n <Separator />\n <BoldItalicUnderlineToggles />\n <Separator />\n <BlockTypeSelect />\n <ListsToggle />\n <Separator />\n <CreateLink />\n <InsertTable />\n <InsertThematicBreak />\n {dictation && (\n <>\n <Separator />\n <DictationSlot render={dictation} />\n </>\n )}\n </>\n ),\n }),\n ]}\n />\n </div>\n )\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var chunkV4ISCZJ7_cjs = require('./chunk-V4ISCZJ7.cjs');
|
|
5
4
|
var chunkZVPTFTGV_cjs = require('./chunk-ZVPTFTGV.cjs');
|
|
5
|
+
var chunkV4ISCZJ7_cjs = require('./chunk-V4ISCZJ7.cjs');
|
|
6
6
|
var chunkRFIBUWLF_cjs = require('./chunk-RFIBUWLF.cjs');
|
|
7
7
|
var chunk5B4PXAKI_cjs = require('./chunk-5B4PXAKI.cjs');
|
|
8
8
|
var chunkZW6FPIFC_cjs = require('./chunk-ZW6FPIFC.cjs');
|
|
@@ -5825,5 +5825,5 @@ exports.workflowFromFrontmatter = workflowFromFrontmatter;
|
|
|
5825
5825
|
exports.workflowTaskFields = workflowTaskFields;
|
|
5826
5826
|
exports.workflowsAccepting = workflowsAccepting;
|
|
5827
5827
|
exports.workflowsForHost = workflowsForHost;
|
|
5828
|
-
//# sourceMappingURL=chunk-
|
|
5829
|
-
//# sourceMappingURL=chunk-
|
|
5828
|
+
//# sourceMappingURL=chunk-SY7UURF7.cjs.map
|
|
5829
|
+
//# sourceMappingURL=chunk-SY7UURF7.cjs.map
|