@plexui/vue 0.17.0 → 0.19.0

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.
@@ -1,20 +1,8 @@
1
1
  import { defineComponent, h, reactive, ref, watch, } from "vue";
2
2
  import { EditorContent, useEditor } from "@tiptap/vue-3";
3
3
  import { getMarkRange } from "@tiptap/core";
4
- import Document from "@tiptap/extension-document";
5
- import Paragraph from "@tiptap/extension-paragraph";
6
- import Text from "@tiptap/extension-text";
7
- import BoldExtension from "@tiptap/extension-bold";
8
- import ItalicExtension from "@tiptap/extension-italic";
9
- import LinkExtension from "@tiptap/extension-link";
10
- import BulletList from "@tiptap/extension-bullet-list";
11
- import OrderedList from "@tiptap/extension-ordered-list";
12
- import ListItem from "@tiptap/extension-list-item";
13
- import History from "@tiptap/extension-history";
14
- import Placeholder from "@tiptap/extension-placeholder";
15
- import HardBreak from "@tiptap/extension-hard-break";
16
- import { Markdown as MarkdownExtension } from "tiptap-markdown";
17
4
  import { keepMovedFocus } from "../../lib/helpers.js";
5
+ import { markdownEditorExtensions, markdownEditorSchema, rehypeEditorSchema, remarkLineBreaks, remarkWithoutHtml, } from "../../lib/markdownEditorSchema.js";
18
6
  import { Bold as BoldIcon, Italic as ItalicIcon, Link as LinkIcon, List as ListIcon, ListNumbers as ListNumbersIcon, } from "../Icon/index.js";
19
7
  import { Tooltip } from "../Tooltip/index.js";
20
8
  import { Button } from "../Button/index.js";
@@ -142,6 +130,17 @@ const MarkdownEditorComponent = defineComponent({
142
130
  value: { type: String, default: undefined },
143
131
  /** Default value as a markdown string for uncontrolled mode */
144
132
  defaultValue: { type: String, default: undefined },
133
+ /**
134
+ * The formats the editor offers, read when the editor is created. A format left out has no toolbar button,
135
+ * shortcut or input rule; pasted and incoming content keeps its text without it, and the markdown does not write it.
136
+ * @default ["bold", "italic", "orderedList", "bulletList", "link"]
137
+ */
138
+ formats: { type: Array, default: undefined },
139
+ /**
140
+ * A single newline is a line break, read and written as one "\n", read when the editor is created. Without it a
141
+ * line break is written as a backslash and a newline, and a single newline joins the lines. @default false
142
+ */
143
+ breaks: { type: Boolean, default: false },
145
144
  /** Minimum visible rows. @default 1 */
146
145
  rows: { type: Number, default: 1 },
147
146
  /** `id` of the editable element */
@@ -162,6 +161,8 @@ const MarkdownEditorComponent = defineComponent({
162
161
  "change": (markdown) => typeof markdown === "string",
163
162
  },
164
163
  setup(props, { slots, attrs, emit }) {
164
+ // The schema is the editor's, made once with it, as the toolbar offers what the schema has
165
+ const schema = markdownEditorSchema(props.formats, props.breaks);
165
166
  const focused = ref(false);
166
167
  const linkDialogOpen = ref(false);
167
168
  const linkDialogInitial = ref({ url: "", title: "" });
@@ -198,28 +199,7 @@ const MarkdownEditorComponent = defineComponent({
198
199
  ...(props.ariaInvalid && { "aria-invalid": "true" }),
199
200
  });
200
201
  const editor = useEditor({
201
- extensions: [
202
- Document,
203
- Paragraph,
204
- Text,
205
- HardBreak,
206
- BoldExtension,
207
- ItalicExtension,
208
- LinkExtension.configure({
209
- openOnClick: false,
210
- HTMLAttributes: { rel: "noopener noreferrer nofollow" },
211
- }),
212
- BulletList,
213
- OrderedList,
214
- ListItem,
215
- History,
216
- MarkdownExtension.configure({
217
- html: false,
218
- transformPastedText: true,
219
- transformCopiedText: true,
220
- }),
221
- ...(props.placeholder ? [Placeholder.configure({ placeholder: props.placeholder })] : []),
222
- ],
202
+ extensions: markdownEditorExtensions(schema, props.placeholder),
223
203
  content: props.value ?? props.defaultValue ?? "",
224
204
  editable: !props.disabled,
225
205
  editorProps: {
@@ -368,6 +348,51 @@ const MarkdownEditorComponent = defineComponent({
368
348
  // React renders the slot only for a truthy `toolbarEnd`
369
349
  const toolbarEnd = slots.toolbarEnd?.();
370
350
  const hasToolbarEnd = flattenSlot(toolbarEnd).length > 0;
351
+ const offered = schema.formats;
352
+ // Groups of the offered formats, a separator between two of them
353
+ const groups = [
354
+ [
355
+ offered.has("bold") && h(ToolbarButton, {
356
+ tooltip: "Bold",
357
+ active: activeMarks.bold,
358
+ disabled,
359
+ icon: BoldIcon,
360
+ onClick: () => editor.value?.chain().focus().toggleBold().run(),
361
+ }),
362
+ offered.has("italic") && h(ToolbarButton, {
363
+ tooltip: "Italic",
364
+ active: activeMarks.italic,
365
+ disabled,
366
+ icon: ItalicIcon,
367
+ onClick: () => editor.value?.chain().focus().toggleItalic().run(),
368
+ }),
369
+ ],
370
+ [
371
+ offered.has("orderedList") && h(ToolbarButton, {
372
+ tooltip: "Numbered list",
373
+ active: activeMarks.orderedList,
374
+ disabled,
375
+ icon: ListNumbersIcon,
376
+ onClick: () => editor.value?.chain().focus().toggleOrderedList().run(),
377
+ }),
378
+ offered.has("bulletList") && h(ToolbarButton, {
379
+ tooltip: "Bullet list",
380
+ active: activeMarks.bulletList,
381
+ disabled,
382
+ icon: ListIcon,
383
+ onClick: () => editor.value?.chain().focus().toggleBulletList().run(),
384
+ }),
385
+ ],
386
+ [
387
+ offered.has("link") && h(ToolbarButton, {
388
+ tooltip: "Link",
389
+ active: activeMarks.link,
390
+ disabled: disabled || !linkCanEnable.value,
391
+ icon: LinkIcon,
392
+ onClick: openLinkDialog,
393
+ }),
394
+ ],
395
+ ].map((group) => group.filter((button) => button !== false)).filter((group) => group.length > 0);
371
396
  return h("div", {
372
397
  "class": [s.Container, attrs.class],
373
398
  "data-variant": variant,
@@ -376,57 +401,26 @@ const MarkdownEditorComponent = defineComponent({
376
401
  "data-invalid": isInvalid ? "" : undefined,
377
402
  "onMousedown": handleContainerMouseDown,
378
403
  }, [
379
- h("div", { class: s.Toolbar, onMousedown: (e) => e.preventDefault() }, [
380
- h("div", { class: s.ToolbarGroup }, [
381
- h(ToolbarButton, {
382
- tooltip: "Bold",
383
- active: activeMarks.bold,
384
- disabled,
385
- icon: BoldIcon,
386
- onClick: () => editor.value?.chain().focus().toggleBold().run(),
387
- }),
388
- h(ToolbarButton, {
389
- tooltip: "Italic",
390
- active: activeMarks.italic,
391
- disabled,
392
- icon: ItalicIcon,
393
- onClick: () => editor.value?.chain().focus().toggleItalic().run(),
394
- }),
395
- h("div", { "class": s.ToolbarSeparator, "aria-hidden": "true" }),
396
- h(ToolbarButton, {
397
- tooltip: "Numbered list",
398
- active: activeMarks.orderedList,
399
- disabled,
400
- icon: ListNumbersIcon,
401
- onClick: () => editor.value?.chain().focus().toggleOrderedList().run(),
402
- }),
403
- h(ToolbarButton, {
404
- tooltip: "Bullet list",
405
- active: activeMarks.bulletList,
406
- disabled,
407
- icon: ListIcon,
408
- onClick: () => editor.value?.chain().focus().toggleBulletList().run(),
409
- }),
410
- h("div", { "class": s.ToolbarSeparator, "aria-hidden": "true" }),
411
- h(ToolbarButton, {
412
- tooltip: "Link",
413
- active: activeMarks.link,
414
- disabled: disabled || !linkCanEnable.value,
415
- icon: LinkIcon,
416
- onClick: openLinkDialog,
417
- }),
418
- ...(hasToolbarEnd
419
- ? [
420
- h("div", { "class": s.ToolbarSeparator, "aria-hidden": "true" }),
421
- h("div", { class: s.ToolbarEnd }, toolbarEnd),
422
- ]
423
- : []),
424
- ]),
425
- ]),
404
+ groups.length || hasToolbarEnd
405
+ ? h("div", { class: s.Toolbar, onMousedown: (e) => e.preventDefault() }, [
406
+ h("div", { class: s.ToolbarGroup }, [
407
+ ...groups.flatMap((group, index) => [
408
+ ...(index ? [h("div", { "class": s.ToolbarSeparator, "aria-hidden": "true" })] : []),
409
+ ...group,
410
+ ]),
411
+ ...(hasToolbarEnd
412
+ ? [
413
+ ...(groups.length ? [h("div", { "class": s.ToolbarSeparator, "aria-hidden": "true" })] : []),
414
+ h("div", { class: s.ToolbarEnd }, toolbarEnd),
415
+ ]
416
+ : []),
417
+ ]),
418
+ ])
419
+ : null,
426
420
  h("div", { class: s.Editor, style: { minHeight: `${minHeight}px` } }, [
427
421
  editor.value
428
422
  ? h(EditorContent, { editor: editor.value })
429
- : editorFirstFrame(props.value ?? props.defaultValue ?? "", props.placeholder, props.disabled),
423
+ : editorFirstFrame(props.value ?? props.defaultValue ?? "", props.placeholder, props.disabled, schema),
430
424
  ]),
431
425
  h(LinkDialog, {
432
426
  open: linkDialogOpen.value,
@@ -443,147 +437,21 @@ const MarkdownEditorComponent = defineComponent({
443
437
  };
444
438
  },
445
439
  });
446
- // The editor reads markdown with `html: false` (markdown-it): HTML is not parsed, its characters are text, and the
447
- // markdown around and inside it still is
448
- function remarkWithoutHtml() {
449
- const data = this.data();
450
- (data.micromarkExtensions ??= []).push({ disable: { null: ["htmlFlow", "htmlText"] } });
451
- }
452
- // The editor's schema keeps paragraphs, lists, bold, italic, links and line breaks. ProseMirror parses anything else
453
- // into them: a heading is a paragraph of its text, a code block a paragraph of its lines, a quote its paragraphs,
454
- // inline code its text, an image or a rule nothing, and the text of a list item sits in a paragraph. Outside a code
455
- // block it collapses white space, as the page does; the editor's text keeps its spaces (white-space: break-spaces)
456
- const SCHEMA_AS_PARAGRAPH = new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
457
- const SCHEMA_BLOCKS = new Set(["p", "ul", "ol"]);
458
- const textOf = (node) => node.value ?? (node.children ?? []).map(textOf).join("");
459
- const isBlank = (node) => node.type === "text" && !node.value?.trim();
460
- const lineBreak = () => ({ type: "element", tagName: "br", properties: {}, children: [] });
461
- // White space of a paragraph's text as ProseMirror parses it: runs collapse to one space, none at the start of the
462
- // paragraph, after a line break or after another space, none at its end
463
- function collapseWhiteSpace(children) {
464
- let previous = null;
465
- let lineStart = true;
466
- const walk = (nodes) => {
467
- for (const node of nodes) {
468
- if (node.type === "text") {
469
- let value = (node.value ?? "").replace(/[ \t\r\n\f]+/g, " ");
470
- if (value.startsWith(" ") && (lineStart || previous?.value?.endsWith(" ")))
471
- value = value.slice(1);
472
- node.value = value;
473
- if (value) {
474
- previous = node;
475
- lineStart = false;
476
- }
477
- }
478
- else if (node.tagName === "br") {
479
- lineStart = true;
480
- }
481
- else {
482
- walk(node.children ?? []);
483
- }
484
- }
485
- };
486
- walk(children);
487
- if (previous)
488
- previous.value = previous.value.replace(/ $/, "");
489
- }
490
- const paragraph = (children, { preserveWhiteSpace = false } = {}) => {
491
- if (!preserveWhiteSpace)
492
- collapseWhiteSpace(children);
493
- return {
494
- type: "element",
495
- tagName: "p",
496
- properties: {},
497
- // An empty paragraph keeps its line, as ProseMirror's trailing break does
498
- children: children.every((child) => child.type === "text" && !child.value) ? [lineBreak()] : children,
499
- };
500
- };
501
- // tiptap-markdown drops the newline markdown-it writes after an element, outside a code block: a line that follows
502
- // bold, a link or code joins it without a space
503
- const dropNewlineAfterElements = (nodes) => nodes.map((node, index) => index && node.type === "text" && nodes[index - 1].type === "element" && node.value?.startsWith("\n")
504
- ? { ...node, value: node.value.slice(1) }
505
- : node);
506
- function toEditorSchema(nodes) {
507
- return dropNewlineAfterElements(nodes).flatMap((node) => {
508
- if (node.type !== "element")
509
- return [node];
510
- const children = node.children ?? [];
511
- switch (node.tagName) {
512
- case "img":
513
- case "hr":
514
- return [];
515
- case "code":
516
- return [{ type: "text", value: textOf(node) }];
517
- case "pre": {
518
- // ProseMirror keeps a code block's spaces and its newlines as line breaks, the last one followed by the
519
- // trailing break of a paragraph that ends in a break
520
- const lines = textOf(node).split("\n");
521
- if (lines.every((line) => !line))
522
- return [];
523
- const content = [];
524
- lines.forEach((line, index) => {
525
- if (index)
526
- content.push(lineBreak());
527
- if (line)
528
- content.push({ type: "text", value: line });
529
- });
530
- if (content[content.length - 1].tagName === "br")
531
- content.push(lineBreak());
532
- return [paragraph(content, { preserveWhiteSpace: true })];
533
- }
534
- case "blockquote":
535
- return toEditorSchema(children);
536
- case "p":
537
- return [paragraph(toEditorSchema(children))];
538
- case "li": {
539
- const content = [];
540
- let run = [];
541
- const flush = () => {
542
- if (!run.every(isBlank))
543
- content.push(paragraph(run));
544
- run = [];
545
- };
546
- for (const child of toEditorSchema(children)) {
547
- if (child.type === "element" && SCHEMA_BLOCKS.has(child.tagName)) {
548
- flush();
549
- content.push(child);
550
- }
551
- else {
552
- run.push(child);
553
- }
554
- }
555
- flush();
556
- // A list item starts with a paragraph, an empty one if it has no text (an empty item, an image)
557
- if (content[0]?.tagName !== "p")
558
- content.unshift(paragraph([]));
559
- return [{ ...node, children: content }];
560
- }
561
- case "ul":
562
- case "ol":
563
- return [{ ...node, children: toEditorSchema(children).filter((child) => !isBlank(child)) }];
564
- default:
565
- return SCHEMA_AS_PARAGRAPH.has(node.tagName)
566
- ? [paragraph(toEditorSchema(children))]
567
- : [{ ...node, children: toEditorSchema(children) }];
568
- }
569
- });
570
- }
571
- function rehypeEditorSchema() {
572
- return (tree) => {
573
- tree.children = toEditorSchema(tree.children ?? []).filter((child) => !isBlank(child));
574
- };
575
- }
576
440
  /**
577
441
  * The content before the editor exists, on the server and until it mounts: the markdown as the editor will show it,
578
442
  * in its schema and its own boxes (EditorContent's, then ProseMirror's), so the page does not move when ProseMirror
579
443
  * takes over, as in React. An empty editor shows its placeholder while it can be edited (`showOnlyWhenEditable`).
580
444
  */
581
- const editorFirstFrame = (markdown, placeholder, disabled) => {
582
- const hint = placeholder && !disabled;
445
+ const editorFirstFrame = (markdown, placeholder, disabled, schema) => {
446
+ const hint = placeholder && !disabled ? placeholder : undefined;
583
447
  return h("div", null, [
584
448
  h("div", { class: ["tiptap", s.EditorContent] }, [
585
449
  markdown.trim()
586
- ? renderMarkdown({ children: markdown, remarkPlugins: [remarkWithoutHtml], rehypePlugins: [rehypeEditorSchema] })
450
+ ? renderMarkdown({
451
+ children: markdown,
452
+ remarkPlugins: schema.breaks ? [remarkWithoutHtml, remarkLineBreaks] : [remarkWithoutHtml],
453
+ rehypePlugins: [rehypeEditorSchema(schema, hint)],
454
+ })
587
455
  : h("p", { class: hint ? "is-editor-empty" : undefined, "data-placeholder": hint ? placeholder : undefined }, [h("br")]),
588
456
  ]),
589
457
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownEditor.js","sourceRoot":"","sources":["../../../../src/components/MarkdownEditor/MarkdownEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EAC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EAAE,CAAC;gBACjH,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3H,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAA","sourcesContent":["import {\n defineComponent,\n h,\n reactive,\n ref,\n watch,\n type Component,\n type PropType,\n} from \"vue\"\nimport { EditorContent, useEditor } from \"@tiptap/vue-3\"\nimport { getMarkRange, type Editor as CoreEditor } from \"@tiptap/core\"\nimport Document from \"@tiptap/extension-document\"\nimport Paragraph from \"@tiptap/extension-paragraph\"\nimport Text from \"@tiptap/extension-text\"\nimport BoldExtension from \"@tiptap/extension-bold\"\nimport ItalicExtension from \"@tiptap/extension-italic\"\nimport LinkExtension from \"@tiptap/extension-link\"\nimport BulletList from \"@tiptap/extension-bullet-list\"\nimport OrderedList from \"@tiptap/extension-ordered-list\"\nimport ListItem from \"@tiptap/extension-list-item\"\nimport History from \"@tiptap/extension-history\"\nimport Placeholder from \"@tiptap/extension-placeholder\"\nimport HardBreak from \"@tiptap/extension-hard-break\"\nimport { Markdown as MarkdownExtension } from \"tiptap-markdown\"\nimport type { Variants } from \"@plexui/styles/types\"\nimport { keepMovedFocus } from \"../../lib/helpers.js\"\nimport {\n Bold as BoldIcon,\n Italic as ItalicIcon,\n Link as LinkIcon,\n List as ListIcon,\n ListNumbers as ListNumbersIcon,\n} from \"../Icon/index.js\"\nimport { Tooltip } from \"../Tooltip/index.js\"\nimport { Button } from \"../Button/index.js\"\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogBody, DialogFooter } from \"../Dialog/index.js\"\nimport { Field } from \"../Field/index.js\"\nimport { Input } from \"../Input/index.js\"\nimport { flattenSlot } from \"../Tooltip/slot.js\"\nimport { renderMarkdown } from \"../Markdown/pipeline.js\"\nimport s from \"@plexui/styles/components/MarkdownEditor/MarkdownEditor.module.css\"\n\n// Vue port of packages/ui/src/components/MarkdownEditor/MarkdownEditor.tsx on\n// @tiptap/vue-3 with the same extensions, configured the same way, so\n// ProseMirror renders the same DOM and tiptap-markdown emits the same markdown.\n//\n// - The editor is created on mount (@tiptap/vue-3's `useEditor`, like React's\n// `immediatelyRender: false`) and destroyed on unmount.\n// - Value: `value` + `update:value` (`v-model:value`) and `change` mirror\n// React's `value` + `onChange`; `default-value` is the uncontrolled start.\n// As in React, a controlled value is only pushed into the editor when it\n// changes and differs from the editor's markdown.\n// - As in React, `update:value` / `change` also fire once when the editor is\n// created and whenever `disabled` changes (`setEditable` emits an update).\n// - Options React reads only when it creates the editor (`placeholder`, the\n// initial content) are read once here too; `id`, `aria-label`,\n// `aria-labelledby`, `aria-describedby` and `aria-invalid` follow the\n// props, as React re-applies them on render.\n// - `toolbarEnd` is the `#toolbarEnd` slot. Like React, only `class` is\n// applied (to the container); other attributes are not forwarded.\n// - The shared Dialog owns focus trapping and closing. Its portal is not part\n// of the editor's click area, so editing a link preserves its selection.\n\ntype EditorLike = Pick<CoreEditor, \"isActive\" | \"state\">\n\nconst getMarkdown = (editor: CoreEditor) =>\n (editor.storage as unknown as Record<string, { getMarkdown?: () => string }>).markdown?.getMarkdown?.() ?? \"\"\n\n// A link inserted as a text node, not as `<a>` HTML: the markdown parser runs\n// with `html: false`, so HTML would land in the text as written\nconst linkText = (text: string, href: string) => ({\n type: \"text\",\n text,\n marks: [{ type: \"link\", attrs: { href } }],\n})\n\nexport const markdownEditorStyles = {\n toolbarButton: s.ToolbarButton,\n}\n\ntype LinkSelection = { from: number; to: number; doc: CoreEditor[\"state\"][\"doc\"] }\n\nconst LinkDialog = defineComponent({\n name: \"MarkdownEditorLinkDialog\",\n props: {\n open: { type: Boolean, required: true },\n initialUrl: { type: String, required: true },\n initialTitle: { type: String, required: true },\n isEditing: { type: Boolean, required: true },\n disabled: { type: Boolean, required: true },\n onSave: { type: Function as PropType<(url: string, title: string) => void>, required: true },\n onRemove: { type: Function as PropType<() => void>, required: true },\n onCancel: { type: Function as PropType<() => void>, required: true },\n onRestoreFocus: { type: Function as PropType<(event: Event) => void>, required: true },\n },\n setup(props) {\n const url = ref(props.initialUrl)\n const title = ref(props.initialTitle)\n watch(() => [props.open, props.initialUrl, props.initialTitle] as const, ([open, initialUrl, initialTitle]) => {\n if (open) { url.value = initialUrl; title.value = initialTitle }\n })\n return () => h(Dialog, {\n \"open\": props.open,\n \"onUpdate:open\": (next: boolean) => { if (!next) props.onCancel() },\n }, { default: () => h(DialogContent, {\n width: 450, mobileVariant: \"sheet\", showClose: false,\n onCloseAutoFocus: props.onRestoreFocus,\n }, { default: () => [\n h(DialogHeader, null, { default: () => h(DialogTitle, null, { default: () => \"Link\" }) }),\n h(DialogBody, null, { default: () => h(\"div\", {\n class: s.LinkDialogFields,\n onKeydown: (event: KeyboardEvent) => {\n if (event.key === \"Enter\" && !event.isComposing && event.target instanceof HTMLInputElement) {\n event.preventDefault()\n if (!props.disabled) props.onSave(url.value, title.value)\n }\n },\n }, [\n h(Field, { label: \"URL\" }, { default: () => h(Input, {\n type: \"url\", inputmode: \"url\", autocapitalize: \"none\", autocorrect: \"off\", spellcheck: false,\n placeholder: \"Enter URL\", value: url.value, disabled: props.disabled,\n \"onUpdate:value\": (value: string) => { url.value = value },\n }) }),\n h(Field, { label: \"Link title\" }, { default: () => h(Input, {\n placeholder: \"Enter link title\", value: title.value, disabled: props.disabled,\n \"onUpdate:value\": (value: string) => { title.value = value },\n }) }),\n ]) }),\n h(DialogFooter, null, { default: () => [\n props.isEditing ? h(Button, { color: \"danger\", variant: \"soft\", disabled: props.disabled, onClick: () => { if (!props.disabled) props.onRemove() } }, { default: () => \"Remove\" }) : null,\n h(Button, { color: \"secondary\", variant: \"soft\", onClick: () => props.onCancel() }, { default: () => \"Cancel\" }),\n h(Button, { color: \"primary\", disabled: props.disabled, onClick: () => { if (!props.disabled) props.onSave(url.value, title.value) } }, { default: () => \"Save\" }),\n ] }),\n ] }) })\n },\n})\n\nconst ToolbarButton = defineComponent({\n name: \"MarkdownEditorToolbarButton\",\n props: {\n tooltip: { type: String, required: true },\n active: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n icon: { type: [Object, Function] as PropType<Component>, required: true },\n onClick: { type: Function as PropType<() => void>, required: true },\n },\n setup(props) {\n return () =>\n h(\n Tooltip,\n { content: props.tooltip, compact: true },\n {\n default: () =>\n h(\n Button,\n {\n \"color\": \"secondary\", \"variant\": \"ghost\", \"size\": \"2xs\", \"iconSize\": \"sm\", \"uniform\": true, \"mobileMaterial\": \"flat\",\n \"class\": s.ToolbarButton,\n \"data-active\": props.active || undefined,\n \"selected\": props.active,\n // Formatting buttons are toggles: announce their on/off state\n \"aria-pressed\": props.active,\n // React DOM never calls onClick on a disabled button, even\n // for a dispatched event; Vue's listener would run\n \"onClick\": () => {\n if (!props.disabled) props.onClick()\n },\n \"disabled\": props.disabled,\n \"aria-label\": props.tooltip,\n },\n { default: () => h(props.icon) },\n ),\n },\n )\n },\n})\n\nconst MarkdownEditorComponent = defineComponent({\n name: \"MarkdownEditor\",\n inheritAttrs: false,\n props: {\n /** Visual style of the editor. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\">>, default: \"outline\" },\n /** Disables editing and the toolbar. @default false */\n disabled: { type: Boolean, default: false },\n /** Marks the editor as invalid. @default false */\n invalid: { type: Boolean, default: false },\n /** Placeholder text when empty (read when the editor is created) */\n placeholder: String,\n /** Controlled value as a markdown string (`v-model:value`) */\n value: { type: String, default: undefined },\n /** Default value as a markdown string for uncontrolled mode */\n defaultValue: { type: String, default: undefined },\n /** Minimum visible rows. @default 1 */\n rows: { type: Number, default: 1 },\n /** `id` of the editable element */\n id: String,\n /** Accessible name of the editable element; a `<label for>` cannot name a contenteditable region */\n ariaLabel: String,\n /** Id of the element that names the editor, such as a Field label */\n ariaLabelledby: String,\n /** `aria-describedby` of the editable element */\n ariaDescribedby: String,\n /** Sets `aria-invalid=\"true\"` on the editable element and the invalid style */\n ariaInvalid: { type: Boolean, default: undefined },\n },\n emits: {\n /** The editor's markdown after a change (`v-model:value`) */\n \"update:value\": (markdown: string) => typeof markdown === \"string\",\n /** Same as `update:value` (React's `onChange`) */\n \"change\": (markdown: string) => typeof markdown === \"string\",\n },\n setup(props, { slots, attrs, emit }) {\n const focused = ref(false)\n const linkDialogOpen = ref(false)\n const linkDialogInitial = ref({ url: \"\", title: \"\" })\n const activeMarks = reactive({\n bold: false,\n italic: false,\n link: false,\n orderedList: false,\n bulletList: false,\n })\n const linkCanEnable = ref(false)\n const isControlled = () => props.value !== undefined\n let suppressChange = false\n let linkSelection: LinkSelection | null = null\n let restoreEditorFocus = false\n\n const syncToolbar = (e: EditorLike) => {\n Object.assign(activeMarks, {\n bold: e.isActive(\"bold\"),\n italic: e.isActive(\"italic\"),\n link: e.isActive(\"link\"),\n orderedList: e.isActive(\"orderedList\"),\n bulletList: e.isActive(\"bulletList\"),\n })\n linkCanEnable.value = !e.state.selection.empty || e.isActive(\"link\")\n }\n\n const editorAttributes = () => ({\n \"class\": s.EditorContent,\n \"role\": \"textbox\",\n \"aria-multiline\": \"true\",\n ...(props.id && { id: props.id }),\n ...(props.ariaLabel && { \"aria-label\": props.ariaLabel }),\n ...(props.ariaLabelledby && { \"aria-labelledby\": props.ariaLabelledby }),\n ...(props.ariaDescribedby && { \"aria-describedby\": props.ariaDescribedby }),\n ...(props.ariaInvalid && { \"aria-invalid\": \"true\" }),\n })\n\n const editor = useEditor({\n extensions: [\n Document,\n Paragraph,\n Text,\n HardBreak,\n BoldExtension,\n ItalicExtension,\n LinkExtension.configure({\n openOnClick: false,\n HTMLAttributes: { rel: \"noopener noreferrer nofollow\" },\n }),\n BulletList,\n OrderedList,\n ListItem,\n History,\n MarkdownExtension.configure({\n html: false,\n transformPastedText: true,\n transformCopiedText: true,\n }),\n ...(props.placeholder ? [Placeholder.configure({ placeholder: props.placeholder })] : []),\n ],\n content: props.value ?? props.defaultValue ?? \"\",\n editable: !props.disabled,\n editorProps: {\n attributes: editorAttributes(),\n },\n onFocus: () => {\n focused.value = true\n },\n onBlur: () => {\n focused.value = false\n },\n onUpdate: ({ editor: e }) => {\n if (suppressChange) return\n const md = getMarkdown(e)\n emit(\"update:value\", md)\n emit(\"change\", md)\n },\n onSelectionUpdate: ({ editor: e }) => syncToolbar(e),\n onTransaction: ({ editor: e }) => {\n syncToolbar(e)\n if (linkSelection && linkSelection.doc !== e.state.doc) {\n linkSelection = null\n restoreEditorFocus = false\n linkDialogOpen.value = false\n }\n },\n })\n\n // React re-applies the editor props on every render\n watch(editorAttributes, (attributes) => {\n editor.value?.setOptions({ editorProps: { attributes } })\n })\n\n watch(\n () => [editor.value, props.value, isControlled()] as const,\n ([instance, value, controlled]) => {\n if (!instance || !controlled) return\n const currentMd = getMarkdown(instance)\n if (value !== currentMd) {\n suppressChange = true\n instance.commands.setContent(value || \"\", { emitUpdate: false })\n suppressChange = false\n }\n },\n )\n\n watch(\n () => [editor.value, props.disabled] as const,\n ([instance, disabled]) => {\n if (instance) instance.setEditable(!disabled)\n if (disabled) {\n linkSelection = null\n restoreEditorFocus = false\n linkDialogOpen.value = false\n }\n },\n )\n\n const handleContainerMouseDown = (evt: MouseEvent) => {\n const instance = editor.value\n if (props.disabled || !instance) return\n const target = evt.target\n if (!(target instanceof Element) || !(evt.currentTarget instanceof Element) || !evt.currentTarget.contains(target)) return\n if (target.closest(\"button, [type='button'], [role='button'], a, input, label\")) return\n // A press in the text places the caret there itself\n if (instance.view.dom.contains(target)) return\n if (instance.isFocused) return\n evt.preventDefault()\n instance.commands.focus(\"end\")\n }\n\n const openLinkDialog = () => {\n const instance = editor.value\n if (!instance || props.disabled) return\n const url = instance.getAttributes(\"link\").href ?? \"\"\n const selection = instance.state.selection\n const range = selection.empty && instance.isActive(\"link\")\n ? getMarkRange(selection.$from, instance.schema.marks.link, { href: url })\n : selection\n if (!range) return\n linkSelection = { from: range.from, to: range.to, doc: instance.state.doc }\n restoreEditorFocus = true\n linkDialogInitial.value = { url, title: instance.state.doc.textBetween(range.from, range.to, \"\") }\n linkDialogOpen.value = true\n }\n const handleLinkSave = (url: string, title: string) => {\n const instance = editor.value\n const range = linkSelection\n if (!instance || props.disabled || !range) return\n linkDialogOpen.value = false\n if (range.doc !== instance.state.doc) { restoreEditorFocus = false; return }\n linkSelection = null\n const selectedText = instance.state.doc.textBetween(range.from, range.to, \"\")\n const chain = instance.chain().setTextSelection({ from: range.from, to: range.to })\n if (!url) chain.unsetLink().run()\n else if (title && title !== selectedText) chain.insertContent(linkText(title, url)).run()\n else chain.setLink({ href: url }).run()\n }\n const handleLinkRemove = () => {\n const instance = editor.value\n const range = linkSelection\n if (!instance || props.disabled || !range) return\n linkDialogOpen.value = false\n if (range.doc !== instance.state.doc) { restoreEditorFocus = false; return }\n linkSelection = null\n instance.chain().setTextSelection({ from: range.from, to: range.to }).unsetLink().run()\n }\n const handleLinkCancel = () => { linkDialogOpen.value = false }\n const handleRestoreFocus = (event: Event) => {\n keepMovedFocus(event)\n const shouldRestore = restoreEditorFocus && !event.defaultPrevented\n event.preventDefault()\n restoreEditorFocus = false\n linkSelection = null\n const instance = editor.value\n if (shouldRestore && instance && !instance.isDestroyed && !props.disabled) {\n const closingScope = event.target\n requestAnimationFrame(() => {\n if (instance.isDestroyed || !instance.isEditable) return\n const doc = instance.view.dom.ownerDocument\n const active = doc.activeElement\n if (active && active !== doc.body && !instance.view.dom.contains(active)\n && !(closingScope instanceof Node && closingScope.contains(active))) return\n // Check at the actual restore, then focus synchronously: Tiptap's\n // focus command queues another frame that could steal moved focus.\n instance.view.focus()\n })\n }\n }\n\n return () => {\n const { variant, disabled, invalid, ariaInvalid, rows } = props\n const isInvalid = invalid || ariaInvalid\n const minHeight = 20 * rows + 16\n // React renders the slot only for a truthy `toolbarEnd`\n const toolbarEnd = slots.toolbarEnd?.()\n const hasToolbarEnd = flattenSlot(toolbarEnd).length > 0\n\n return h(\n \"div\",\n {\n \"class\": [s.Container, attrs.class],\n \"data-variant\": variant,\n \"data-focused\": String(focused.value),\n \"data-disabled\": disabled ? \"\" : undefined,\n \"data-invalid\": isInvalid ? \"\" : undefined,\n \"onMousedown\": handleContainerMouseDown,\n },\n [\n h(\"div\", { class: s.Toolbar, onMousedown: (e: MouseEvent) => e.preventDefault() }, [\n h(\"div\", { class: s.ToolbarGroup }, [\n h(ToolbarButton, {\n tooltip: \"Bold\",\n active: activeMarks.bold,\n disabled,\n icon: BoldIcon,\n onClick: () => editor.value?.chain().focus().toggleBold().run(),\n }),\n h(ToolbarButton, {\n tooltip: \"Italic\",\n active: activeMarks.italic,\n disabled,\n icon: ItalicIcon,\n onClick: () => editor.value?.chain().focus().toggleItalic().run(),\n }),\n\n h(\"div\", { \"class\": s.ToolbarSeparator, \"aria-hidden\": \"true\" }),\n\n h(ToolbarButton, {\n tooltip: \"Numbered list\",\n active: activeMarks.orderedList,\n disabled,\n icon: ListNumbersIcon,\n onClick: () => editor.value?.chain().focus().toggleOrderedList().run(),\n }),\n h(ToolbarButton, {\n tooltip: \"Bullet list\",\n active: activeMarks.bulletList,\n disabled,\n icon: ListIcon,\n onClick: () => editor.value?.chain().focus().toggleBulletList().run(),\n }),\n\n h(\"div\", { \"class\": s.ToolbarSeparator, \"aria-hidden\": \"true\" }),\n\n h(ToolbarButton, {\n tooltip: \"Link\",\n active: activeMarks.link,\n disabled: disabled || !linkCanEnable.value,\n icon: LinkIcon,\n onClick: openLinkDialog,\n }),\n\n ...(hasToolbarEnd\n ? [\n h(\"div\", { \"class\": s.ToolbarSeparator, \"aria-hidden\": \"true\" }),\n h(\"div\", { class: s.ToolbarEnd }, toolbarEnd),\n ]\n : []),\n ]),\n ]),\n\n h(\"div\", { class: s.Editor, style: { minHeight: `${minHeight}px` } }, [\n editor.value\n ? h(EditorContent, { editor: editor.value })\n : editorFirstFrame(props.value ?? props.defaultValue ?? \"\", props.placeholder, props.disabled),\n ]),\n\n h(LinkDialog, {\n open: linkDialogOpen.value,\n initialUrl: linkDialogInitial.value.url,\n initialTitle: linkDialogInitial.value.title,\n isEditing: !!linkDialogInitial.value.url,\n disabled,\n onRestoreFocus: handleRestoreFocus,\n onSave: handleLinkSave,\n onRemove: handleLinkRemove,\n onCancel: handleLinkCancel,\n }),\n ],\n )\n }\n },\n})\n\n// Nodes of the HTML (hast) tree the first frame rewrites\ntype HtmlNode = {\n type: string\n tagName?: string\n value?: string\n properties?: Record<string, unknown>\n children?: HtmlNode[]\n}\n\n// The editor reads markdown with `html: false` (markdown-it): HTML is not parsed, its characters are text, and the\n// markdown around and inside it still is\nfunction remarkWithoutHtml(this: { data(): object }) {\n const data = this.data() as { micromarkExtensions?: unknown[] }\n ;(data.micromarkExtensions ??= []).push({ disable: { null: [\"htmlFlow\", \"htmlText\"] } })\n}\n\n// The editor's schema keeps paragraphs, lists, bold, italic, links and line breaks. ProseMirror parses anything else\n// into them: a heading is a paragraph of its text, a code block a paragraph of its lines, a quote its paragraphs,\n// inline code its text, an image or a rule nothing, and the text of a list item sits in a paragraph. Outside a code\n// block it collapses white space, as the page does; the editor's text keeps its spaces (white-space: break-spaces)\nconst SCHEMA_AS_PARAGRAPH = new Set([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"])\nconst SCHEMA_BLOCKS = new Set([\"p\", \"ul\", \"ol\"])\nconst textOf = (node: HtmlNode): string => node.value ?? (node.children ?? []).map(textOf).join(\"\")\nconst isBlank = (node: HtmlNode) => node.type === \"text\" && !node.value?.trim()\nconst lineBreak = (): HtmlNode => ({ type: \"element\", tagName: \"br\", properties: {}, children: [] })\n\n// White space of a paragraph's text as ProseMirror parses it: runs collapse to one space, none at the start of the\n// paragraph, after a line break or after another space, none at its end\nfunction collapseWhiteSpace(children: HtmlNode[]) {\n let previous: HtmlNode | null = null\n let lineStart = true\n const walk = (nodes: HtmlNode[]) => {\n for (const node of nodes) {\n if (node.type === \"text\") {\n let value = (node.value ?? \"\").replace(/[ \\t\\r\\n\\f]+/g, \" \")\n if (value.startsWith(\" \") && (lineStart || previous?.value?.endsWith(\" \"))) value = value.slice(1)\n node.value = value\n if (value) {\n previous = node\n lineStart = false\n }\n } else if (node.tagName === \"br\") {\n lineStart = true\n } else {\n walk(node.children ?? [])\n }\n }\n }\n walk(children)\n if (previous) (previous as HtmlNode).value = (previous as HtmlNode).value!.replace(/ $/, \"\")\n}\n\nconst paragraph = (children: HtmlNode[], { preserveWhiteSpace = false } = {}): HtmlNode => {\n if (!preserveWhiteSpace) collapseWhiteSpace(children)\n return {\n type: \"element\",\n tagName: \"p\",\n properties: {},\n // An empty paragraph keeps its line, as ProseMirror's trailing break does\n children: children.every((child) => child.type === \"text\" && !child.value) ? [lineBreak()] : children,\n }\n}\n\n// tiptap-markdown drops the newline markdown-it writes after an element, outside a code block: a line that follows\n// bold, a link or code joins it without a space\nconst dropNewlineAfterElements = (nodes: HtmlNode[]) =>\n nodes.map((node, index) =>\n index && node.type === \"text\" && nodes[index - 1]!.type === \"element\" && node.value?.startsWith(\"\\n\")\n ? { ...node, value: node.value.slice(1) }\n : node,\n )\n\nfunction toEditorSchema(nodes: HtmlNode[]): HtmlNode[] {\n return dropNewlineAfterElements(nodes).flatMap((node): HtmlNode[] => {\n if (node.type !== \"element\") return [node]\n const children = node.children ?? []\n switch (node.tagName) {\n case \"img\":\n case \"hr\":\n return []\n case \"code\":\n return [{ type: \"text\", value: textOf(node) }]\n case \"pre\": {\n // ProseMirror keeps a code block's spaces and its newlines as line breaks, the last one followed by the\n // trailing break of a paragraph that ends in a break\n const lines = textOf(node).split(\"\\n\")\n if (lines.every((line) => !line)) return []\n const content: HtmlNode[] = []\n lines.forEach((line, index) => {\n if (index) content.push(lineBreak())\n if (line) content.push({ type: \"text\", value: line })\n })\n if (content[content.length - 1]!.tagName === \"br\") content.push(lineBreak())\n return [paragraph(content, { preserveWhiteSpace: true })]\n }\n case \"blockquote\":\n return toEditorSchema(children)\n case \"p\":\n return [paragraph(toEditorSchema(children))]\n case \"li\": {\n const content: HtmlNode[] = []\n let run: HtmlNode[] = []\n const flush = () => {\n if (!run.every(isBlank)) content.push(paragraph(run))\n run = []\n }\n for (const child of toEditorSchema(children)) {\n if (child.type === \"element\" && SCHEMA_BLOCKS.has(child.tagName!)) {\n flush()\n content.push(child)\n } else {\n run.push(child)\n }\n }\n flush()\n // A list item starts with a paragraph, an empty one if it has no text (an empty item, an image)\n if (content[0]?.tagName !== \"p\") content.unshift(paragraph([]))\n return [{ ...node, children: content }]\n }\n case \"ul\":\n case \"ol\":\n return [{ ...node, children: toEditorSchema(children).filter((child) => !isBlank(child)) }]\n default:\n return SCHEMA_AS_PARAGRAPH.has(node.tagName!)\n ? [paragraph(toEditorSchema(children))]\n : [{ ...node, children: toEditorSchema(children) }]\n }\n })\n}\nfunction rehypeEditorSchema() {\n return (tree: HtmlNode) => {\n tree.children = toEditorSchema(tree.children ?? []).filter((child) => !isBlank(child))\n }\n}\n\n/**\n * The content before the editor exists, on the server and until it mounts: the markdown as the editor will show it,\n * in its schema and its own boxes (EditorContent's, then ProseMirror's), so the page does not move when ProseMirror\n * takes over, as in React. An empty editor shows its placeholder while it can be edited (`showOnlyWhenEditable`).\n */\nconst editorFirstFrame = (markdown: string, placeholder: string | undefined, disabled: boolean) => {\n const hint = placeholder && !disabled\n return h(\"div\", null, [\n h(\"div\", { class: [\"tiptap\", s.EditorContent] }, [\n markdown.trim()\n ? renderMarkdown({ children: markdown, remarkPlugins: [remarkWithoutHtml], rehypePlugins: [rehypeEditorSchema] })\n : h(\"p\", { class: hint ? \"is-editor-empty\" : undefined, \"data-placeholder\": hint ? placeholder : undefined }, [h(\"br\")]),\n ]),\n ])\n}\n\n/**\n * Compact rich text editor for markdown, with a formatting toolbar (bold,\n * italic, lists, links). Bind the markdown with `v-model:value`.\n */\nexport const MarkdownEditor = MarkdownEditorComponent\n\nexport type MarkdownEditorProps = InstanceType<typeof MarkdownEditorComponent>[\"$props\"]\n"]}
1
+ {"version":3,"file":"MarkdownEditor.js","sourceRoot":"","sources":["../../../../src/components/MarkdownEditor/MarkdownEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EACD,QAAQ,EACR,GAAG,EACH,KAAK,GAGN,MAAM,KAAK,CAAA;AACZ,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,YAAY,EAA6B,MAAM,cAAc,CAAA;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAGlB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,IAAI,IAAI,QAAQ,EAChB,MAAM,IAAI,UAAU,EACpB,IAAI,IAAI,QAAQ,EAChB,IAAI,IAAI,QAAQ,EAChB,WAAW,IAAI,eAAe,GAC/B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC/G,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,CAAC,MAAM,oEAAoE,CAAA;AAyBlF,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAE,EAAE,CACxC,MA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D,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE;QACpB,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,EAAE;YAC/C,QAAQ,CAAC,IAAI,EAAE;gBACb,CAAC,CAAC,cAAc,CAAC;oBACb,QAAQ,EAAE,QAAQ;oBAClB,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;oBAC1F,aAAa,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;iBAClD,CAAC;gBACJ,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3H,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAA","sourcesContent":["import {\n defineComponent,\n h,\n reactive,\n ref,\n watch,\n type Component,\n type PropType,\n} from \"vue\"\nimport { EditorContent, useEditor } from \"@tiptap/vue-3\"\nimport { getMarkRange, type Editor as CoreEditor } from \"@tiptap/core\"\nimport type { Variants } from \"@plexui/styles/types\"\nimport { keepMovedFocus } from \"../../lib/helpers.js\"\nimport {\n markdownEditorExtensions,\n markdownEditorSchema,\n rehypeEditorSchema,\n remarkLineBreaks,\n remarkWithoutHtml,\n type MarkdownEditorFormat,\n type MarkdownEditorSchema,\n} from \"../../lib/markdownEditorSchema.js\"\nimport {\n Bold as BoldIcon,\n Italic as ItalicIcon,\n Link as LinkIcon,\n List as ListIcon,\n ListNumbers as ListNumbersIcon,\n} from \"../Icon/index.js\"\nimport { Tooltip } from \"../Tooltip/index.js\"\nimport { Button } from \"../Button/index.js\"\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogBody, DialogFooter } from \"../Dialog/index.js\"\nimport { Field } from \"../Field/index.js\"\nimport { Input } from \"../Input/index.js\"\nimport { flattenSlot } from \"../Tooltip/slot.js\"\nimport { renderMarkdown } from \"../Markdown/pipeline.js\"\nimport s from \"@plexui/styles/components/MarkdownEditor/MarkdownEditor.module.css\"\n\n// Vue port of packages/ui/src/components/MarkdownEditor/MarkdownEditor.tsx on\n// @tiptap/vue-3 with the same extensions, configured the same way, so\n// ProseMirror renders the same DOM and tiptap-markdown emits the same markdown.\n//\n// - The editor is created on mount (@tiptap/vue-3's `useEditor`, like React's\n// `immediatelyRender: false`) and destroyed on unmount.\n// - Value: `value` + `update:value` (`v-model:value`) and `change` mirror\n// React's `value` + `onChange`; `default-value` is the uncontrolled start.\n// As in React, a controlled value is only pushed into the editor when it\n// changes and differs from the editor's markdown.\n// - As in React, `update:value` / `change` also fire once when the editor is\n// created and whenever `disabled` changes (`setEditable` emits an update).\n// - Options React reads only when it creates the editor (`placeholder`,\n// `formats`, `breaks`, the initial content) are read once here too; `id`, `aria-label`,\n// `aria-labelledby`, `aria-describedby` and `aria-invalid` follow the\n// props, as React re-applies them on render.\n// - `toolbarEnd` is the `#toolbarEnd` slot. Like React, only `class` is\n// applied (to the container); other attributes are not forwarded.\n// - The shared Dialog owns focus trapping and closing. Its portal is not part\n// of the editor's click area, so editing a link preserves its selection.\n\ntype EditorLike = Pick<CoreEditor, \"isActive\" | \"state\">\n\nconst getMarkdown = (editor: CoreEditor) =>\n (editor.storage as unknown as Record<string, { getMarkdown?: () => string }>).markdown?.getMarkdown?.() ?? \"\"\n\n// A link inserted as a text node, not as `<a>` HTML: the markdown parser runs\n// with `html: false`, so HTML would land in the text as written\nconst linkText = (text: string, href: string) => ({\n type: \"text\",\n text,\n marks: [{ type: \"link\", attrs: { href } }],\n})\n\nexport const markdownEditorStyles = {\n toolbarButton: s.ToolbarButton,\n}\n\nexport type { MarkdownEditorFormat }\n\ntype LinkSelection = { from: number; to: number; doc: CoreEditor[\"state\"][\"doc\"] }\n\nconst LinkDialog = defineComponent({\n name: \"MarkdownEditorLinkDialog\",\n props: {\n open: { type: Boolean, required: true },\n initialUrl: { type: String, required: true },\n initialTitle: { type: String, required: true },\n isEditing: { type: Boolean, required: true },\n disabled: { type: Boolean, required: true },\n onSave: { type: Function as PropType<(url: string, title: string) => void>, required: true },\n onRemove: { type: Function as PropType<() => void>, required: true },\n onCancel: { type: Function as PropType<() => void>, required: true },\n onRestoreFocus: { type: Function as PropType<(event: Event) => void>, required: true },\n },\n setup(props) {\n const url = ref(props.initialUrl)\n const title = ref(props.initialTitle)\n watch(() => [props.open, props.initialUrl, props.initialTitle] as const, ([open, initialUrl, initialTitle]) => {\n if (open) { url.value = initialUrl; title.value = initialTitle }\n })\n return () => h(Dialog, {\n \"open\": props.open,\n \"onUpdate:open\": (next: boolean) => { if (!next) props.onCancel() },\n }, { default: () => h(DialogContent, {\n width: 450, mobileVariant: \"sheet\", showClose: false,\n onCloseAutoFocus: props.onRestoreFocus,\n }, { default: () => [\n h(DialogHeader, null, { default: () => h(DialogTitle, null, { default: () => \"Link\" }) }),\n h(DialogBody, null, { default: () => h(\"div\", {\n class: s.LinkDialogFields,\n onKeydown: (event: KeyboardEvent) => {\n if (event.key === \"Enter\" && !event.isComposing && event.target instanceof HTMLInputElement) {\n event.preventDefault()\n if (!props.disabled) props.onSave(url.value, title.value)\n }\n },\n }, [\n h(Field, { label: \"URL\" }, { default: () => h(Input, {\n type: \"url\", inputmode: \"url\", autocapitalize: \"none\", autocorrect: \"off\", spellcheck: false,\n placeholder: \"Enter URL\", value: url.value, disabled: props.disabled,\n \"onUpdate:value\": (value: string) => { url.value = value },\n }) }),\n h(Field, { label: \"Link title\" }, { default: () => h(Input, {\n placeholder: \"Enter link title\", value: title.value, disabled: props.disabled,\n \"onUpdate:value\": (value: string) => { title.value = value },\n }) }),\n ]) }),\n h(DialogFooter, null, { default: () => [\n props.isEditing ? h(Button, { color: \"danger\", variant: \"soft\", disabled: props.disabled, onClick: () => { if (!props.disabled) props.onRemove() } }, { default: () => \"Remove\" }) : null,\n h(Button, { color: \"secondary\", variant: \"soft\", onClick: () => props.onCancel() }, { default: () => \"Cancel\" }),\n h(Button, { color: \"primary\", disabled: props.disabled, onClick: () => { if (!props.disabled) props.onSave(url.value, title.value) } }, { default: () => \"Save\" }),\n ] }),\n ] }) })\n },\n})\n\nconst ToolbarButton = defineComponent({\n name: \"MarkdownEditorToolbarButton\",\n props: {\n tooltip: { type: String, required: true },\n active: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n icon: { type: [Object, Function] as PropType<Component>, required: true },\n onClick: { type: Function as PropType<() => void>, required: true },\n },\n setup(props) {\n return () =>\n h(\n Tooltip,\n { content: props.tooltip, compact: true },\n {\n default: () =>\n h(\n Button,\n {\n \"color\": \"secondary\", \"variant\": \"ghost\", \"size\": \"2xs\", \"iconSize\": \"sm\", \"uniform\": true, \"mobileMaterial\": \"flat\",\n \"class\": s.ToolbarButton,\n \"data-active\": props.active || undefined,\n \"selected\": props.active,\n // Formatting buttons are toggles: announce their on/off state\n \"aria-pressed\": props.active,\n // React DOM never calls onClick on a disabled button, even\n // for a dispatched event; Vue's listener would run\n \"onClick\": () => {\n if (!props.disabled) props.onClick()\n },\n \"disabled\": props.disabled,\n \"aria-label\": props.tooltip,\n },\n { default: () => h(props.icon) },\n ),\n },\n )\n },\n})\n\nconst MarkdownEditorComponent = defineComponent({\n name: \"MarkdownEditor\",\n inheritAttrs: false,\n props: {\n /** Visual style of the editor. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\">>, default: \"outline\" },\n /** Disables editing and the toolbar. @default false */\n disabled: { type: Boolean, default: false },\n /** Marks the editor as invalid. @default false */\n invalid: { type: Boolean, default: false },\n /** Placeholder text when empty (read when the editor is created) */\n placeholder: String,\n /** Controlled value as a markdown string (`v-model:value`) */\n value: { type: String, default: undefined },\n /** Default value as a markdown string for uncontrolled mode */\n defaultValue: { type: String, default: undefined },\n /**\n * The formats the editor offers, read when the editor is created. A format left out has no toolbar button,\n * shortcut or input rule; pasted and incoming content keeps its text without it, and the markdown does not write it.\n * @default [\"bold\", \"italic\", \"orderedList\", \"bulletList\", \"link\"]\n */\n formats: { type: Array as PropType<MarkdownEditorFormat[]>, default: undefined },\n /**\n * A single newline is a line break, read and written as one \"\\n\", read when the editor is created. Without it a\n * line break is written as a backslash and a newline, and a single newline joins the lines. @default false\n */\n breaks: { type: Boolean, default: false },\n /** Minimum visible rows. @default 1 */\n rows: { type: Number, default: 1 },\n /** `id` of the editable element */\n id: String,\n /** Accessible name of the editable element; a `<label for>` cannot name a contenteditable region */\n ariaLabel: String,\n /** Id of the element that names the editor, such as a Field label */\n ariaLabelledby: String,\n /** `aria-describedby` of the editable element */\n ariaDescribedby: String,\n /** Sets `aria-invalid=\"true\"` on the editable element and the invalid style */\n ariaInvalid: { type: Boolean, default: undefined },\n },\n emits: {\n /** The editor's markdown after a change (`v-model:value`) */\n \"update:value\": (markdown: string) => typeof markdown === \"string\",\n /** Same as `update:value` (React's `onChange`) */\n \"change\": (markdown: string) => typeof markdown === \"string\",\n },\n setup(props, { slots, attrs, emit }) {\n // The schema is the editor's, made once with it, as the toolbar offers what the schema has\n const schema = markdownEditorSchema(props.formats, props.breaks)\n const focused = ref(false)\n const linkDialogOpen = ref(false)\n const linkDialogInitial = ref({ url: \"\", title: \"\" })\n const activeMarks = reactive({\n bold: false,\n italic: false,\n link: false,\n orderedList: false,\n bulletList: false,\n })\n const linkCanEnable = ref(false)\n const isControlled = () => props.value !== undefined\n let suppressChange = false\n let linkSelection: LinkSelection | null = null\n let restoreEditorFocus = false\n\n const syncToolbar = (e: EditorLike) => {\n Object.assign(activeMarks, {\n bold: e.isActive(\"bold\"),\n italic: e.isActive(\"italic\"),\n link: e.isActive(\"link\"),\n orderedList: e.isActive(\"orderedList\"),\n bulletList: e.isActive(\"bulletList\"),\n })\n linkCanEnable.value = !e.state.selection.empty || e.isActive(\"link\")\n }\n\n const editorAttributes = () => ({\n \"class\": s.EditorContent,\n \"role\": \"textbox\",\n \"aria-multiline\": \"true\",\n ...(props.id && { id: props.id }),\n ...(props.ariaLabel && { \"aria-label\": props.ariaLabel }),\n ...(props.ariaLabelledby && { \"aria-labelledby\": props.ariaLabelledby }),\n ...(props.ariaDescribedby && { \"aria-describedby\": props.ariaDescribedby }),\n ...(props.ariaInvalid && { \"aria-invalid\": \"true\" }),\n })\n\n const editor = useEditor({\n extensions: markdownEditorExtensions(schema, props.placeholder),\n content: props.value ?? props.defaultValue ?? \"\",\n editable: !props.disabled,\n editorProps: {\n attributes: editorAttributes(),\n },\n onFocus: () => {\n focused.value = true\n },\n onBlur: () => {\n focused.value = false\n },\n onUpdate: ({ editor: e }) => {\n if (suppressChange) return\n const md = getMarkdown(e)\n emit(\"update:value\", md)\n emit(\"change\", md)\n },\n onSelectionUpdate: ({ editor: e }) => syncToolbar(e),\n onTransaction: ({ editor: e }) => {\n syncToolbar(e)\n if (linkSelection && linkSelection.doc !== e.state.doc) {\n linkSelection = null\n restoreEditorFocus = false\n linkDialogOpen.value = false\n }\n },\n })\n\n // React re-applies the editor props on every render\n watch(editorAttributes, (attributes) => {\n editor.value?.setOptions({ editorProps: { attributes } })\n })\n\n watch(\n () => [editor.value, props.value, isControlled()] as const,\n ([instance, value, controlled]) => {\n if (!instance || !controlled) return\n const currentMd = getMarkdown(instance)\n if (value !== currentMd) {\n suppressChange = true\n instance.commands.setContent(value || \"\", { emitUpdate: false })\n suppressChange = false\n }\n },\n )\n\n watch(\n () => [editor.value, props.disabled] as const,\n ([instance, disabled]) => {\n if (instance) instance.setEditable(!disabled)\n if (disabled) {\n linkSelection = null\n restoreEditorFocus = false\n linkDialogOpen.value = false\n }\n },\n )\n\n const handleContainerMouseDown = (evt: MouseEvent) => {\n const instance = editor.value\n if (props.disabled || !instance) return\n const target = evt.target\n if (!(target instanceof Element) || !(evt.currentTarget instanceof Element) || !evt.currentTarget.contains(target)) return\n if (target.closest(\"button, [type='button'], [role='button'], a, input, label\")) return\n // A press in the text places the caret there itself\n if (instance.view.dom.contains(target)) return\n if (instance.isFocused) return\n evt.preventDefault()\n instance.commands.focus(\"end\")\n }\n\n const openLinkDialog = () => {\n const instance = editor.value\n if (!instance || props.disabled) return\n const url = instance.getAttributes(\"link\").href ?? \"\"\n const selection = instance.state.selection\n const range = selection.empty && instance.isActive(\"link\")\n ? getMarkRange(selection.$from, instance.schema.marks.link, { href: url })\n : selection\n if (!range) return\n linkSelection = { from: range.from, to: range.to, doc: instance.state.doc }\n restoreEditorFocus = true\n linkDialogInitial.value = { url, title: instance.state.doc.textBetween(range.from, range.to, \"\") }\n linkDialogOpen.value = true\n }\n const handleLinkSave = (url: string, title: string) => {\n const instance = editor.value\n const range = linkSelection\n if (!instance || props.disabled || !range) return\n linkDialogOpen.value = false\n if (range.doc !== instance.state.doc) { restoreEditorFocus = false; return }\n linkSelection = null\n const selectedText = instance.state.doc.textBetween(range.from, range.to, \"\")\n const chain = instance.chain().setTextSelection({ from: range.from, to: range.to })\n if (!url) chain.unsetLink().run()\n else if (title && title !== selectedText) chain.insertContent(linkText(title, url)).run()\n else chain.setLink({ href: url }).run()\n }\n const handleLinkRemove = () => {\n const instance = editor.value\n const range = linkSelection\n if (!instance || props.disabled || !range) return\n linkDialogOpen.value = false\n if (range.doc !== instance.state.doc) { restoreEditorFocus = false; return }\n linkSelection = null\n instance.chain().setTextSelection({ from: range.from, to: range.to }).unsetLink().run()\n }\n const handleLinkCancel = () => { linkDialogOpen.value = false }\n const handleRestoreFocus = (event: Event) => {\n keepMovedFocus(event)\n const shouldRestore = restoreEditorFocus && !event.defaultPrevented\n event.preventDefault()\n restoreEditorFocus = false\n linkSelection = null\n const instance = editor.value\n if (shouldRestore && instance && !instance.isDestroyed && !props.disabled) {\n const closingScope = event.target\n requestAnimationFrame(() => {\n if (instance.isDestroyed || !instance.isEditable) return\n const doc = instance.view.dom.ownerDocument\n const active = doc.activeElement\n if (active && active !== doc.body && !instance.view.dom.contains(active)\n && !(closingScope instanceof Node && closingScope.contains(active))) return\n // Check at the actual restore, then focus synchronously: Tiptap's\n // focus command queues another frame that could steal moved focus.\n instance.view.focus()\n })\n }\n }\n\n return () => {\n const { variant, disabled, invalid, ariaInvalid, rows } = props\n const isInvalid = invalid || ariaInvalid\n const minHeight = 20 * rows + 16\n // React renders the slot only for a truthy `toolbarEnd`\n const toolbarEnd = slots.toolbarEnd?.()\n const hasToolbarEnd = flattenSlot(toolbarEnd).length > 0\n const offered = schema.formats\n // Groups of the offered formats, a separator between two of them\n const groups = [\n [\n offered.has(\"bold\") && h(ToolbarButton, {\n tooltip: \"Bold\",\n active: activeMarks.bold,\n disabled,\n icon: BoldIcon,\n onClick: () => editor.value?.chain().focus().toggleBold().run(),\n }),\n offered.has(\"italic\") && h(ToolbarButton, {\n tooltip: \"Italic\",\n active: activeMarks.italic,\n disabled,\n icon: ItalicIcon,\n onClick: () => editor.value?.chain().focus().toggleItalic().run(),\n }),\n ],\n [\n offered.has(\"orderedList\") && h(ToolbarButton, {\n tooltip: \"Numbered list\",\n active: activeMarks.orderedList,\n disabled,\n icon: ListNumbersIcon,\n onClick: () => editor.value?.chain().focus().toggleOrderedList().run(),\n }),\n offered.has(\"bulletList\") && h(ToolbarButton, {\n tooltip: \"Bullet list\",\n active: activeMarks.bulletList,\n disabled,\n icon: ListIcon,\n onClick: () => editor.value?.chain().focus().toggleBulletList().run(),\n }),\n ],\n [\n offered.has(\"link\") && h(ToolbarButton, {\n tooltip: \"Link\",\n active: activeMarks.link,\n disabled: disabled || !linkCanEnable.value,\n icon: LinkIcon,\n onClick: openLinkDialog,\n }),\n ],\n ].map((group) => group.filter((button) => button !== false)).filter((group) => group.length > 0)\n\n return h(\n \"div\",\n {\n \"class\": [s.Container, attrs.class],\n \"data-variant\": variant,\n \"data-focused\": String(focused.value),\n \"data-disabled\": disabled ? \"\" : undefined,\n \"data-invalid\": isInvalid ? \"\" : undefined,\n \"onMousedown\": handleContainerMouseDown,\n },\n [\n groups.length || hasToolbarEnd\n ? h(\"div\", { class: s.Toolbar, onMousedown: (e: MouseEvent) => e.preventDefault() }, [\n h(\"div\", { class: s.ToolbarGroup }, [\n ...groups.flatMap((group, index) => [\n ...(index ? [h(\"div\", { \"class\": s.ToolbarSeparator, \"aria-hidden\": \"true\" })] : []),\n ...group,\n ]),\n ...(hasToolbarEnd\n ? [\n ...(groups.length ? [h(\"div\", { \"class\": s.ToolbarSeparator, \"aria-hidden\": \"true\" })] : []),\n h(\"div\", { class: s.ToolbarEnd }, toolbarEnd),\n ]\n : []),\n ]),\n ])\n : null,\n\n h(\"div\", { class: s.Editor, style: { minHeight: `${minHeight}px` } }, [\n editor.value\n ? h(EditorContent, { editor: editor.value })\n : editorFirstFrame(props.value ?? props.defaultValue ?? \"\", props.placeholder, props.disabled, schema),\n ]),\n\n h(LinkDialog, {\n open: linkDialogOpen.value,\n initialUrl: linkDialogInitial.value.url,\n initialTitle: linkDialogInitial.value.title,\n isEditing: !!linkDialogInitial.value.url,\n disabled,\n onRestoreFocus: handleRestoreFocus,\n onSave: handleLinkSave,\n onRemove: handleLinkRemove,\n onCancel: handleLinkCancel,\n }),\n ],\n )\n }\n },\n})\n\n/**\n * The content before the editor exists, on the server and until it mounts: the markdown as the editor will show it,\n * in its schema and its own boxes (EditorContent's, then ProseMirror's), so the page does not move when ProseMirror\n * takes over, as in React. An empty editor shows its placeholder while it can be edited (`showOnlyWhenEditable`).\n */\nconst editorFirstFrame = (markdown: string, placeholder: string | undefined, disabled: boolean, schema: MarkdownEditorSchema) => {\n const hint = placeholder && !disabled ? placeholder : undefined\n return h(\"div\", null, [\n h(\"div\", { class: [\"tiptap\", s.EditorContent] }, [\n markdown.trim()\n ? renderMarkdown({\n children: markdown,\n remarkPlugins: schema.breaks ? [remarkWithoutHtml, remarkLineBreaks] : [remarkWithoutHtml],\n rehypePlugins: [rehypeEditorSchema(schema, hint)],\n })\n : h(\"p\", { class: hint ? \"is-editor-empty\" : undefined, \"data-placeholder\": hint ? placeholder : undefined }, [h(\"br\")]),\n ]),\n ])\n}\n\n/**\n * Compact rich text editor for markdown, with a formatting toolbar (bold,\n * italic, lists, links). Bind the markdown with `v-model:value`.\n */\nexport const MarkdownEditor = MarkdownEditorComponent\n\nexport type MarkdownEditorProps = InstanceType<typeof MarkdownEditorComponent>[\"$props\"]\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/MarkdownEditor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAA4B,MAAM,qBAAqB,CAAA","sourcesContent":["export { MarkdownEditor, markdownEditorStyles, type MarkdownEditorProps } from \"./MarkdownEditor.js\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/MarkdownEditor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAuD,MAAM,qBAAqB,CAAA","sourcesContent":["export { MarkdownEditor, markdownEditorStyles, type MarkdownEditorFormat, type MarkdownEditorProps } from \"./MarkdownEditor.js\"\n"]}