@conduction/nextcloud-vue 2.162.0 → 2.163.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.
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue.js +9 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue.js.map +1 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue2.js +304 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue2.js.map +1 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue3.js +161 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue3.js.map +1 -0
- package/dist/esm/components/CnFilesBrowser/openRegisterSource.js +2 -1
- package/dist/esm/components/CnFilesBrowser/openRegisterSource.js.map +1 -1
- package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue.js +1 -1
- package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue2.js +4 -0
- package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js +2 -2
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnIconPicker/CnIconPicker.vue.js +1 -1
- package/dist/esm/components/CnIconPicker/CnIconPicker.vue2.js +4 -3
- package/dist/esm/components/CnIconPicker/CnIconPicker.vue2.js.map +1 -1
- package/dist/esm/components/CnIconPicker/CnIconPicker.vue3.js.map +1 -1
- package/dist/esm/components/CnIconPicker/iconCatalogues.js +16 -3
- package/dist/esm/components/CnIconPicker/iconCatalogues.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +76 -8
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +2 -2
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue2.js +2 -1
- package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue2.js.map +1 -1
- package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue3.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +6 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue2.js +4 -0
- package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue3.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue.js +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue2.js +10 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue2.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue3.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue2.js +22 -0
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue2.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue3.js.map +1 -1
- package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue2.js +4 -0
- package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue2.js.map +1 -1
- package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue3.js.map +1 -1
- package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue.js +1 -1
- package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue2.js +1 -1
- package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue2.js.map +1 -1
- package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue3.js.map +1 -1
- package/dist/esm/composables/indexSources.js +30 -2
- package/dist/esm/composables/indexSources.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue.js +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue2.js +2 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue2.js +3 -2
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue.js +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue2.js +2 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue2.js +2 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue.js +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue2.js +2 -6
- package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue2.js +2 -6
- package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue3.js.map +1 -1
- package/dist/esm/integrations/utils/marker.js +35 -6
- package/dist/esm/integrations/utils/marker.js.map +1 -1
- package/dist/esm/l10n/en.json.js +8 -0
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +8 -0
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +478 -334
- package/dist/esm/utils/fillTemplate.js +3 -0
- package/dist/esm/utils/fillTemplate.js.map +1 -1
- package/dist/esm/utils/htmlToText.js +36 -0
- package/dist/esm/utils/htmlToText.js.map +1 -0
- package/dist/esm/utils/prototypeKeys.js +20 -0
- package/dist/esm/utils/prototypeKeys.js.map +1 -0
- package/dist/esm/utils/toastUiRawHtmlGuard.js +166 -0
- package/dist/esm/utils/toastUiRawHtmlGuard.js.map +1 -0
- package/dist/nextcloud-vue.cjs.js +11501 -10640
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +478 -334
- package/l10n/en.json +8 -0
- package/l10n/nl.json +8 -0
- package/package.json +1 -1
- package/src/components/CnChipListManager/CnChipListManager.vue +504 -0
- package/src/components/CnChipListManager/index.js +4 -0
- package/src/components/CnFilesBrowser/openRegisterSource.js +2 -1
- package/src/components/CnFilterRowsEditor/CnFilterRowsEditor.vue +4 -0
- package/src/components/CnFormDialog/CnFormDialog.vue +2 -2
- package/src/components/CnIconPicker/CnIconPicker.vue +4 -3
- package/src/components/CnIconPicker/iconCatalogues.js +16 -3
- package/src/components/CnIndexPage/CnIndexPage.vue +78 -10
- package/src/components/CnLinksWidgetForm/CnLinksWidgetForm.vue +2 -1
- package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +6 -1
- package/src/components/CnObjectListWidget/CnObjectListWidget.vue +1 -1
- package/src/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue +4 -0
- package/src/components/CnPageTreeNode/CnPageTreeRow.vue +10 -1
- package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +22 -0
- package/src/components/CnStagesWidgetForm/CnStagesWidgetForm.vue +4 -0
- package/src/components/CnWalkthrough/CnWalkthrough.vue +1 -1
- package/src/components/index.js +1 -0
- package/src/composables/indexSources.js +30 -2
- package/src/css/look-board-detail.css +6 -4
- package/src/css/look-board.css +46 -1
- package/src/index.js +1 -0
- package/src/integrations/builtin/analytics/CnAnalyticsCard.vue +2 -1
- package/src/integrations/builtin/analytics/CnAnalyticsTab.vue +3 -2
- package/src/integrations/builtin/photos/CnPhotosCard.vue +2 -1
- package/src/integrations/builtin/photos/CnPhotosTab.vue +2 -1
- package/src/integrations/builtin/xwiki/CnXwikiCard.vue +2 -6
- package/src/integrations/builtin/xwiki/CnXwikiTab.vue +2 -6
- package/src/integrations/utils/marker.js +35 -6
- package/src/utils/fillTemplate.js +3 -0
- package/src/utils/htmlToText.js +33 -0
- package/src/utils/prototypeKeys.js +17 -0
- package/src/utils/toastUiRawHtmlGuard.js +162 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnMarkdownEditor.vue2.js","sources":["../../../../src/components/CnMarkdownEditor/CnMarkdownEditor.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-markdown-editor\" data-testid=\"cn-markdown-editor\" :class=\"modeClass\">\n\t\t<!-- Toolbar with formatting shortcuts (textarea modes only; WYSIWYG has its own). -->\n\t\t<div v-if=\"!hideToolbar && mode !== 'wysiwyg'\" class=\"cn-markdown-editor__toolbar\" role=\"toolbar\">\n\t\t\t<button v-for=\"tool in toolbar\"\n\t\t\t\t:key=\"tool.id\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool\"\n\t\t\t\t:title=\"tool.tooltip || tool.label\"\n\t\t\t\t:data-testid=\"'tool-' + tool.id\"\n\t\t\t\t@click=\"invokeTool(tool)\">\n\t\t\t\t<span>{{ tool.label }}</span>\n\t\t\t</button>\n\t\t\t<span class=\"cn-markdown-editor__spacer\" />\n\t\t\t<button v-if=\"!hideModeSwitch\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool cn-markdown-editor__mode-switch\"\n\t\t\t\t:title=\"modeSwitchTooltip\"\n\t\t\t\tdata-testid=\"mode-switch\"\n\t\t\t\t@click=\"cycleMode\">\n\t\t\t\t{{ currentModeLabel }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<!-- Pane layout: edit / preview / split (textarea + rendered preview). -->\n\t\t<div v-if=\"mode !== 'wysiwyg'\" class=\"cn-markdown-editor__panes\" :data-mode=\"mode\">\n\t\t\t<textarea v-if=\"mode !== 'preview'\"\n\t\t\t\tref=\"textarea\"\n\t\t\t\tclass=\"cn-markdown-editor__textarea\"\n\t\t\t\t:value=\"localValue\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:aria-label=\"ariaLabel\"\n\t\t\t\tdata-testid=\"cn-markdown-textarea\"\n\t\t\t\t@input=\"onInput\"\n\t\t\t\t@keydown=\"onKeydown\" />\n\t\t\t<div v-if=\"mode !== 'edit'\"\n\t\t\t\tclass=\"cn-markdown-editor__preview\"\n\t\t\t\tdata-testid=\"cn-markdown-preview\"\n\t\t\t\tv-html=\"renderedHtml\" /><!-- eslint-disable-line vue/no-v-html -- renderedHtml comes from cnRenderMarkdown(), which sanitises through DOMPurify -->\n\t\t</div>\n\n\t\t<!-- WYSIWYG mode: lazily-instantiated Toast UI editor. The editor is\n\t\t driven imperatively against `toastHost` rather than through a Vue\n\t\t wrapper component — `@toast-ui/vue-editor` is Vue-2 only, so the\n\t\t Vue-3 line uses the framework-agnostic `@toast-ui/editor` API. -->\n\t\t<div v-else class=\"cn-markdown-editor__wysiwyg\" data-testid=\"cn-markdown-wysiwyg\">\n\t\t\t<div v-show=\"toastEditorReady\" ref=\"toastHost\" />\n\t\t\t<p v-if=\"!toastEditorReady\" class=\"cn-markdown-editor__hint\">\n\t\t\t\t{{ t('nextcloud-vue', 'Loading editor…') }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<!-- Hint row. -->\n\t\t<small v-if=\"hint\" class=\"cn-markdown-editor__hint\">{{ hint }}</small>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { cnRenderMarkdown } from '../../composables/cnRenderMarkdown.js'\nimport { toastUiSanitizer } from '../../utils/toastUiSanitizer.js'\n\n/**\n * Default formatting toolbar — Markdown insertions that wrap a\n * selection or insert a placeholder.\n *\n * @type {Array<{id:string,label:string,prefix:string,suffix?:string,placeholder?:string}>}\n */\nconst DEFAULT_TOOLBAR = Object.freeze([\n\t{ id: 'bold', label: 'B', prefix: '**', suffix: '**', placeholder: 'bold', tooltip: 'Bold (Ctrl+B)' },\n\t{ id: 'italic', label: 'I', prefix: '_', suffix: '_', placeholder: 'italic', tooltip: 'Italic (Ctrl+I)' },\n\t{ id: 'h1', label: 'H1', prefix: '# ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 1', linePrefix: true },\n\t{ id: 'h2', label: 'H2', prefix: '## ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 2', linePrefix: true },\n\t{ id: 'link', label: '🔗', prefix: '[', suffix: '](https://)', placeholder: 'link text', tooltip: 'Link' },\n\t{ id: 'code', label: '`</>`', prefix: '`', suffix: '`', placeholder: 'code', tooltip: 'Inline code' },\n\t{ id: 'list', label: '•', prefix: '- ', suffix: '', placeholder: 'item', tooltip: 'List', linePrefix: true },\n\t{ id: 'quote', label: '“”', prefix: '> ', suffix: '', placeholder: 'quote', tooltip: 'Quote', linePrefix: true },\n])\n\nconst MODES = ['edit', 'split', 'preview', 'wysiwyg']\n\n/**\n * Matches a list item at the start of a line: leading indentation, a bullet\n * (`-`/`*`/`+`) or ordered marker (`1.`/`1)`), the whitespace after it, then the\n * item body. Drives the smart Enter / Tab list handling. Only the markers\n * CommonMark actually renders as lists are recognised (no `a.`/`A)` alpha\n * markers — Markdown renders those as plain text).\n *\n * @type {RegExp}\n */\nconst LIST_ITEM_RE = /^([ \\t]*)([-*+]|\\d+[.)])([ \\t]+)(.*)$/\n\n/** One indent step for nesting list items (a tab; textarea uses `tab-size: 2`). */\nconst LIST_INDENT = '\\t'\n\n/**\n * The marker that continues a list after `marker`: unordered bullets repeat;\n * numeric markers increment (`1.`→`2.`, `1)`→`2)`) keeping the `.`/`)` delimiter.\n *\n * @param {string} marker The current line's list marker (e.g. `-`, `1.`).\n * @return {string} The next item's marker.\n */\nfunction nextListMarker(marker) {\n\tconst ordered = marker.match(/^(\\d+)([.)])$/)\n\tif (!ordered) {\n\t\treturn marker\n\t}\n\treturn `${parseInt(ordered[1], 10) + 1}${ordered[2]}`\n}\n\n/**\n * Read off the run of wrap markers sitting against one edge of the selection,\n * innermost first. `**_` to the left of the caret yields `['_', '**']`.\n *\n * `markers` must be ordered longest-first so `**` is never read as two `*`.\n *\n * @param {string} text The text on that side of the selection.\n * @param {string[]} markers Known wrap delimiters, longest first.\n * @param {boolean} fromEnd Scan backwards from the end (the text BEFORE the\n * selection) rather than forwards from the start (the text AFTER it).\n * @return {string[]} The markers found, innermost first.\n */\nfunction peelMarkers(text, markers, fromEnd) {\n\tconst found = []\n\tlet rest = text\n\tconst nextMarker = () => markers.find((m) => m !== '' && (fromEnd ? rest.endsWith(m) : rest.startsWith(m)))\n\tfor (let hit = nextMarker(); hit; hit = nextMarker()) {\n\t\tfound.push(hit)\n\t\trest = fromEnd ? rest.slice(0, rest.length - hit.length) : rest.slice(hit.length)\n\t}\n\treturn found\n}\n\n/**\n * Default Toast UI WYSIWYG toolbar layout — used only in `mode: 'wysiwyg'`.\n *\n * @type {Array<Array<string>>}\n */\nconst DEFAULT_WYSIWYG_TOOLBAR = Object.freeze([\n\t['heading', 'bold', 'italic', 'strike'],\n\t['hr', 'quote'],\n\t['ul', 'ol', 'task', 'indent', 'outdent'],\n\t['table', 'image', 'link'],\n\t['code', 'codeblock'],\n])\n\n/**\n * CnMarkdownEditor — Markdown editor with a textarea + live HTML\n * preview, a formatting toolbar, and four layout modes (edit /\n * split / preview / wysiwyg).\n *\n * The default path is a `<textarea>` + `cnRenderMarkdown` preview.\n * Setting `mode: 'wysiwyg'` opts into a rich Toast UI WYSIWYG editor\n * that is **lazily loaded** only when that mode is active — the\n * textarea modes carry no editor dependency. The `v-model` contract\n * is identical across all modes (`value` in, `input` out).\n *\n * ```vue\n * <CnMarkdownEditor v-model=\"article\" placeholder=\"Write your article …\" />\n * <CnMarkdownEditor v-model=\"article\" mode=\"wysiwyg\" />\n * ```\n *\n * Toolbar buttons either wrap the current selection or insert a\n * placeholder (`bold` / `italic` / `link` / `code`) OR prefix the\n * current line (`h1` / `h2` / `list` / `quote`). The `toolbar`\n * prop lets consumers replace the default set.\n */\nexport default {\n\tname: 'CnMarkdownEditor',\n\tprops: {\n\t\t/**\n\t\t * Markdown source (v-model).\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tvalue: { type: String, default: '' },\n\t\t/**\n\t\t * Markdown source, Vue 3's own v-model prop.\n\t\t *\n\t\t * ⚠️ WITHOUT THIS, `v-model` ON THIS COMPONENT DOES NOTHING. Vue 3\n\t\t * compiles `v-model=\"x\"` to `:modelValue` + `@update:modelValue`, so a\n\t\t * component that only declares `value`/`input` never receives the prop\n\t\t * and its emit is never heard — silently, with no warning, looking\n\t\t * exactly like a component that works.\n\t\t *\n\t\t * `value` is kept as the public name (consumers depend on it) and both\n\t\t * are accepted. `undefined` rather than `''` as the default is what\n\t\t * distinguishes \"not passed\" from \"passed as empty\".\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tmodelValue: { type: String, default: undefined },\n\t\t/**\n\t\t * Layout mode. `edit` shows only the textarea, `preview`\n\t\t * shows only the rendered HTML, `split` shows both\n\t\t * side-by-side.\n\t\t *\n\t\t * @type {'edit'|'split'|'preview'}\n\t\t */\n\t\tmode: {\n\t\t\ttype: String,\n\t\t\tdefault: 'split',\n\t\t\tvalidator: (v) => MODES.includes(v),\n\t\t},\n\n\t\t/** Placeholder for the textarea. */\n\t\tplaceholder: { type: String, default: 'Write Markdown…' },\n\t\t/** Aria-label for the textarea. */\n\t\tariaLabel: { type: String, default: 'Markdown editor input' },\n\t\t/** Minimum textarea rows. */\n\t\trows: { type: Number, default: 10 },\n\t\t/** Disable the textarea (still renders the preview). */\n\t\tdisabled: { type: Boolean, default: false },\n\t\t/** Hide the formatting toolbar entirely. */\n\t\thideToolbar: { type: Boolean, default: false },\n\t\t/** Hide the mode-switch button on the toolbar. */\n\t\thideModeSwitch: { type: Boolean, default: false },\n\t\t/** Mode-switch tooltip. */\n\t\tmodeSwitchTooltip: { type: String, default: 'Cycle layout (edit / split / preview)' },\n\t\t/**\n\t\t * Custom toolbar entries. Each entry: `{id, label, prefix,\n\t\t * suffix?, placeholder?, tooltip?, linePrefix?}`. When\n\t\t * `linePrefix: true` the prefix is inserted at the start\n\t\t * of the current line instead of wrapping the selection.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\ttoolbar: { type: Array, default: () => DEFAULT_TOOLBAR.slice() },\n\t\t/** Optional helper text rendered under the editor. */\n\t\thint: { type: String, default: '' },\n\t\t/**\n\t\t * WYSIWYG mode only: Toast UI toolbar layout (array of button groups).\n\t\t * Ignored in the textarea modes.\n\t\t *\n\t\t * @type {Array<Array<string>>}\n\t\t */\n\t\twysiwygToolbar: { type: Array, default: () => DEFAULT_WYSIWYG_TOOLBAR.map((g) => g.slice()) },\n\t\t/** WYSIWYG mode only: editor height (any CSS length). */\n\t\twysiwygHeight: { type: String, default: '300px' },\n\t},\n\n\t// Declaring the emitted events is not cosmetic under Vue 3: an UNdeclared\n\t// event name also stays in `$attrs` and falls through to the root element,\n\t// so the NATIVE `input` event the `<textarea>` bubbles up is re-emitted by\n\t// the component as its own `input` — after the component's own\n\t// `$emit('input', value)` — and listeners receive the raw InputEvent\n\t// instead of the string.\n\temits: ['input', 'update:modelValue', 'update:mode'],\n\tdata() {\n\t\treturn {\n\t\t\tlocalValue: (this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t\t// Whether the lazily-created Toast UI editor instance is live\n\t\t\t// (WYSIWYG mode only). Drives the loading hint.\n\t\t\ttoastEditorReady: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * BEM modifier for the current layout mode.\n\t\t *\n\t\t * @return {string} The class.\n\t\t */\n\t\tmodeClass() {\n\t\t\treturn `cn-markdown-editor--${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Every wrap delimiter the active toolbar can produce, longest first.\n\t\t * Toggling has to recognise the OTHER tools' markers, not just its own,\n\t\t * or alternating bold and italic stacks instead of toggling.\n\t\t *\n\t\t * @return {string[]} The delimiters, longest first.\n\t\t */\n\t\twrapMarkers() {\n\t\t\tconst out = new Set()\n\t\t\tfor (const tool of this.toolbar) {\n\t\t\t\tif (tool.linePrefix || !tool.suffix) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tout.add(tool.prefix)\n\t\t\t\tout.add(tool.suffix)\n\t\t\t}\n\t\t\treturn [...out].sort((a, b) => b.length - a.length)\n\t\t},\n\n\t\t/**\n\t\t * The value the consumer actually bound, whichever prop they used.\n\t\t *\n\t\t * @return {string} The markdown source.\n\t\t */\n\t\tboundValue() {\n\t\t\treturn this.modelValue !== undefined ? this.modelValue : this.value\n\t\t},\n\n\t\t/**\n\t\t * Rendered HTML for the preview pane. Uses\n\t\t * `cnRenderMarkdown` so the output goes through the lib's\n\t\t * sanitised pipeline.\n\t\t *\n\t\t * @return {string} The rendered HTML.\n\t\t */\n\t\trenderedHtml() {\n\t\t\treturn cnRenderMarkdown(this.localValue || '')\n\t\t},\n\n\t\t/**\n\t\t * Label for the mode-switch button (shows the NEXT mode).\n\t\t *\n\t\t * @return {string} The label.\n\t\t */\n\t\tcurrentModeLabel() {\n\t\t\treturn `▦ ${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Toast UI editor options (WYSIWYG mode) — the configured toolbar plus\n\t\t * fixed WYSIWYG defaults.\n\t\t *\n\t\t * @return {object} The Toast UI options object.\n\t\t */\n\t\twysiwygOptions() {\n\t\t\treturn {\n\t\t\t\tminHeight: '200px',\n\t\t\t\tlanguage: 'en-US',\n\t\t\t\thideModeSwitch: true,\n\t\t\t\ttoolbarItems: this.wysiwygToolbar,\n\t\t\t\tinitialEditType: 'wysiwyg',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\t// Both spellings watched, because either may be the one the consumer\n\t\t// bound. `boundValue` collapses them so the body is written once.\n\t\tmodelValue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tvalue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tmode(next) {\n\t\t\tif (next === 'wysiwyg') {\n\t\t\t\tthis.loadWysiwyg()\n\t\t\t}\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.mode === 'wysiwyg') {\n\t\t\tthis.loadWysiwyg()\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\t// The editor is created imperatively, so Vue will not tear it down.\n\t\tif (this.toastEditor && typeof this.toastEditor.destroy === 'function') {\n\t\t\tthis.toastEditor.destroy()\n\t\t}\n\t\tthis.toastEditor = null\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Lazily import and instantiate the Toast UI editor (and its CSS) the\n\t\t * first time WYSIWYG mode is entered. Keeps the ~200 KB editor out of\n\t\t * the default textarea path.\n\t\t *\n\t\t * Uses the framework-agnostic `@toast-ui/editor` constructor rather\n\t\t * than a Vue wrapper: `@toast-ui/vue-editor` is published for Vue 2\n\t\t * only and has no Vue-3 build. The instance is held as a plain (NON\n\t\t * reactive) instance property — putting a third-party class instance\n\t\t * in `data()` would wrap it in Vue 3's reactive proxy and break its\n\t\t * internal identity checks.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync loadWysiwyg() {\n\t\t\tif (this.toastEditor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst [{ default: Editor }] = await Promise.all([\n\t\t\t\t\timport('@toast-ui/editor'),\n\t\t\t\t\timport('@toast-ui/editor/dist/toastui-editor.css'),\n\t\t\t\t])\n\t\t\t\tawait this.$nextTick()\n\t\t\t\tconst el = this.$refs.toastHost\n\t\t\t\tif (!el) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.toastEditor = new Editor({\n\t\t\t\t\tel,\n\t\t\t\t\t...this.wysiwygOptions,\n\t\t\t\t\tinitialValue: this.localValue,\n\t\t\t\t\tpreviewStyle: 'tab',\n\t\t\t\t\theight: this.wysiwygHeight,\n\t\t\t\t\tevents: { change: this.onWysiwygChange },\n\t\t\t\t\t// Replaces the DOMPurify 2.3.3 copy that @toast-ui/editor\n\t\t\t\t\t// inlines into its own bundle (unmaintained since 2023, so\n\t\t\t\t\t// no npm-level fix exists). Same sanitising contract, run\n\t\t\t\t\t// by the maintained DOMPurify 3.x — see the module docs.\n\t\t\t\t\t// Set last so a consumer cannot drop it via wysiwygOptions.\n\t\t\t\t\tcustomHTMLSanitizer: toastUiSanitizer,\n\t\t\t\t})\n\t\t\t\tthis.toastEditorReady = true\n\t\t\t} catch (e) {\n\t\t\t\t// eslint-disable-next-line no-console -- diagnostic for a failure this code already degrades from\n\t\t\t\tconsole.error('CnMarkdownEditor: failed to load the WYSIWYG editor', e)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Toast UI change handler — read the current markdown and emit it via\n\t\t * v-model.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonWysiwygChange() {\n\t\t\tif (!this.toastEditor || typeof this.toastEditor.getMarkdown !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst markdown = this.toastEditor.getMarkdown()\n\t\t\tthis.localValue = markdown\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(markdown)\n\t\t},\n\n\t\t/**\n\t\t * Adopt a value pushed in from outside.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\tonBoundValueChange(next) {\n\t\t\tif (next === this.localValue) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.localValue = next\n\t\t\t// The imperative editor holds its own copy of the document, so an\n\t\t\t// external v-model change has to be pushed into it. Guarded on the\n\t\t\t// current markdown so we don't clobber the caret while the user is\n\t\t\t// typing (our own change handler round-trips here).\n\t\t\tif (this.toastEditor && this.toastEditor.getMarkdown() !== next) {\n\t\t\t\tthis.toastEditor.setMarkdown(next || '')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer the value changed, in both v-model dialects.\n\t\t *\n\t\t * BOTH are emitted, always. A consumer on `@input` and a consumer on\n\t\t * `v-model` are the same consumer as far as this component knows, and\n\t\t * emitting only one silently breaks half of them.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\temitValue(next) {\n\t\t\t/**\n\t\t\t * @event input The value changed. Vue 2's v-model dialect, kept for\n\t\t\t * existing consumers.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * @event update:modelValue The value changed. Vue 3's v-model\n\t\t\t * dialect — what a plain `v-model` listens for.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\n\t\t/**\n\t\t * Textarea input handler — pushes the new value upward via\n\t\t * v-model.\n\t\t *\n\t\t * @param {InputEvent} event The input event.\n\t\t * @return {void}\n\t\t */\n\t\tonInput(event) {\n\t\t\tthis.localValue = event.target.value\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(this.localValue)\n\t\t},\n\n\t\t/**\n\t\t * Keyboard handler. Ctrl/Cmd+B / Ctrl/Cmd+I trigger bold / italic;\n\t\t * Enter continues (or exits) a list; Tab / Shift+Tab indent / dedent a\n\t\t * list item. Anything else falls through to the textarea default.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @return {void}\n\t\t */\n\t\tonKeydown(event) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.ctrlKey || event.metaKey) {\n\t\t\t\tlet toolId = null\n\t\t\t\tif (event.key === 'b' || event.key === 'B') {\n\t\t\t\t\ttoolId = 'bold'\n\t\t\t\t} else if (event.key === 'i' || event.key === 'I') {\n\t\t\t\t\ttoolId = 'italic'\n\t\t\t\t}\n\t\t\t\tif (!toolId) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst tool = this.toolbar.find((t) => t.id === toolId)\n\t\t\t\tif (!tool) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.invokeTool(tool)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.key === 'Enter' && !event.shiftKey) {\n\t\t\t\tthis.handleListEnter(event, ta)\n\t\t\t} else if (event.key === 'Tab') {\n\t\t\t\tthis.handleListTab(event, ta)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Smart Enter inside a list: continue with the next marker (incrementing\n\t\t * ordered / alpha markers), or — when the current item is empty — break\n\t\t * out of the list, leaving a blank line so the user types normally. No-op\n\t\t * (default newline) unless the caret is in a list item's body.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListEnter(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tif (selStart !== ta.selectionEnd) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst lineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst nl = value.indexOf('\\n', selStart)\n\t\t\tconst lineEnd = nl === -1 ? value.length : nl\n\t\t\tconst m = value.slice(lineStart, lineEnd).match(LIST_ITEM_RE)\n\t\t\tif (!m) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [, indent, marker, gap, content] = m\n\t\t\t// Only act once the caret is past the marker (in the item body).\n\t\t\tif (selStart < lineStart + indent.length + marker.length + gap.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tif (content.trim() === '') {\n\t\t\t\t// Empty item → exit the list: drop the marker, leave a blank line.\n\t\t\t\tconst next = `${value.slice(0, lineStart)}${value.slice(lineEnd)}`\n\t\t\t\tthis.applyTextChange(next, lineStart, lineStart)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst insertion = `\\n${indent}${nextListMarker(marker)}${gap}`\n\t\t\tconst next = `${value.slice(0, selStart)}${insertion}${value.slice(selStart)}`\n\t\t\tconst caret = selStart + insertion.length\n\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t},\n\n\t\t/**\n\t\t * Smart Tab inside a list: Tab indents the current line (or every line\n\t\t * spanned by the selection) by one level; Shift+Tab dedents it. Only\n\t\t * hijacks Tab when the caret's line is a list item, so Tab still moves\n\t\t * focus in plain text.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListTab(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tconst selEnd = ta.selectionEnd\n\t\t\tconst firstLineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst firstNl = value.indexOf('\\n', firstLineStart)\n\t\t\tconst firstLineEnd = firstNl === -1 ? value.length : firstNl\n\t\t\tif (!LIST_ITEM_RE.test(value.slice(firstLineStart, firstLineEnd))) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tconst endRef = selEnd > selStart ? selEnd - 1 : selEnd\n\t\t\tconst lastNl = value.indexOf('\\n', endRef)\n\t\t\tconst blockEnd = lastNl === -1 ? value.length : lastNl\n\t\t\tconst lines = value.slice(firstLineStart, blockEnd).split('\\n')\n\t\t\tlet firstDelta = 0\n\t\t\tlet newLines\n\t\t\tif (event.shiftKey) {\n\t\t\t\tnewLines = lines.map((ln, i) => {\n\t\t\t\t\tlet strip = 0\n\t\t\t\t\tif (ln.startsWith('\\t')) {\n\t\t\t\t\t\tstrip = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile (strip < 2 && ln[strip] === ' ') {\n\t\t\t\t\t\t\tstrip++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (i === 0) {\n\t\t\t\t\t\tfirstDelta = -strip\n\t\t\t\t\t}\n\t\t\t\t\treturn ln.slice(strip)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tnewLines = lines.map((ln) => `${LIST_INDENT}${ln}`)\n\t\t\t\tfirstDelta = LIST_INDENT.length\n\t\t\t}\n\t\t\tconst newBlock = newLines.join('\\n')\n\t\t\tconst next = `${value.slice(0, firstLineStart)}${newBlock}${value.slice(blockEnd)}`\n\t\t\tif (selStart === selEnd) {\n\t\t\t\tconst caret = Math.max(firstLineStart, selStart + firstDelta)\n\t\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t\t} else {\n\t\t\t\tthis.applyTextChange(next, firstLineStart, firstLineStart + newBlock.length)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Commit a programmatic edit: update the model, emit `input`, then\n\t\t * restore focus + selection on the next tick.\n\t\t *\n\t\t * @param {string} next The new textarea value.\n\t\t * @param {number} selStart The caret/selection start to restore.\n\t\t * @param {number} selEnd The selection end to restore.\n\t\t * @return {void}\n\t\t */\n\t\tapplyTextChange(next, selStart, selEnd) {\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst ta = this.$refs.textarea\n\t\t\t\tif (!ta) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(selStart, selEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Cycle the layout mode `edit → split → preview → edit`.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcycleMode() {\n\t\t\tconst idx = MODES.indexOf(this.mode)\n\t\t\tconst next = MODES[(idx + 1) % MODES.length]\n\t\t\t/**\n\t\t\t * @event update:mode v-model:mode emit so consumers can bind the layout mode.\n\t\t\t * @type {'edit'|'split'|'preview'}\n\t\t\t */\n\t\t\tthis.$emit('update:mode', next)\n\t\t},\n\n\t\t/**\n\t\t * Apply a toolbar action — either prefix the current line\n\t\t * (`linePrefix: true`) or wrap the current selection.\n\t\t *\n\t\t * @param {object} tool The toolbar entry.\n\t\t * @return {void}\n\t\t */\n\t\tinvokeTool(tool) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst selected = this.localValue.slice(ta.selectionStart, ta.selectionEnd)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\n\t\t\tlet nextValue\n\t\t\tlet nextSelStart\n\t\t\tlet nextSelEnd\n\t\t\tif (tool.linePrefix) {\n\t\t\t\t// Line-prefix mode (headings, list, quote): toggle/replace the\n\t\t\t\t// marker on the current line rather than stacking it. Operates on\n\t\t\t\t// the whole line under the caret, ignoring any selection.\n\t\t\t\tconst lineStart = before.lastIndexOf('\\n') + 1\n\t\t\t\tconst afterNl = after.indexOf('\\n')\n\t\t\t\tconst lineEnd = afterNl === -1 ? this.localValue.length : ta.selectionEnd + afterNl\n\t\t\t\tconst head = this.localValue.slice(0, lineStart)\n\t\t\t\tconst line = this.localValue.slice(lineStart, lineEnd)\n\t\t\t\tconst tail = this.localValue.slice(lineEnd)\n\n\t\t\t\t// Strip an existing recognised marker (heading #…, list -/*, quote >)\n\t\t\t\t// so switching one for another REPLACES it (e.g. `# ` → `## `, never\n\t\t\t\t// `## #`); re-applying the same marker toggles it off.\n\t\t\t\tconst existing = (line.match(/^(#{1,6} |[-*] |> )/) || [''])[0]\n\t\t\t\tconst body = line.slice(existing.length)\n\t\t\t\tconst newLine = existing === tool.prefix ? body : `${tool.prefix}${body}`\n\n\t\t\t\tnextValue = `${head}${newLine}${tail}`\n\t\t\t\t// Keep the caret/selection in the body, shifted by the marker delta.\n\t\t\t\tconst delta = newLine.length - line.length\n\t\t\t\tconst min = lineStart\n\t\t\t\tconst max = lineStart + newLine.length\n\t\t\t\tnextSelStart = Math.min(Math.max(ta.selectionStart + delta, min), max)\n\t\t\t\tnextSelEnd = Math.min(Math.max(ta.selectionEnd + delta, min), max)\n\t\t\t} else {\n\t\t\t\t// Wrap mode (bold/italic/link/code): toggle. If the selection is\n\t\t\t\t// already wrapped in this tool's delimiters — either they're part\n\t\t\t\t// of the selection, or they sit around it — strip them; otherwise\n\t\t\t\t// add them. Stops `**`/`_` from stacking on repeat presses.\n\t\t\t\tconst p = tool.prefix\n\t\t\t\tconst s = tool.suffix || ''\n\t\t\t\tconst wrappedInside = selected.length >= p.length + s.length\n\t\t\t\t\t&& selected.startsWith(p)\n\t\t\t\t\t&& selected.endsWith(s)\n\n\t\t\t\t// Not just the delimiters immediately against the selection: read\n\t\t\t\t// the whole run on each side, so this tool's pair is still found\n\t\t\t\t// with another tool's nested inside it. Toggling bold on\n\t\t\t\t// `**_text_**` has to see the `**` through the `_`, or alternating\n\t\t\t\t// bold and italic stacks markers forever instead of toggling.\n\t\t\t\tconst markers = this.wrapMarkers\n\t\t\t\tconst leftRun = s === '' ? [] : peelMarkers(before, markers, true)\n\t\t\t\tconst rightRun = s === '' ? [] : peelMarkers(after, markers, false)\n\t\t\t\t// Same depth on both sides: that is what makes them a pair.\n\t\t\t\tconst depth = leftRun.findIndex((m, i) => m === p && rightRun[i] === s)\n\n\t\t\t\tif (wrappedInside) {\n\t\t\t\t\tconst inner = selected.slice(p.length, selected.length - s.length)\n\t\t\t\t\tnextValue = `${before}${inner}${after}`\n\t\t\t\t\tnextSelStart = before.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t} else if (depth !== -1) {\n\t\t\t\t\t// Selection is the inner text; drop this tool's pair and leave\n\t\t\t\t\t// every marker nested inside it where it is.\n\t\t\t\t\tconst pStart = before.length\n\t\t\t\t\t\t- leftRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\t\t- p.length\n\t\t\t\t\tconst sStart = rightRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\tnextValue = before.slice(0, pStart)\n\t\t\t\t\t\t+ before.slice(pStart + p.length)\n\t\t\t\t\t\t+ selected\n\t\t\t\t\t\t+ after.slice(0, sStart)\n\t\t\t\t\t\t+ after.slice(sStart + s.length)\n\t\t\t\t\tnextSelStart = before.length - p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + selected.length\n\t\t\t\t} else {\n\t\t\t\t\tconst inner = selected || tool.placeholder || ''\n\t\t\t\t\tconst insertion = `${p}${inner}${s}`\n\t\t\t\t\tnextValue = `${before}${insertion}${after}`\n\t\t\t\t\tnextSelStart = before.length + p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.localValue = nextValue\n\t\t\tthis.emitValue(nextValue)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(nextSelStart, nextSelEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Programmatic insert helper — exposed publicly so parents\n\t\t * can drop content at the caret (e.g. from a file-picker\n\t\t * callback inserting a `` reference).\n\t\t *\n\t\t * @param {string} text The text to insert at the caret.\n\t\t * @return {void}\n\t\t */\n\t\tinsertAtCaret(text) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\tthis.localValue += text\n\t\t\t\tthis.emitValue(this.localValue)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\t\t\tconst next = `${before}${text}${after}`\n\t\t\tconst caret = before.length + text.length\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(caret, caret)\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-markdown-editor {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-main-background);\n\toverflow: hidden;\n}\n\n.cn-markdown-editor__toolbar {\n\tdisplay: flex;\n\tgap: 4px;\n\tpadding: 6px;\n\tborder-bottom: 1px solid var(--color-border);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-markdown-editor__tool {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 4px 8px;\n\tcursor: pointer;\n\tfont-family: monospace;\n\tmin-width: 28px;\n}\n\n.cn-markdown-editor__tool:hover {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n}\n\n.cn-markdown-editor__spacer {\n\tflex: 1 1 auto;\n}\n\n.cn-markdown-editor__panes {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"split\"] {\n\tgrid-template-columns: 1fr 1fr;\n}\n\n.cn-markdown-editor__textarea {\n\tborder: none;\n\toutline: none;\n\tpadding: 10px 12px;\n\tfont-family: monospace;\n\tfont-size: 0.95em;\n\tresize: vertical;\n\twidth: 100%;\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\t/* Nested list indents are single tabs (see LIST_INDENT); render them\n\t compactly rather than the 8-char browser default. */\n\ttab-size: 2;\n\t-moz-tab-size: 2;\n}\n\n.cn-markdown-editor__preview {\n\tpadding: 10px 14px;\n\tborder-left: 1px solid var(--color-border);\n\tbackground: var(--color-main-background);\n\toverflow-y: auto;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"preview\"] .cn-markdown-editor__preview {\n\tborder-left: none;\n}\n\n.cn-markdown-editor__hint {\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 0 10px 8px;\n}\n\n/* WYSIWYG (Toast UI) mode — themed with Nextcloud CSS variables. */\n.cn-markdown-editor__wysiwyg {\n\twidth: 100%;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-defaultUI) {\n\tfont-family: var(--font-face) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar) {\n\tbackground-color: var(--color-background-hover) !important;\n\tborder-bottom: 1px solid var(--color-border-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: transparent !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button:hover) {\n\tbackground-color: var(--color-background-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-contents),\n.cn-markdown-editor__wysiwyg :deep(.ProseMirror) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tfont-family: var(--font-face) !important;\n}\n</style>\n"],"names":["t"],"mappings":";;;;AAgEA;;AAEC;AACA;AACA;;AAED,MAAM,eAAgB,GAAE,MAAM,CAAC,MAAM,CAAC;AACrC,CAAA,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB;AACrG,CAAA,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB;CACzG,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,IAAG,EAAG;CACnH,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,IAAG,EAAG;AACpH,CAAA,EAAE,EAAE,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,GAAA,IAAI,CAAC,EAAE,EAAE;AACR,IAAA,IAAI,CAAC,UAAS,IAAK,KAAG;AACtB,IAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAA;IAC9B,MAAK;AACN,IAAA;GACA,MAAM,MAAO,GAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,EAAA;GACzD,MAAM,KAAM,GAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,EAAA;AACnD,GAAA,MAAM,IAAK,GAAE,CAAC,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,EAAA;AACtC,GAAA,MAAM,KAAI,GAAI,MAAM,CAAC,SAAS,IAAI,CAAC,OAAK;AACxC,GAAA,IAAI,CAAC,aAAa,KAAG;AACrB,GAAA,IAAI,CAAC,SAAS,CAAC,IAAI,EAAA;AACnB,GAAA,IAAI,CAAC,SAAS,CAAC,MAAM;AACpB,IAAA,EAAE,CAAC,KAAK,GAAC;AACT,IAAA,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAA;IACjC,EAAA;GACD;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnMarkdownEditor.vue2.js","sources":["../../../../src/components/CnMarkdownEditor/CnMarkdownEditor.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-markdown-editor\" data-testid=\"cn-markdown-editor\" :class=\"modeClass\">\n\t\t<!-- Toolbar with formatting shortcuts (textarea modes only; WYSIWYG has its own). -->\n\t\t<div v-if=\"!hideToolbar && mode !== 'wysiwyg'\" class=\"cn-markdown-editor__toolbar\" role=\"toolbar\">\n\t\t\t<button v-for=\"tool in toolbar\"\n\t\t\t\t:key=\"tool.id\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool\"\n\t\t\t\t:title=\"tool.tooltip || tool.label\"\n\t\t\t\t:data-testid=\"'tool-' + tool.id\"\n\t\t\t\t@click=\"invokeTool(tool)\">\n\t\t\t\t<span>{{ tool.label }}</span>\n\t\t\t</button>\n\t\t\t<span class=\"cn-markdown-editor__spacer\" />\n\t\t\t<button v-if=\"!hideModeSwitch\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool cn-markdown-editor__mode-switch\"\n\t\t\t\t:title=\"modeSwitchTooltip\"\n\t\t\t\tdata-testid=\"mode-switch\"\n\t\t\t\t@click=\"cycleMode\">\n\t\t\t\t{{ currentModeLabel }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<!-- Pane layout: edit / preview / split (textarea + rendered preview). -->\n\t\t<div v-if=\"mode !== 'wysiwyg'\" class=\"cn-markdown-editor__panes\" :data-mode=\"mode\">\n\t\t\t<textarea v-if=\"mode !== 'preview'\"\n\t\t\t\tref=\"textarea\"\n\t\t\t\tclass=\"cn-markdown-editor__textarea\"\n\t\t\t\t:value=\"localValue\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:aria-label=\"ariaLabel\"\n\t\t\t\tdata-testid=\"cn-markdown-textarea\"\n\t\t\t\t@input=\"onInput\"\n\t\t\t\t@keydown=\"onKeydown\" />\n\t\t\t<div v-if=\"mode !== 'edit'\"\n\t\t\t\tclass=\"cn-markdown-editor__preview\"\n\t\t\t\tdata-testid=\"cn-markdown-preview\"\n\t\t\t\tv-html=\"renderedHtml\" /><!-- eslint-disable-line vue/no-v-html -- renderedHtml comes from cnRenderMarkdown(), which sanitises through DOMPurify -->\n\t\t</div>\n\n\t\t<!-- WYSIWYG mode: lazily-instantiated Toast UI editor. The editor is\n\t\t driven imperatively against `toastHost` rather than through a Vue\n\t\t wrapper component — `@toast-ui/vue-editor` is Vue-2 only, so the\n\t\t Vue-3 line uses the framework-agnostic `@toast-ui/editor` API. -->\n\t\t<div v-else class=\"cn-markdown-editor__wysiwyg\" data-testid=\"cn-markdown-wysiwyg\">\n\t\t\t<div v-show=\"toastEditorReady\" ref=\"toastHost\" />\n\t\t\t<p v-if=\"!toastEditorReady\" class=\"cn-markdown-editor__hint\">\n\t\t\t\t{{ t('nextcloud-vue', 'Loading editor…') }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<!-- Hint row. -->\n\t\t<small v-if=\"hint\" class=\"cn-markdown-editor__hint\">{{ hint }}</small>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { cnRenderMarkdown } from '../../composables/cnRenderMarkdown.js'\nimport { guardedToastUiEditorClass } from '../../utils/toastUiRawHtmlGuard.js'\nimport { toastUiSanitizer } from '../../utils/toastUiSanitizer.js'\n\n/**\n * Default formatting toolbar — Markdown insertions that wrap a\n * selection or insert a placeholder.\n *\n * @type {Array<{id:string,label:string,prefix:string,suffix?:string,placeholder?:string}>}\n */\nconst DEFAULT_TOOLBAR = Object.freeze([\n\t{ id: 'bold', label: 'B', prefix: '**', suffix: '**', placeholder: 'bold', tooltip: 'Bold (Ctrl+B)' },\n\t{ id: 'italic', label: 'I', prefix: '_', suffix: '_', placeholder: 'italic', tooltip: 'Italic (Ctrl+I)' },\n\t{ id: 'h1', label: 'H1', prefix: '# ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 1', linePrefix: true },\n\t{ id: 'h2', label: 'H2', prefix: '## ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 2', linePrefix: true },\n\t{ id: 'link', label: '🔗', prefix: '[', suffix: '](https://)', placeholder: 'link text', tooltip: 'Link' },\n\t{ id: 'code', label: '`</>`', prefix: '`', suffix: '`', placeholder: 'code', tooltip: 'Inline code' },\n\t{ id: 'list', label: '•', prefix: '- ', suffix: '', placeholder: 'item', tooltip: 'List', linePrefix: true },\n\t{ id: 'quote', label: '“”', prefix: '> ', suffix: '', placeholder: 'quote', tooltip: 'Quote', linePrefix: true },\n])\n\nconst MODES = ['edit', 'split', 'preview', 'wysiwyg']\n\n/**\n * Matches a list item at the start of a line: leading indentation, a bullet\n * (`-`/`*`/`+`) or ordered marker (`1.`/`1)`), the whitespace after it, then the\n * item body. Drives the smart Enter / Tab list handling. Only the markers\n * CommonMark actually renders as lists are recognised (no `a.`/`A)` alpha\n * markers — Markdown renders those as plain text).\n *\n * @type {RegExp}\n */\nconst LIST_ITEM_RE = /^([ \\t]*)([-*+]|\\d+[.)])([ \\t]+)(.*)$/\n\n/** One indent step for nesting list items (a tab; textarea uses `tab-size: 2`). */\nconst LIST_INDENT = '\\t'\n\n/**\n * The marker that continues a list after `marker`: unordered bullets repeat;\n * numeric markers increment (`1.`→`2.`, `1)`→`2)`) keeping the `.`/`)` delimiter.\n *\n * @param {string} marker The current line's list marker (e.g. `-`, `1.`).\n * @return {string} The next item's marker.\n */\nfunction nextListMarker(marker) {\n\tconst ordered = marker.match(/^(\\d+)([.)])$/)\n\tif (!ordered) {\n\t\treturn marker\n\t}\n\treturn `${parseInt(ordered[1], 10) + 1}${ordered[2]}`\n}\n\n/**\n * Read off the run of wrap markers sitting against one edge of the selection,\n * innermost first. `**_` to the left of the caret yields `['_', '**']`.\n *\n * `markers` must be ordered longest-first so `**` is never read as two `*`.\n *\n * @param {string} text The text on that side of the selection.\n * @param {string[]} markers Known wrap delimiters, longest first.\n * @param {boolean} fromEnd Scan backwards from the end (the text BEFORE the\n * selection) rather than forwards from the start (the text AFTER it).\n * @return {string[]} The markers found, innermost first.\n */\nfunction peelMarkers(text, markers, fromEnd) {\n\tconst found = []\n\tlet rest = text\n\tconst nextMarker = () => markers.find((m) => m !== '' && (fromEnd ? rest.endsWith(m) : rest.startsWith(m)))\n\tfor (let hit = nextMarker(); hit; hit = nextMarker()) {\n\t\tfound.push(hit)\n\t\trest = fromEnd ? rest.slice(0, rest.length - hit.length) : rest.slice(hit.length)\n\t}\n\treturn found\n}\n\n/**\n * Default Toast UI WYSIWYG toolbar layout — used only in `mode: 'wysiwyg'`.\n *\n * @type {Array<Array<string>>}\n */\nconst DEFAULT_WYSIWYG_TOOLBAR = Object.freeze([\n\t['heading', 'bold', 'italic', 'strike'],\n\t['hr', 'quote'],\n\t['ul', 'ol', 'task', 'indent', 'outdent'],\n\t['table', 'image', 'link'],\n\t['code', 'codeblock'],\n])\n\n/**\n * CnMarkdownEditor — Markdown editor with a textarea + live HTML\n * preview, a formatting toolbar, and four layout modes (edit /\n * split / preview / wysiwyg).\n *\n * The default path is a `<textarea>` + `cnRenderMarkdown` preview.\n * Setting `mode: 'wysiwyg'` opts into a rich Toast UI WYSIWYG editor\n * that is **lazily loaded** only when that mode is active — the\n * textarea modes carry no editor dependency. The `v-model` contract\n * is identical across all modes (`value` in, `input` out).\n *\n * ```vue\n * <CnMarkdownEditor v-model=\"article\" placeholder=\"Write your article …\" />\n * <CnMarkdownEditor v-model=\"article\" mode=\"wysiwyg\" />\n * ```\n *\n * Toolbar buttons either wrap the current selection or insert a\n * placeholder (`bold` / `italic` / `link` / `code`) OR prefix the\n * current line (`h1` / `h2` / `list` / `quote`). The `toolbar`\n * prop lets consumers replace the default set.\n */\nexport default {\n\tname: 'CnMarkdownEditor',\n\tprops: {\n\t\t/**\n\t\t * Markdown source (v-model).\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tvalue: { type: String, default: '' },\n\t\t/**\n\t\t * Markdown source, Vue 3's own v-model prop.\n\t\t *\n\t\t * ⚠️ WITHOUT THIS, `v-model` ON THIS COMPONENT DOES NOTHING. Vue 3\n\t\t * compiles `v-model=\"x\"` to `:modelValue` + `@update:modelValue`, so a\n\t\t * component that only declares `value`/`input` never receives the prop\n\t\t * and its emit is never heard — silently, with no warning, looking\n\t\t * exactly like a component that works.\n\t\t *\n\t\t * `value` is kept as the public name (consumers depend on it) and both\n\t\t * are accepted. `undefined` rather than `''` as the default is what\n\t\t * distinguishes \"not passed\" from \"passed as empty\".\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tmodelValue: { type: String, default: undefined },\n\t\t/**\n\t\t * Layout mode. `edit` shows only the textarea, `preview`\n\t\t * shows only the rendered HTML, `split` shows both\n\t\t * side-by-side.\n\t\t *\n\t\t * @type {'edit'|'split'|'preview'}\n\t\t */\n\t\tmode: {\n\t\t\ttype: String,\n\t\t\tdefault: 'split',\n\t\t\tvalidator: (v) => MODES.includes(v),\n\t\t},\n\n\t\t/** Placeholder for the textarea. */\n\t\tplaceholder: { type: String, default: 'Write Markdown…' },\n\t\t/** Aria-label for the textarea. */\n\t\tariaLabel: { type: String, default: 'Markdown editor input' },\n\t\t/** Minimum textarea rows. */\n\t\trows: { type: Number, default: 10 },\n\t\t/** Disable the textarea (still renders the preview). */\n\t\tdisabled: { type: Boolean, default: false },\n\t\t/** Hide the formatting toolbar entirely. */\n\t\thideToolbar: { type: Boolean, default: false },\n\t\t/** Hide the mode-switch button on the toolbar. */\n\t\thideModeSwitch: { type: Boolean, default: false },\n\t\t/** Mode-switch tooltip. */\n\t\tmodeSwitchTooltip: { type: String, default: 'Cycle layout (edit / split / preview)' },\n\t\t/**\n\t\t * Custom toolbar entries. Each entry: `{id, label, prefix,\n\t\t * suffix?, placeholder?, tooltip?, linePrefix?}`. When\n\t\t * `linePrefix: true` the prefix is inserted at the start\n\t\t * of the current line instead of wrapping the selection.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\ttoolbar: { type: Array, default: () => DEFAULT_TOOLBAR.slice() },\n\t\t/** Optional helper text rendered under the editor. */\n\t\thint: { type: String, default: '' },\n\t\t/**\n\t\t * WYSIWYG mode only: Toast UI toolbar layout (array of button groups).\n\t\t * Ignored in the textarea modes.\n\t\t *\n\t\t * @type {Array<Array<string>>}\n\t\t */\n\t\twysiwygToolbar: { type: Array, default: () => DEFAULT_WYSIWYG_TOOLBAR.map((g) => g.slice()) },\n\t\t/** WYSIWYG mode only: editor height (any CSS length). */\n\t\twysiwygHeight: { type: String, default: '300px' },\n\t},\n\n\t// Declaring the emitted events is not cosmetic under Vue 3: an UNdeclared\n\t// event name also stays in `$attrs` and falls through to the root element,\n\t// so the NATIVE `input` event the `<textarea>` bubbles up is re-emitted by\n\t// the component as its own `input` — after the component's own\n\t// `$emit('input', value)` — and listeners receive the raw InputEvent\n\t// instead of the string.\n\temits: ['input', 'update:modelValue', 'update:mode'],\n\tdata() {\n\t\treturn {\n\t\t\tlocalValue: (this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t\t// Whether the lazily-created Toast UI editor instance is live\n\t\t\t// (WYSIWYG mode only). Drives the loading hint.\n\t\t\ttoastEditorReady: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * BEM modifier for the current layout mode.\n\t\t *\n\t\t * @return {string} The class.\n\t\t */\n\t\tmodeClass() {\n\t\t\treturn `cn-markdown-editor--${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Every wrap delimiter the active toolbar can produce, longest first.\n\t\t * Toggling has to recognise the OTHER tools' markers, not just its own,\n\t\t * or alternating bold and italic stacks instead of toggling.\n\t\t *\n\t\t * @return {string[]} The delimiters, longest first.\n\t\t */\n\t\twrapMarkers() {\n\t\t\tconst out = new Set()\n\t\t\tfor (const tool of this.toolbar) {\n\t\t\t\tif (tool.linePrefix || !tool.suffix) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tout.add(tool.prefix)\n\t\t\t\tout.add(tool.suffix)\n\t\t\t}\n\t\t\treturn [...out].sort((a, b) => b.length - a.length)\n\t\t},\n\n\t\t/**\n\t\t * The value the consumer actually bound, whichever prop they used.\n\t\t *\n\t\t * @return {string} The markdown source.\n\t\t */\n\t\tboundValue() {\n\t\t\treturn this.modelValue !== undefined ? this.modelValue : this.value\n\t\t},\n\n\t\t/**\n\t\t * Rendered HTML for the preview pane. Uses\n\t\t * `cnRenderMarkdown` so the output goes through the lib's\n\t\t * sanitised pipeline.\n\t\t *\n\t\t * @return {string} The rendered HTML.\n\t\t */\n\t\trenderedHtml() {\n\t\t\treturn cnRenderMarkdown(this.localValue || '')\n\t\t},\n\n\t\t/**\n\t\t * Label for the mode-switch button (shows the NEXT mode).\n\t\t *\n\t\t * @return {string} The label.\n\t\t */\n\t\tcurrentModeLabel() {\n\t\t\treturn `▦ ${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Toast UI editor options (WYSIWYG mode) — the configured toolbar plus\n\t\t * fixed WYSIWYG defaults.\n\t\t *\n\t\t * @return {object} The Toast UI options object.\n\t\t */\n\t\twysiwygOptions() {\n\t\t\treturn {\n\t\t\t\tminHeight: '200px',\n\t\t\t\tlanguage: 'en-US',\n\t\t\t\thideModeSwitch: true,\n\t\t\t\ttoolbarItems: this.wysiwygToolbar,\n\t\t\t\tinitialEditType: 'wysiwyg',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\t// Both spellings watched, because either may be the one the consumer\n\t\t// bound. `boundValue` collapses them so the body is written once.\n\t\tmodelValue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tvalue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tmode(next) {\n\t\t\tif (next === 'wysiwyg') {\n\t\t\t\tthis.loadWysiwyg()\n\t\t\t}\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.mode === 'wysiwyg') {\n\t\t\tthis.loadWysiwyg()\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\t// The editor is created imperatively, so Vue will not tear it down.\n\t\tif (this.toastEditor && typeof this.toastEditor.destroy === 'function') {\n\t\t\tthis.toastEditor.destroy()\n\t\t}\n\t\tthis.toastEditor = null\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Lazily import and instantiate the Toast UI editor (and its CSS) the\n\t\t * first time WYSIWYG mode is entered. Keeps the ~200 KB editor out of\n\t\t * the default textarea path.\n\t\t *\n\t\t * Uses the framework-agnostic `@toast-ui/editor` constructor rather\n\t\t * than a Vue wrapper: `@toast-ui/vue-editor` is published for Vue 2\n\t\t * only and has no Vue-3 build. The instance is held as a plain (NON\n\t\t * reactive) instance property — putting a third-party class instance\n\t\t * in `data()` would wrap it in Vue 3's reactive proxy and break its\n\t\t * internal identity checks.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync loadWysiwyg() {\n\t\t\tif (this.toastEditor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst [{ default: Editor }] = await Promise.all([\n\t\t\t\t\timport('@toast-ui/editor'),\n\t\t\t\t\timport('@toast-ui/editor/dist/toastui-editor.css'),\n\t\t\t\t])\n\t\t\t\tawait this.$nextTick()\n\t\t\t\tconst el = this.$refs.toastHost\n\t\t\t\tif (!el) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// customHTMLSanitizer does not reach Toast UI's raw HTML\n\t\t\t\t// converters, paste or setHTML; the guarded class routes those\n\t\t\t\t// through DOMPurify 3 as well (see utils/toastUiRawHtmlGuard.js).\n\t\t\t\tconst GuardedEditor = guardedToastUiEditorClass(Editor)\n\t\t\t\tthis.toastEditor = new GuardedEditor({\n\t\t\t\t\tel,\n\t\t\t\t\t...this.wysiwygOptions,\n\t\t\t\t\tinitialValue: this.localValue,\n\t\t\t\t\tpreviewStyle: 'tab',\n\t\t\t\t\theight: this.wysiwygHeight,\n\t\t\t\t\tevents: { change: this.onWysiwygChange },\n\t\t\t\t\t// Replaces the DOMPurify 2.3.3 copy that @toast-ui/editor\n\t\t\t\t\t// inlines into its own bundle (unmaintained since 2023, so\n\t\t\t\t\t// no npm-level fix exists). Same sanitising contract, run\n\t\t\t\t\t// by the maintained DOMPurify 3.x — see the module docs.\n\t\t\t\t\t// Set last so a consumer cannot drop it via wysiwygOptions.\n\t\t\t\t\tcustomHTMLSanitizer: toastUiSanitizer,\n\t\t\t\t})\n\t\t\t\tthis.toastEditorReady = true\n\t\t\t} catch (e) {\n\t\t\t\t// eslint-disable-next-line no-console -- diagnostic for a failure this code already degrades from\n\t\t\t\tconsole.error('CnMarkdownEditor: failed to load the WYSIWYG editor', e)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Toast UI change handler — read the current markdown and emit it via\n\t\t * v-model.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonWysiwygChange() {\n\t\t\tif (!this.toastEditor || typeof this.toastEditor.getMarkdown !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst markdown = this.toastEditor.getMarkdown()\n\t\t\tthis.localValue = markdown\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(markdown)\n\t\t},\n\n\t\t/**\n\t\t * Adopt a value pushed in from outside.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\tonBoundValueChange(next) {\n\t\t\tif (next === this.localValue) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.localValue = next\n\t\t\t// The imperative editor holds its own copy of the document, so an\n\t\t\t// external v-model change has to be pushed into it. Guarded on the\n\t\t\t// current markdown so we don't clobber the caret while the user is\n\t\t\t// typing (our own change handler round-trips here).\n\t\t\tif (this.toastEditor && this.toastEditor.getMarkdown() !== next) {\n\t\t\t\tthis.toastEditor.setMarkdown(next || '')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer the value changed, in both v-model dialects.\n\t\t *\n\t\t * BOTH are emitted, always. A consumer on `@input` and a consumer on\n\t\t * `v-model` are the same consumer as far as this component knows, and\n\t\t * emitting only one silently breaks half of them.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\temitValue(next) {\n\t\t\t/**\n\t\t\t * @event input The value changed. Vue 2's v-model dialect, kept for\n\t\t\t * existing consumers.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * @event update:modelValue The value changed. Vue 3's v-model\n\t\t\t * dialect — what a plain `v-model` listens for.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\n\t\t/**\n\t\t * Textarea input handler — pushes the new value upward via\n\t\t * v-model.\n\t\t *\n\t\t * @param {InputEvent} event The input event.\n\t\t * @return {void}\n\t\t */\n\t\tonInput(event) {\n\t\t\tthis.localValue = event.target.value\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(this.localValue)\n\t\t},\n\n\t\t/**\n\t\t * Keyboard handler. Ctrl/Cmd+B / Ctrl/Cmd+I trigger bold / italic;\n\t\t * Enter continues (or exits) a list; Tab / Shift+Tab indent / dedent a\n\t\t * list item. Anything else falls through to the textarea default.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @return {void}\n\t\t */\n\t\tonKeydown(event) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.ctrlKey || event.metaKey) {\n\t\t\t\tlet toolId = null\n\t\t\t\tif (event.key === 'b' || event.key === 'B') {\n\t\t\t\t\ttoolId = 'bold'\n\t\t\t\t} else if (event.key === 'i' || event.key === 'I') {\n\t\t\t\t\ttoolId = 'italic'\n\t\t\t\t}\n\t\t\t\tif (!toolId) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst tool = this.toolbar.find((t) => t.id === toolId)\n\t\t\t\tif (!tool) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.invokeTool(tool)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.key === 'Enter' && !event.shiftKey) {\n\t\t\t\tthis.handleListEnter(event, ta)\n\t\t\t} else if (event.key === 'Tab') {\n\t\t\t\tthis.handleListTab(event, ta)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Smart Enter inside a list: continue with the next marker (incrementing\n\t\t * ordered / alpha markers), or — when the current item is empty — break\n\t\t * out of the list, leaving a blank line so the user types normally. No-op\n\t\t * (default newline) unless the caret is in a list item's body.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListEnter(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tif (selStart !== ta.selectionEnd) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst lineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst nl = value.indexOf('\\n', selStart)\n\t\t\tconst lineEnd = nl === -1 ? value.length : nl\n\t\t\tconst m = value.slice(lineStart, lineEnd).match(LIST_ITEM_RE)\n\t\t\tif (!m) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [, indent, marker, gap, content] = m\n\t\t\t// Only act once the caret is past the marker (in the item body).\n\t\t\tif (selStart < lineStart + indent.length + marker.length + gap.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tif (content.trim() === '') {\n\t\t\t\t// Empty item → exit the list: drop the marker, leave a blank line.\n\t\t\t\tconst next = `${value.slice(0, lineStart)}${value.slice(lineEnd)}`\n\t\t\t\tthis.applyTextChange(next, lineStart, lineStart)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst insertion = `\\n${indent}${nextListMarker(marker)}${gap}`\n\t\t\tconst next = `${value.slice(0, selStart)}${insertion}${value.slice(selStart)}`\n\t\t\tconst caret = selStart + insertion.length\n\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t},\n\n\t\t/**\n\t\t * Smart Tab inside a list: Tab indents the current line (or every line\n\t\t * spanned by the selection) by one level; Shift+Tab dedents it. Only\n\t\t * hijacks Tab when the caret's line is a list item, so Tab still moves\n\t\t * focus in plain text.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListTab(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tconst selEnd = ta.selectionEnd\n\t\t\tconst firstLineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst firstNl = value.indexOf('\\n', firstLineStart)\n\t\t\tconst firstLineEnd = firstNl === -1 ? value.length : firstNl\n\t\t\tif (!LIST_ITEM_RE.test(value.slice(firstLineStart, firstLineEnd))) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tconst endRef = selEnd > selStart ? selEnd - 1 : selEnd\n\t\t\tconst lastNl = value.indexOf('\\n', endRef)\n\t\t\tconst blockEnd = lastNl === -1 ? value.length : lastNl\n\t\t\tconst lines = value.slice(firstLineStart, blockEnd).split('\\n')\n\t\t\tlet firstDelta = 0\n\t\t\tlet newLines\n\t\t\tif (event.shiftKey) {\n\t\t\t\tnewLines = lines.map((ln, i) => {\n\t\t\t\t\tlet strip = 0\n\t\t\t\t\tif (ln.startsWith('\\t')) {\n\t\t\t\t\t\tstrip = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile (strip < 2 && ln[strip] === ' ') {\n\t\t\t\t\t\t\tstrip++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (i === 0) {\n\t\t\t\t\t\tfirstDelta = -strip\n\t\t\t\t\t}\n\t\t\t\t\treturn ln.slice(strip)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tnewLines = lines.map((ln) => `${LIST_INDENT}${ln}`)\n\t\t\t\tfirstDelta = LIST_INDENT.length\n\t\t\t}\n\t\t\tconst newBlock = newLines.join('\\n')\n\t\t\tconst next = `${value.slice(0, firstLineStart)}${newBlock}${value.slice(blockEnd)}`\n\t\t\tif (selStart === selEnd) {\n\t\t\t\tconst caret = Math.max(firstLineStart, selStart + firstDelta)\n\t\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t\t} else {\n\t\t\t\tthis.applyTextChange(next, firstLineStart, firstLineStart + newBlock.length)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Commit a programmatic edit: update the model, emit `input`, then\n\t\t * restore focus + selection on the next tick.\n\t\t *\n\t\t * @param {string} next The new textarea value.\n\t\t * @param {number} selStart The caret/selection start to restore.\n\t\t * @param {number} selEnd The selection end to restore.\n\t\t * @return {void}\n\t\t */\n\t\tapplyTextChange(next, selStart, selEnd) {\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst ta = this.$refs.textarea\n\t\t\t\tif (!ta) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(selStart, selEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Cycle the layout mode `edit → split → preview → edit`.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcycleMode() {\n\t\t\tconst idx = MODES.indexOf(this.mode)\n\t\t\tconst next = MODES[(idx + 1) % MODES.length]\n\t\t\t/**\n\t\t\t * @event update:mode v-model:mode emit so consumers can bind the layout mode.\n\t\t\t * @type {'edit'|'split'|'preview'}\n\t\t\t */\n\t\t\tthis.$emit('update:mode', next)\n\t\t},\n\n\t\t/**\n\t\t * Apply a toolbar action — either prefix the current line\n\t\t * (`linePrefix: true`) or wrap the current selection.\n\t\t *\n\t\t * @param {object} tool The toolbar entry.\n\t\t * @return {void}\n\t\t */\n\t\tinvokeTool(tool) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst selected = this.localValue.slice(ta.selectionStart, ta.selectionEnd)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\n\t\t\tlet nextValue\n\t\t\tlet nextSelStart\n\t\t\tlet nextSelEnd\n\t\t\tif (tool.linePrefix) {\n\t\t\t\t// Line-prefix mode (headings, list, quote): toggle/replace the\n\t\t\t\t// marker on the current line rather than stacking it. Operates on\n\t\t\t\t// the whole line under the caret, ignoring any selection.\n\t\t\t\tconst lineStart = before.lastIndexOf('\\n') + 1\n\t\t\t\tconst afterNl = after.indexOf('\\n')\n\t\t\t\tconst lineEnd = afterNl === -1 ? this.localValue.length : ta.selectionEnd + afterNl\n\t\t\t\tconst head = this.localValue.slice(0, lineStart)\n\t\t\t\tconst line = this.localValue.slice(lineStart, lineEnd)\n\t\t\t\tconst tail = this.localValue.slice(lineEnd)\n\n\t\t\t\t// Strip an existing recognised marker (heading #…, list -/*, quote >)\n\t\t\t\t// so switching one for another REPLACES it (e.g. `# ` → `## `, never\n\t\t\t\t// `## #`); re-applying the same marker toggles it off.\n\t\t\t\tconst existing = (line.match(/^(#{1,6} |[-*] |> )/) || [''])[0]\n\t\t\t\tconst body = line.slice(existing.length)\n\t\t\t\tconst newLine = existing === tool.prefix ? body : `${tool.prefix}${body}`\n\n\t\t\t\tnextValue = `${head}${newLine}${tail}`\n\t\t\t\t// Keep the caret/selection in the body, shifted by the marker delta.\n\t\t\t\tconst delta = newLine.length - line.length\n\t\t\t\tconst min = lineStart\n\t\t\t\tconst max = lineStart + newLine.length\n\t\t\t\tnextSelStart = Math.min(Math.max(ta.selectionStart + delta, min), max)\n\t\t\t\tnextSelEnd = Math.min(Math.max(ta.selectionEnd + delta, min), max)\n\t\t\t} else {\n\t\t\t\t// Wrap mode (bold/italic/link/code): toggle. If the selection is\n\t\t\t\t// already wrapped in this tool's delimiters — either they're part\n\t\t\t\t// of the selection, or they sit around it — strip them; otherwise\n\t\t\t\t// add them. Stops `**`/`_` from stacking on repeat presses.\n\t\t\t\tconst p = tool.prefix\n\t\t\t\tconst s = tool.suffix || ''\n\t\t\t\tconst wrappedInside = selected.length >= p.length + s.length\n\t\t\t\t\t&& selected.startsWith(p)\n\t\t\t\t\t&& selected.endsWith(s)\n\n\t\t\t\t// Not just the delimiters immediately against the selection: read\n\t\t\t\t// the whole run on each side, so this tool's pair is still found\n\t\t\t\t// with another tool's nested inside it. Toggling bold on\n\t\t\t\t// `**_text_**` has to see the `**` through the `_`, or alternating\n\t\t\t\t// bold and italic stacks markers forever instead of toggling.\n\t\t\t\tconst markers = this.wrapMarkers\n\t\t\t\tconst leftRun = s === '' ? [] : peelMarkers(before, markers, true)\n\t\t\t\tconst rightRun = s === '' ? [] : peelMarkers(after, markers, false)\n\t\t\t\t// Same depth on both sides: that is what makes them a pair.\n\t\t\t\tconst depth = leftRun.findIndex((m, i) => m === p && rightRun[i] === s)\n\n\t\t\t\tif (wrappedInside) {\n\t\t\t\t\tconst inner = selected.slice(p.length, selected.length - s.length)\n\t\t\t\t\tnextValue = `${before}${inner}${after}`\n\t\t\t\t\tnextSelStart = before.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t} else if (depth !== -1) {\n\t\t\t\t\t// Selection is the inner text; drop this tool's pair and leave\n\t\t\t\t\t// every marker nested inside it where it is.\n\t\t\t\t\tconst pStart = before.length\n\t\t\t\t\t\t- leftRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\t\t- p.length\n\t\t\t\t\tconst sStart = rightRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\tnextValue = before.slice(0, pStart)\n\t\t\t\t\t\t+ before.slice(pStart + p.length)\n\t\t\t\t\t\t+ selected\n\t\t\t\t\t\t+ after.slice(0, sStart)\n\t\t\t\t\t\t+ after.slice(sStart + s.length)\n\t\t\t\t\tnextSelStart = before.length - p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + selected.length\n\t\t\t\t} else {\n\t\t\t\t\tconst inner = selected || tool.placeholder || ''\n\t\t\t\t\tconst insertion = `${p}${inner}${s}`\n\t\t\t\t\tnextValue = `${before}${insertion}${after}`\n\t\t\t\t\tnextSelStart = before.length + p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.localValue = nextValue\n\t\t\tthis.emitValue(nextValue)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(nextSelStart, nextSelEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Programmatic insert helper — exposed publicly so parents\n\t\t * can drop content at the caret (e.g. from a file-picker\n\t\t * callback inserting a `` reference).\n\t\t *\n\t\t * @param {string} text The text to insert at the caret.\n\t\t * @return {void}\n\t\t */\n\t\tinsertAtCaret(text) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\tthis.localValue += text\n\t\t\t\tthis.emitValue(this.localValue)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\t\t\tconst next = `${before}${text}${after}`\n\t\t\tconst caret = before.length + text.length\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(caret, caret)\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-markdown-editor {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-main-background);\n\toverflow: hidden;\n}\n\n.cn-markdown-editor__toolbar {\n\tdisplay: flex;\n\tgap: 4px;\n\tpadding: 6px;\n\tborder-bottom: 1px solid var(--color-border);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-markdown-editor__tool {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 4px 8px;\n\tcursor: pointer;\n\tfont-family: monospace;\n\tmin-width: 28px;\n}\n\n.cn-markdown-editor__tool:hover {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n}\n\n.cn-markdown-editor__spacer {\n\tflex: 1 1 auto;\n}\n\n.cn-markdown-editor__panes {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"split\"] {\n\tgrid-template-columns: 1fr 1fr;\n}\n\n.cn-markdown-editor__textarea {\n\tborder: none;\n\toutline: none;\n\tpadding: 10px 12px;\n\tfont-family: monospace;\n\tfont-size: 0.95em;\n\tresize: vertical;\n\twidth: 100%;\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\t/* Nested list indents are single tabs (see LIST_INDENT); render them\n\t compactly rather than the 8-char browser default. */\n\ttab-size: 2;\n\t-moz-tab-size: 2;\n}\n\n.cn-markdown-editor__preview {\n\tpadding: 10px 14px;\n\tborder-left: 1px solid var(--color-border);\n\tbackground: var(--color-main-background);\n\toverflow-y: auto;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"preview\"] .cn-markdown-editor__preview {\n\tborder-left: none;\n}\n\n.cn-markdown-editor__hint {\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 0 10px 8px;\n}\n\n/* WYSIWYG (Toast UI) mode — themed with Nextcloud CSS variables. */\n.cn-markdown-editor__wysiwyg {\n\twidth: 100%;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-defaultUI) {\n\tfont-family: var(--font-face) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar) {\n\tbackground-color: var(--color-background-hover) !important;\n\tborder-bottom: 1px solid var(--color-border-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: transparent !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button:hover) {\n\tbackground-color: var(--color-background-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-contents),\n.cn-markdown-editor__wysiwyg :deep(.ProseMirror) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tfont-family: var(--font-face) !important;\n}\n</style>\n"],"names":["t"],"mappings":";;;;;AAiEA;;AAEC;AACA;AACA;;AAED,MAAM,eAAgB,GAAE,MAAM,CAAC,MAAM,CAAC;AACrC,CAAA,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB;AACrG,CAAA,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB;CACzG,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,IAAG,EAAG;CACnH,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,IAAG,EAAG;AACpH,CAAA,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ;AAC1G,CAAA,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe;AACr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AAC,cAAc,EAAA;GACzD,MAAM,KAAM,GAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,EAAA;AACnD,GAAA,MAAM,IAAK,GAAE,CAAC,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,EAAA;AACtC,GAAA,MAAM,KAAI,GAAI,MAAM,CAAC,SAAS,IAAI,CAAC,OAAK;AACxC,GAAA,IAAI,CAAC,aAAa,KAAG;AACrB,GAAA,IAAI,CAAC,SAAS,CAAC,IAAI,EAAA;AACnB,GAAA,IAAI,CAAC,SAAS,CAAC,MAAM;AACpB,IAAA,EAAE,CAAC,KAAK,GAAC;AACT,IAAA,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAA;IACjC,EAAA;GACD;EACD;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnMarkdownEditor.vue3.js","sources":["../../../../src/components/CnMarkdownEditor/CnMarkdownEditor.vue?vue&type=template&id=dca1d078&lang.js"],"sourcesContent":["<template>\n\t<div class=\"cn-markdown-editor\" data-testid=\"cn-markdown-editor\" :class=\"modeClass\">\n\t\t<!-- Toolbar with formatting shortcuts (textarea modes only; WYSIWYG has its own). -->\n\t\t<div v-if=\"!hideToolbar && mode !== 'wysiwyg'\" class=\"cn-markdown-editor__toolbar\" role=\"toolbar\">\n\t\t\t<button v-for=\"tool in toolbar\"\n\t\t\t\t:key=\"tool.id\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool\"\n\t\t\t\t:title=\"tool.tooltip || tool.label\"\n\t\t\t\t:data-testid=\"'tool-' + tool.id\"\n\t\t\t\t@click=\"invokeTool(tool)\">\n\t\t\t\t<span>{{ tool.label }}</span>\n\t\t\t</button>\n\t\t\t<span class=\"cn-markdown-editor__spacer\" />\n\t\t\t<button v-if=\"!hideModeSwitch\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool cn-markdown-editor__mode-switch\"\n\t\t\t\t:title=\"modeSwitchTooltip\"\n\t\t\t\tdata-testid=\"mode-switch\"\n\t\t\t\t@click=\"cycleMode\">\n\t\t\t\t{{ currentModeLabel }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<!-- Pane layout: edit / preview / split (textarea + rendered preview). -->\n\t\t<div v-if=\"mode !== 'wysiwyg'\" class=\"cn-markdown-editor__panes\" :data-mode=\"mode\">\n\t\t\t<textarea v-if=\"mode !== 'preview'\"\n\t\t\t\tref=\"textarea\"\n\t\t\t\tclass=\"cn-markdown-editor__textarea\"\n\t\t\t\t:value=\"localValue\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:aria-label=\"ariaLabel\"\n\t\t\t\tdata-testid=\"cn-markdown-textarea\"\n\t\t\t\t@input=\"onInput\"\n\t\t\t\t@keydown=\"onKeydown\" />\n\t\t\t<div v-if=\"mode !== 'edit'\"\n\t\t\t\tclass=\"cn-markdown-editor__preview\"\n\t\t\t\tdata-testid=\"cn-markdown-preview\"\n\t\t\t\tv-html=\"renderedHtml\" /><!-- eslint-disable-line vue/no-v-html -- renderedHtml comes from cnRenderMarkdown(), which sanitises through DOMPurify -->\n\t\t</div>\n\n\t\t<!-- WYSIWYG mode: lazily-instantiated Toast UI editor. The editor is\n\t\t driven imperatively against `toastHost` rather than through a Vue\n\t\t wrapper component — `@toast-ui/vue-editor` is Vue-2 only, so the\n\t\t Vue-3 line uses the framework-agnostic `@toast-ui/editor` API. -->\n\t\t<div v-else class=\"cn-markdown-editor__wysiwyg\" data-testid=\"cn-markdown-wysiwyg\">\n\t\t\t<div v-show=\"toastEditorReady\" ref=\"toastHost\" />\n\t\t\t<p v-if=\"!toastEditorReady\" class=\"cn-markdown-editor__hint\">\n\t\t\t\t{{ t('nextcloud-vue', 'Loading editor…') }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<!-- Hint row. -->\n\t\t<small v-if=\"hint\" class=\"cn-markdown-editor__hint\">{{ hint }}</small>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { cnRenderMarkdown } from '../../composables/cnRenderMarkdown.js'\nimport { toastUiSanitizer } from '../../utils/toastUiSanitizer.js'\n\n/**\n * Default formatting toolbar — Markdown insertions that wrap a\n * selection or insert a placeholder.\n *\n * @type {Array<{id:string,label:string,prefix:string,suffix?:string,placeholder?:string}>}\n */\nconst DEFAULT_TOOLBAR = Object.freeze([\n\t{ id: 'bold', label: 'B', prefix: '**', suffix: '**', placeholder: 'bold', tooltip: 'Bold (Ctrl+B)' },\n\t{ id: 'italic', label: 'I', prefix: '_', suffix: '_', placeholder: 'italic', tooltip: 'Italic (Ctrl+I)' },\n\t{ id: 'h1', label: 'H1', prefix: '# ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 1', linePrefix: true },\n\t{ id: 'h2', label: 'H2', prefix: '## ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 2', linePrefix: true },\n\t{ id: 'link', label: '🔗', prefix: '[', suffix: '](https://)', placeholder: 'link text', tooltip: 'Link' },\n\t{ id: 'code', label: '`</>`', prefix: '`', suffix: '`', placeholder: 'code', tooltip: 'Inline code' },\n\t{ id: 'list', label: '•', prefix: '- ', suffix: '', placeholder: 'item', tooltip: 'List', linePrefix: true },\n\t{ id: 'quote', label: '“”', prefix: '> ', suffix: '', placeholder: 'quote', tooltip: 'Quote', linePrefix: true },\n])\n\nconst MODES = ['edit', 'split', 'preview', 'wysiwyg']\n\n/**\n * Matches a list item at the start of a line: leading indentation, a bullet\n * (`-`/`*`/`+`) or ordered marker (`1.`/`1)`), the whitespace after it, then the\n * item body. Drives the smart Enter / Tab list handling. Only the markers\n * CommonMark actually renders as lists are recognised (no `a.`/`A)` alpha\n * markers — Markdown renders those as plain text).\n *\n * @type {RegExp}\n */\nconst LIST_ITEM_RE = /^([ \\t]*)([-*+]|\\d+[.)])([ \\t]+)(.*)$/\n\n/** One indent step for nesting list items (a tab; textarea uses `tab-size: 2`). */\nconst LIST_INDENT = '\\t'\n\n/**\n * The marker that continues a list after `marker`: unordered bullets repeat;\n * numeric markers increment (`1.`→`2.`, `1)`→`2)`) keeping the `.`/`)` delimiter.\n *\n * @param {string} marker The current line's list marker (e.g. `-`, `1.`).\n * @return {string} The next item's marker.\n */\nfunction nextListMarker(marker) {\n\tconst ordered = marker.match(/^(\\d+)([.)])$/)\n\tif (!ordered) {\n\t\treturn marker\n\t}\n\treturn `${parseInt(ordered[1], 10) + 1}${ordered[2]}`\n}\n\n/**\n * Read off the run of wrap markers sitting against one edge of the selection,\n * innermost first. `**_` to the left of the caret yields `['_', '**']`.\n *\n * `markers` must be ordered longest-first so `**` is never read as two `*`.\n *\n * @param {string} text The text on that side of the selection.\n * @param {string[]} markers Known wrap delimiters, longest first.\n * @param {boolean} fromEnd Scan backwards from the end (the text BEFORE the\n * selection) rather than forwards from the start (the text AFTER it).\n * @return {string[]} The markers found, innermost first.\n */\nfunction peelMarkers(text, markers, fromEnd) {\n\tconst found = []\n\tlet rest = text\n\tconst nextMarker = () => markers.find((m) => m !== '' && (fromEnd ? rest.endsWith(m) : rest.startsWith(m)))\n\tfor (let hit = nextMarker(); hit; hit = nextMarker()) {\n\t\tfound.push(hit)\n\t\trest = fromEnd ? rest.slice(0, rest.length - hit.length) : rest.slice(hit.length)\n\t}\n\treturn found\n}\n\n/**\n * Default Toast UI WYSIWYG toolbar layout — used only in `mode: 'wysiwyg'`.\n *\n * @type {Array<Array<string>>}\n */\nconst DEFAULT_WYSIWYG_TOOLBAR = Object.freeze([\n\t['heading', 'bold', 'italic', 'strike'],\n\t['hr', 'quote'],\n\t['ul', 'ol', 'task', 'indent', 'outdent'],\n\t['table', 'image', 'link'],\n\t['code', 'codeblock'],\n])\n\n/**\n * CnMarkdownEditor — Markdown editor with a textarea + live HTML\n * preview, a formatting toolbar, and four layout modes (edit /\n * split / preview / wysiwyg).\n *\n * The default path is a `<textarea>` + `cnRenderMarkdown` preview.\n * Setting `mode: 'wysiwyg'` opts into a rich Toast UI WYSIWYG editor\n * that is **lazily loaded** only when that mode is active — the\n * textarea modes carry no editor dependency. The `v-model` contract\n * is identical across all modes (`value` in, `input` out).\n *\n * ```vue\n * <CnMarkdownEditor v-model=\"article\" placeholder=\"Write your article …\" />\n * <CnMarkdownEditor v-model=\"article\" mode=\"wysiwyg\" />\n * ```\n *\n * Toolbar buttons either wrap the current selection or insert a\n * placeholder (`bold` / `italic` / `link` / `code`) OR prefix the\n * current line (`h1` / `h2` / `list` / `quote`). The `toolbar`\n * prop lets consumers replace the default set.\n */\nexport default {\n\tname: 'CnMarkdownEditor',\n\tprops: {\n\t\t/**\n\t\t * Markdown source (v-model).\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tvalue: { type: String, default: '' },\n\t\t/**\n\t\t * Markdown source, Vue 3's own v-model prop.\n\t\t *\n\t\t * ⚠️ WITHOUT THIS, `v-model` ON THIS COMPONENT DOES NOTHING. Vue 3\n\t\t * compiles `v-model=\"x\"` to `:modelValue` + `@update:modelValue`, so a\n\t\t * component that only declares `value`/`input` never receives the prop\n\t\t * and its emit is never heard — silently, with no warning, looking\n\t\t * exactly like a component that works.\n\t\t *\n\t\t * `value` is kept as the public name (consumers depend on it) and both\n\t\t * are accepted. `undefined` rather than `''` as the default is what\n\t\t * distinguishes \"not passed\" from \"passed as empty\".\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tmodelValue: { type: String, default: undefined },\n\t\t/**\n\t\t * Layout mode. `edit` shows only the textarea, `preview`\n\t\t * shows only the rendered HTML, `split` shows both\n\t\t * side-by-side.\n\t\t *\n\t\t * @type {'edit'|'split'|'preview'}\n\t\t */\n\t\tmode: {\n\t\t\ttype: String,\n\t\t\tdefault: 'split',\n\t\t\tvalidator: (v) => MODES.includes(v),\n\t\t},\n\n\t\t/** Placeholder for the textarea. */\n\t\tplaceholder: { type: String, default: 'Write Markdown…' },\n\t\t/** Aria-label for the textarea. */\n\t\tariaLabel: { type: String, default: 'Markdown editor input' },\n\t\t/** Minimum textarea rows. */\n\t\trows: { type: Number, default: 10 },\n\t\t/** Disable the textarea (still renders the preview). */\n\t\tdisabled: { type: Boolean, default: false },\n\t\t/** Hide the formatting toolbar entirely. */\n\t\thideToolbar: { type: Boolean, default: false },\n\t\t/** Hide the mode-switch button on the toolbar. */\n\t\thideModeSwitch: { type: Boolean, default: false },\n\t\t/** Mode-switch tooltip. */\n\t\tmodeSwitchTooltip: { type: String, default: 'Cycle layout (edit / split / preview)' },\n\t\t/**\n\t\t * Custom toolbar entries. Each entry: `{id, label, prefix,\n\t\t * suffix?, placeholder?, tooltip?, linePrefix?}`. When\n\t\t * `linePrefix: true` the prefix is inserted at the start\n\t\t * of the current line instead of wrapping the selection.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\ttoolbar: { type: Array, default: () => DEFAULT_TOOLBAR.slice() },\n\t\t/** Optional helper text rendered under the editor. */\n\t\thint: { type: String, default: '' },\n\t\t/**\n\t\t * WYSIWYG mode only: Toast UI toolbar layout (array of button groups).\n\t\t * Ignored in the textarea modes.\n\t\t *\n\t\t * @type {Array<Array<string>>}\n\t\t */\n\t\twysiwygToolbar: { type: Array, default: () => DEFAULT_WYSIWYG_TOOLBAR.map((g) => g.slice()) },\n\t\t/** WYSIWYG mode only: editor height (any CSS length). */\n\t\twysiwygHeight: { type: String, default: '300px' },\n\t},\n\n\t// Declaring the emitted events is not cosmetic under Vue 3: an UNdeclared\n\t// event name also stays in `$attrs` and falls through to the root element,\n\t// so the NATIVE `input` event the `<textarea>` bubbles up is re-emitted by\n\t// the component as its own `input` — after the component's own\n\t// `$emit('input', value)` — and listeners receive the raw InputEvent\n\t// instead of the string.\n\temits: ['input', 'update:modelValue', 'update:mode'],\n\tdata() {\n\t\treturn {\n\t\t\tlocalValue: (this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t\t// Whether the lazily-created Toast UI editor instance is live\n\t\t\t// (WYSIWYG mode only). Drives the loading hint.\n\t\t\ttoastEditorReady: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * BEM modifier for the current layout mode.\n\t\t *\n\t\t * @return {string} The class.\n\t\t */\n\t\tmodeClass() {\n\t\t\treturn `cn-markdown-editor--${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Every wrap delimiter the active toolbar can produce, longest first.\n\t\t * Toggling has to recognise the OTHER tools' markers, not just its own,\n\t\t * or alternating bold and italic stacks instead of toggling.\n\t\t *\n\t\t * @return {string[]} The delimiters, longest first.\n\t\t */\n\t\twrapMarkers() {\n\t\t\tconst out = new Set()\n\t\t\tfor (const tool of this.toolbar) {\n\t\t\t\tif (tool.linePrefix || !tool.suffix) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tout.add(tool.prefix)\n\t\t\t\tout.add(tool.suffix)\n\t\t\t}\n\t\t\treturn [...out].sort((a, b) => b.length - a.length)\n\t\t},\n\n\t\t/**\n\t\t * The value the consumer actually bound, whichever prop they used.\n\t\t *\n\t\t * @return {string} The markdown source.\n\t\t */\n\t\tboundValue() {\n\t\t\treturn this.modelValue !== undefined ? this.modelValue : this.value\n\t\t},\n\n\t\t/**\n\t\t * Rendered HTML for the preview pane. Uses\n\t\t * `cnRenderMarkdown` so the output goes through the lib's\n\t\t * sanitised pipeline.\n\t\t *\n\t\t * @return {string} The rendered HTML.\n\t\t */\n\t\trenderedHtml() {\n\t\t\treturn cnRenderMarkdown(this.localValue || '')\n\t\t},\n\n\t\t/**\n\t\t * Label for the mode-switch button (shows the NEXT mode).\n\t\t *\n\t\t * @return {string} The label.\n\t\t */\n\t\tcurrentModeLabel() {\n\t\t\treturn `▦ ${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Toast UI editor options (WYSIWYG mode) — the configured toolbar plus\n\t\t * fixed WYSIWYG defaults.\n\t\t *\n\t\t * @return {object} The Toast UI options object.\n\t\t */\n\t\twysiwygOptions() {\n\t\t\treturn {\n\t\t\t\tminHeight: '200px',\n\t\t\t\tlanguage: 'en-US',\n\t\t\t\thideModeSwitch: true,\n\t\t\t\ttoolbarItems: this.wysiwygToolbar,\n\t\t\t\tinitialEditType: 'wysiwyg',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\t// Both spellings watched, because either may be the one the consumer\n\t\t// bound. `boundValue` collapses them so the body is written once.\n\t\tmodelValue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tvalue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tmode(next) {\n\t\t\tif (next === 'wysiwyg') {\n\t\t\t\tthis.loadWysiwyg()\n\t\t\t}\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.mode === 'wysiwyg') {\n\t\t\tthis.loadWysiwyg()\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\t// The editor is created imperatively, so Vue will not tear it down.\n\t\tif (this.toastEditor && typeof this.toastEditor.destroy === 'function') {\n\t\t\tthis.toastEditor.destroy()\n\t\t}\n\t\tthis.toastEditor = null\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Lazily import and instantiate the Toast UI editor (and its CSS) the\n\t\t * first time WYSIWYG mode is entered. Keeps the ~200 KB editor out of\n\t\t * the default textarea path.\n\t\t *\n\t\t * Uses the framework-agnostic `@toast-ui/editor` constructor rather\n\t\t * than a Vue wrapper: `@toast-ui/vue-editor` is published for Vue 2\n\t\t * only and has no Vue-3 build. The instance is held as a plain (NON\n\t\t * reactive) instance property — putting a third-party class instance\n\t\t * in `data()` would wrap it in Vue 3's reactive proxy and break its\n\t\t * internal identity checks.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync loadWysiwyg() {\n\t\t\tif (this.toastEditor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst [{ default: Editor }] = await Promise.all([\n\t\t\t\t\timport('@toast-ui/editor'),\n\t\t\t\t\timport('@toast-ui/editor/dist/toastui-editor.css'),\n\t\t\t\t])\n\t\t\t\tawait this.$nextTick()\n\t\t\t\tconst el = this.$refs.toastHost\n\t\t\t\tif (!el) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.toastEditor = new Editor({\n\t\t\t\t\tel,\n\t\t\t\t\t...this.wysiwygOptions,\n\t\t\t\t\tinitialValue: this.localValue,\n\t\t\t\t\tpreviewStyle: 'tab',\n\t\t\t\t\theight: this.wysiwygHeight,\n\t\t\t\t\tevents: { change: this.onWysiwygChange },\n\t\t\t\t\t// Replaces the DOMPurify 2.3.3 copy that @toast-ui/editor\n\t\t\t\t\t// inlines into its own bundle (unmaintained since 2023, so\n\t\t\t\t\t// no npm-level fix exists). Same sanitising contract, run\n\t\t\t\t\t// by the maintained DOMPurify 3.x — see the module docs.\n\t\t\t\t\t// Set last so a consumer cannot drop it via wysiwygOptions.\n\t\t\t\t\tcustomHTMLSanitizer: toastUiSanitizer,\n\t\t\t\t})\n\t\t\t\tthis.toastEditorReady = true\n\t\t\t} catch (e) {\n\t\t\t\t// eslint-disable-next-line no-console -- diagnostic for a failure this code already degrades from\n\t\t\t\tconsole.error('CnMarkdownEditor: failed to load the WYSIWYG editor', e)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Toast UI change handler — read the current markdown and emit it via\n\t\t * v-model.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonWysiwygChange() {\n\t\t\tif (!this.toastEditor || typeof this.toastEditor.getMarkdown !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst markdown = this.toastEditor.getMarkdown()\n\t\t\tthis.localValue = markdown\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(markdown)\n\t\t},\n\n\t\t/**\n\t\t * Adopt a value pushed in from outside.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\tonBoundValueChange(next) {\n\t\t\tif (next === this.localValue) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.localValue = next\n\t\t\t// The imperative editor holds its own copy of the document, so an\n\t\t\t// external v-model change has to be pushed into it. Guarded on the\n\t\t\t// current markdown so we don't clobber the caret while the user is\n\t\t\t// typing (our own change handler round-trips here).\n\t\t\tif (this.toastEditor && this.toastEditor.getMarkdown() !== next) {\n\t\t\t\tthis.toastEditor.setMarkdown(next || '')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer the value changed, in both v-model dialects.\n\t\t *\n\t\t * BOTH are emitted, always. A consumer on `@input` and a consumer on\n\t\t * `v-model` are the same consumer as far as this component knows, and\n\t\t * emitting only one silently breaks half of them.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\temitValue(next) {\n\t\t\t/**\n\t\t\t * @event input The value changed. Vue 2's v-model dialect, kept for\n\t\t\t * existing consumers.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * @event update:modelValue The value changed. Vue 3's v-model\n\t\t\t * dialect — what a plain `v-model` listens for.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\n\t\t/**\n\t\t * Textarea input handler — pushes the new value upward via\n\t\t * v-model.\n\t\t *\n\t\t * @param {InputEvent} event The input event.\n\t\t * @return {void}\n\t\t */\n\t\tonInput(event) {\n\t\t\tthis.localValue = event.target.value\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(this.localValue)\n\t\t},\n\n\t\t/**\n\t\t * Keyboard handler. Ctrl/Cmd+B / Ctrl/Cmd+I trigger bold / italic;\n\t\t * Enter continues (or exits) a list; Tab / Shift+Tab indent / dedent a\n\t\t * list item. Anything else falls through to the textarea default.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @return {void}\n\t\t */\n\t\tonKeydown(event) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.ctrlKey || event.metaKey) {\n\t\t\t\tlet toolId = null\n\t\t\t\tif (event.key === 'b' || event.key === 'B') {\n\t\t\t\t\ttoolId = 'bold'\n\t\t\t\t} else if (event.key === 'i' || event.key === 'I') {\n\t\t\t\t\ttoolId = 'italic'\n\t\t\t\t}\n\t\t\t\tif (!toolId) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst tool = this.toolbar.find((t) => t.id === toolId)\n\t\t\t\tif (!tool) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.invokeTool(tool)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.key === 'Enter' && !event.shiftKey) {\n\t\t\t\tthis.handleListEnter(event, ta)\n\t\t\t} else if (event.key === 'Tab') {\n\t\t\t\tthis.handleListTab(event, ta)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Smart Enter inside a list: continue with the next marker (incrementing\n\t\t * ordered / alpha markers), or — when the current item is empty — break\n\t\t * out of the list, leaving a blank line so the user types normally. No-op\n\t\t * (default newline) unless the caret is in a list item's body.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListEnter(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tif (selStart !== ta.selectionEnd) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst lineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst nl = value.indexOf('\\n', selStart)\n\t\t\tconst lineEnd = nl === -1 ? value.length : nl\n\t\t\tconst m = value.slice(lineStart, lineEnd).match(LIST_ITEM_RE)\n\t\t\tif (!m) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [, indent, marker, gap, content] = m\n\t\t\t// Only act once the caret is past the marker (in the item body).\n\t\t\tif (selStart < lineStart + indent.length + marker.length + gap.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tif (content.trim() === '') {\n\t\t\t\t// Empty item → exit the list: drop the marker, leave a blank line.\n\t\t\t\tconst next = `${value.slice(0, lineStart)}${value.slice(lineEnd)}`\n\t\t\t\tthis.applyTextChange(next, lineStart, lineStart)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst insertion = `\\n${indent}${nextListMarker(marker)}${gap}`\n\t\t\tconst next = `${value.slice(0, selStart)}${insertion}${value.slice(selStart)}`\n\t\t\tconst caret = selStart + insertion.length\n\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t},\n\n\t\t/**\n\t\t * Smart Tab inside a list: Tab indents the current line (or every line\n\t\t * spanned by the selection) by one level; Shift+Tab dedents it. Only\n\t\t * hijacks Tab when the caret's line is a list item, so Tab still moves\n\t\t * focus in plain text.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListTab(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tconst selEnd = ta.selectionEnd\n\t\t\tconst firstLineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst firstNl = value.indexOf('\\n', firstLineStart)\n\t\t\tconst firstLineEnd = firstNl === -1 ? value.length : firstNl\n\t\t\tif (!LIST_ITEM_RE.test(value.slice(firstLineStart, firstLineEnd))) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tconst endRef = selEnd > selStart ? selEnd - 1 : selEnd\n\t\t\tconst lastNl = value.indexOf('\\n', endRef)\n\t\t\tconst blockEnd = lastNl === -1 ? value.length : lastNl\n\t\t\tconst lines = value.slice(firstLineStart, blockEnd).split('\\n')\n\t\t\tlet firstDelta = 0\n\t\t\tlet newLines\n\t\t\tif (event.shiftKey) {\n\t\t\t\tnewLines = lines.map((ln, i) => {\n\t\t\t\t\tlet strip = 0\n\t\t\t\t\tif (ln.startsWith('\\t')) {\n\t\t\t\t\t\tstrip = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile (strip < 2 && ln[strip] === ' ') {\n\t\t\t\t\t\t\tstrip++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (i === 0) {\n\t\t\t\t\t\tfirstDelta = -strip\n\t\t\t\t\t}\n\t\t\t\t\treturn ln.slice(strip)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tnewLines = lines.map((ln) => `${LIST_INDENT}${ln}`)\n\t\t\t\tfirstDelta = LIST_INDENT.length\n\t\t\t}\n\t\t\tconst newBlock = newLines.join('\\n')\n\t\t\tconst next = `${value.slice(0, firstLineStart)}${newBlock}${value.slice(blockEnd)}`\n\t\t\tif (selStart === selEnd) {\n\t\t\t\tconst caret = Math.max(firstLineStart, selStart + firstDelta)\n\t\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t\t} else {\n\t\t\t\tthis.applyTextChange(next, firstLineStart, firstLineStart + newBlock.length)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Commit a programmatic edit: update the model, emit `input`, then\n\t\t * restore focus + selection on the next tick.\n\t\t *\n\t\t * @param {string} next The new textarea value.\n\t\t * @param {number} selStart The caret/selection start to restore.\n\t\t * @param {number} selEnd The selection end to restore.\n\t\t * @return {void}\n\t\t */\n\t\tapplyTextChange(next, selStart, selEnd) {\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst ta = this.$refs.textarea\n\t\t\t\tif (!ta) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(selStart, selEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Cycle the layout mode `edit → split → preview → edit`.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcycleMode() {\n\t\t\tconst idx = MODES.indexOf(this.mode)\n\t\t\tconst next = MODES[(idx + 1) % MODES.length]\n\t\t\t/**\n\t\t\t * @event update:mode v-model:mode emit so consumers can bind the layout mode.\n\t\t\t * @type {'edit'|'split'|'preview'}\n\t\t\t */\n\t\t\tthis.$emit('update:mode', next)\n\t\t},\n\n\t\t/**\n\t\t * Apply a toolbar action — either prefix the current line\n\t\t * (`linePrefix: true`) or wrap the current selection.\n\t\t *\n\t\t * @param {object} tool The toolbar entry.\n\t\t * @return {void}\n\t\t */\n\t\tinvokeTool(tool) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst selected = this.localValue.slice(ta.selectionStart, ta.selectionEnd)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\n\t\t\tlet nextValue\n\t\t\tlet nextSelStart\n\t\t\tlet nextSelEnd\n\t\t\tif (tool.linePrefix) {\n\t\t\t\t// Line-prefix mode (headings, list, quote): toggle/replace the\n\t\t\t\t// marker on the current line rather than stacking it. Operates on\n\t\t\t\t// the whole line under the caret, ignoring any selection.\n\t\t\t\tconst lineStart = before.lastIndexOf('\\n') + 1\n\t\t\t\tconst afterNl = after.indexOf('\\n')\n\t\t\t\tconst lineEnd = afterNl === -1 ? this.localValue.length : ta.selectionEnd + afterNl\n\t\t\t\tconst head = this.localValue.slice(0, lineStart)\n\t\t\t\tconst line = this.localValue.slice(lineStart, lineEnd)\n\t\t\t\tconst tail = this.localValue.slice(lineEnd)\n\n\t\t\t\t// Strip an existing recognised marker (heading #…, list -/*, quote >)\n\t\t\t\t// so switching one for another REPLACES it (e.g. `# ` → `## `, never\n\t\t\t\t// `## #`); re-applying the same marker toggles it off.\n\t\t\t\tconst existing = (line.match(/^(#{1,6} |[-*] |> )/) || [''])[0]\n\t\t\t\tconst body = line.slice(existing.length)\n\t\t\t\tconst newLine = existing === tool.prefix ? body : `${tool.prefix}${body}`\n\n\t\t\t\tnextValue = `${head}${newLine}${tail}`\n\t\t\t\t// Keep the caret/selection in the body, shifted by the marker delta.\n\t\t\t\tconst delta = newLine.length - line.length\n\t\t\t\tconst min = lineStart\n\t\t\t\tconst max = lineStart + newLine.length\n\t\t\t\tnextSelStart = Math.min(Math.max(ta.selectionStart + delta, min), max)\n\t\t\t\tnextSelEnd = Math.min(Math.max(ta.selectionEnd + delta, min), max)\n\t\t\t} else {\n\t\t\t\t// Wrap mode (bold/italic/link/code): toggle. If the selection is\n\t\t\t\t// already wrapped in this tool's delimiters — either they're part\n\t\t\t\t// of the selection, or they sit around it — strip them; otherwise\n\t\t\t\t// add them. Stops `**`/`_` from stacking on repeat presses.\n\t\t\t\tconst p = tool.prefix\n\t\t\t\tconst s = tool.suffix || ''\n\t\t\t\tconst wrappedInside = selected.length >= p.length + s.length\n\t\t\t\t\t&& selected.startsWith(p)\n\t\t\t\t\t&& selected.endsWith(s)\n\n\t\t\t\t// Not just the delimiters immediately against the selection: read\n\t\t\t\t// the whole run on each side, so this tool's pair is still found\n\t\t\t\t// with another tool's nested inside it. Toggling bold on\n\t\t\t\t// `**_text_**` has to see the `**` through the `_`, or alternating\n\t\t\t\t// bold and italic stacks markers forever instead of toggling.\n\t\t\t\tconst markers = this.wrapMarkers\n\t\t\t\tconst leftRun = s === '' ? [] : peelMarkers(before, markers, true)\n\t\t\t\tconst rightRun = s === '' ? [] : peelMarkers(after, markers, false)\n\t\t\t\t// Same depth on both sides: that is what makes them a pair.\n\t\t\t\tconst depth = leftRun.findIndex((m, i) => m === p && rightRun[i] === s)\n\n\t\t\t\tif (wrappedInside) {\n\t\t\t\t\tconst inner = selected.slice(p.length, selected.length - s.length)\n\t\t\t\t\tnextValue = `${before}${inner}${after}`\n\t\t\t\t\tnextSelStart = before.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t} else if (depth !== -1) {\n\t\t\t\t\t// Selection is the inner text; drop this tool's pair and leave\n\t\t\t\t\t// every marker nested inside it where it is.\n\t\t\t\t\tconst pStart = before.length\n\t\t\t\t\t\t- leftRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\t\t- p.length\n\t\t\t\t\tconst sStart = rightRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\tnextValue = before.slice(0, pStart)\n\t\t\t\t\t\t+ before.slice(pStart + p.length)\n\t\t\t\t\t\t+ selected\n\t\t\t\t\t\t+ after.slice(0, sStart)\n\t\t\t\t\t\t+ after.slice(sStart + s.length)\n\t\t\t\t\tnextSelStart = before.length - p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + selected.length\n\t\t\t\t} else {\n\t\t\t\t\tconst inner = selected || tool.placeholder || ''\n\t\t\t\t\tconst insertion = `${p}${inner}${s}`\n\t\t\t\t\tnextValue = `${before}${insertion}${after}`\n\t\t\t\t\tnextSelStart = before.length + p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.localValue = nextValue\n\t\t\tthis.emitValue(nextValue)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(nextSelStart, nextSelEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Programmatic insert helper — exposed publicly so parents\n\t\t * can drop content at the caret (e.g. from a file-picker\n\t\t * callback inserting a `` reference).\n\t\t *\n\t\t * @param {string} text The text to insert at the caret.\n\t\t * @return {void}\n\t\t */\n\t\tinsertAtCaret(text) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\tthis.localValue += text\n\t\t\t\tthis.emitValue(this.localValue)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\t\t\tconst next = `${before}${text}${after}`\n\t\t\tconst caret = before.length + text.length\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(caret, caret)\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-markdown-editor {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-main-background);\n\toverflow: hidden;\n}\n\n.cn-markdown-editor__toolbar {\n\tdisplay: flex;\n\tgap: 4px;\n\tpadding: 6px;\n\tborder-bottom: 1px solid var(--color-border);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-markdown-editor__tool {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 4px 8px;\n\tcursor: pointer;\n\tfont-family: monospace;\n\tmin-width: 28px;\n}\n\n.cn-markdown-editor__tool:hover {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n}\n\n.cn-markdown-editor__spacer {\n\tflex: 1 1 auto;\n}\n\n.cn-markdown-editor__panes {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"split\"] {\n\tgrid-template-columns: 1fr 1fr;\n}\n\n.cn-markdown-editor__textarea {\n\tborder: none;\n\toutline: none;\n\tpadding: 10px 12px;\n\tfont-family: monospace;\n\tfont-size: 0.95em;\n\tresize: vertical;\n\twidth: 100%;\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\t/* Nested list indents are single tabs (see LIST_INDENT); render them\n\t compactly rather than the 8-char browser default. */\n\ttab-size: 2;\n\t-moz-tab-size: 2;\n}\n\n.cn-markdown-editor__preview {\n\tpadding: 10px 14px;\n\tborder-left: 1px solid var(--color-border);\n\tbackground: var(--color-main-background);\n\toverflow-y: auto;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"preview\"] .cn-markdown-editor__preview {\n\tborder-left: none;\n}\n\n.cn-markdown-editor__hint {\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 0 10px 8px;\n}\n\n/* WYSIWYG (Toast UI) mode — themed with Nextcloud CSS variables. */\n.cn-markdown-editor__wysiwyg {\n\twidth: 100%;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-defaultUI) {\n\tfont-family: var(--font-face) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar) {\n\tbackground-color: var(--color-background-hover) !important;\n\tborder-bottom: 1px solid var(--color-border-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: transparent !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button:hover) {\n\tbackground-color: var(--color-background-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-contents),\n.cn-markdown-editor__wysiwyg :deep(.ProseMirror) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tfont-family: var(--font-face) !important;\n}\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_openBlock","_Fragment","_renderList","_createElementVNode","_toDisplayString","_withDirectives"],"mappings":";;;;AAGiD,EAAA,KAAK,EAAC,6BAA4B;AAAE,EAAA,IAAI,EAAC,SAAS;;;;;;;;;AA4CrF,EAAA,KAAK,EAAC,6BAA8B;AAAA,EAAA,aAAW,EAAC,qBAAqB;;AACjD,MAAA,UAAA,GAAA,EAAA,GAAG,EAAC;;;AACP,EAAA,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AAA,CAAA,CAAA,eAAA,EAAA,iBAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;KAKO,MAAI,CAAA,IAAA;sBAAjBN,kBAAqE,CAAA,OAAA,EAArE,WAAqE,EAAAM,eAAA,CAAd,MAAK,CAAA,IAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnMarkdownEditor.vue3.js","sources":["../../../../src/components/CnMarkdownEditor/CnMarkdownEditor.vue?vue&type=template&id=697543a0&lang.js"],"sourcesContent":["<template>\n\t<div class=\"cn-markdown-editor\" data-testid=\"cn-markdown-editor\" :class=\"modeClass\">\n\t\t<!-- Toolbar with formatting shortcuts (textarea modes only; WYSIWYG has its own). -->\n\t\t<div v-if=\"!hideToolbar && mode !== 'wysiwyg'\" class=\"cn-markdown-editor__toolbar\" role=\"toolbar\">\n\t\t\t<button v-for=\"tool in toolbar\"\n\t\t\t\t:key=\"tool.id\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool\"\n\t\t\t\t:title=\"tool.tooltip || tool.label\"\n\t\t\t\t:data-testid=\"'tool-' + tool.id\"\n\t\t\t\t@click=\"invokeTool(tool)\">\n\t\t\t\t<span>{{ tool.label }}</span>\n\t\t\t</button>\n\t\t\t<span class=\"cn-markdown-editor__spacer\" />\n\t\t\t<button v-if=\"!hideModeSwitch\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool cn-markdown-editor__mode-switch\"\n\t\t\t\t:title=\"modeSwitchTooltip\"\n\t\t\t\tdata-testid=\"mode-switch\"\n\t\t\t\t@click=\"cycleMode\">\n\t\t\t\t{{ currentModeLabel }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<!-- Pane layout: edit / preview / split (textarea + rendered preview). -->\n\t\t<div v-if=\"mode !== 'wysiwyg'\" class=\"cn-markdown-editor__panes\" :data-mode=\"mode\">\n\t\t\t<textarea v-if=\"mode !== 'preview'\"\n\t\t\t\tref=\"textarea\"\n\t\t\t\tclass=\"cn-markdown-editor__textarea\"\n\t\t\t\t:value=\"localValue\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:aria-label=\"ariaLabel\"\n\t\t\t\tdata-testid=\"cn-markdown-textarea\"\n\t\t\t\t@input=\"onInput\"\n\t\t\t\t@keydown=\"onKeydown\" />\n\t\t\t<div v-if=\"mode !== 'edit'\"\n\t\t\t\tclass=\"cn-markdown-editor__preview\"\n\t\t\t\tdata-testid=\"cn-markdown-preview\"\n\t\t\t\tv-html=\"renderedHtml\" /><!-- eslint-disable-line vue/no-v-html -- renderedHtml comes from cnRenderMarkdown(), which sanitises through DOMPurify -->\n\t\t</div>\n\n\t\t<!-- WYSIWYG mode: lazily-instantiated Toast UI editor. The editor is\n\t\t driven imperatively against `toastHost` rather than through a Vue\n\t\t wrapper component — `@toast-ui/vue-editor` is Vue-2 only, so the\n\t\t Vue-3 line uses the framework-agnostic `@toast-ui/editor` API. -->\n\t\t<div v-else class=\"cn-markdown-editor__wysiwyg\" data-testid=\"cn-markdown-wysiwyg\">\n\t\t\t<div v-show=\"toastEditorReady\" ref=\"toastHost\" />\n\t\t\t<p v-if=\"!toastEditorReady\" class=\"cn-markdown-editor__hint\">\n\t\t\t\t{{ t('nextcloud-vue', 'Loading editor…') }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<!-- Hint row. -->\n\t\t<small v-if=\"hint\" class=\"cn-markdown-editor__hint\">{{ hint }}</small>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { cnRenderMarkdown } from '../../composables/cnRenderMarkdown.js'\nimport { guardedToastUiEditorClass } from '../../utils/toastUiRawHtmlGuard.js'\nimport { toastUiSanitizer } from '../../utils/toastUiSanitizer.js'\n\n/**\n * Default formatting toolbar — Markdown insertions that wrap a\n * selection or insert a placeholder.\n *\n * @type {Array<{id:string,label:string,prefix:string,suffix?:string,placeholder?:string}>}\n */\nconst DEFAULT_TOOLBAR = Object.freeze([\n\t{ id: 'bold', label: 'B', prefix: '**', suffix: '**', placeholder: 'bold', tooltip: 'Bold (Ctrl+B)' },\n\t{ id: 'italic', label: 'I', prefix: '_', suffix: '_', placeholder: 'italic', tooltip: 'Italic (Ctrl+I)' },\n\t{ id: 'h1', label: 'H1', prefix: '# ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 1', linePrefix: true },\n\t{ id: 'h2', label: 'H2', prefix: '## ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 2', linePrefix: true },\n\t{ id: 'link', label: '🔗', prefix: '[', suffix: '](https://)', placeholder: 'link text', tooltip: 'Link' },\n\t{ id: 'code', label: '`</>`', prefix: '`', suffix: '`', placeholder: 'code', tooltip: 'Inline code' },\n\t{ id: 'list', label: '•', prefix: '- ', suffix: '', placeholder: 'item', tooltip: 'List', linePrefix: true },\n\t{ id: 'quote', label: '“”', prefix: '> ', suffix: '', placeholder: 'quote', tooltip: 'Quote', linePrefix: true },\n])\n\nconst MODES = ['edit', 'split', 'preview', 'wysiwyg']\n\n/**\n * Matches a list item at the start of a line: leading indentation, a bullet\n * (`-`/`*`/`+`) or ordered marker (`1.`/`1)`), the whitespace after it, then the\n * item body. Drives the smart Enter / Tab list handling. Only the markers\n * CommonMark actually renders as lists are recognised (no `a.`/`A)` alpha\n * markers — Markdown renders those as plain text).\n *\n * @type {RegExp}\n */\nconst LIST_ITEM_RE = /^([ \\t]*)([-*+]|\\d+[.)])([ \\t]+)(.*)$/\n\n/** One indent step for nesting list items (a tab; textarea uses `tab-size: 2`). */\nconst LIST_INDENT = '\\t'\n\n/**\n * The marker that continues a list after `marker`: unordered bullets repeat;\n * numeric markers increment (`1.`→`2.`, `1)`→`2)`) keeping the `.`/`)` delimiter.\n *\n * @param {string} marker The current line's list marker (e.g. `-`, `1.`).\n * @return {string} The next item's marker.\n */\nfunction nextListMarker(marker) {\n\tconst ordered = marker.match(/^(\\d+)([.)])$/)\n\tif (!ordered) {\n\t\treturn marker\n\t}\n\treturn `${parseInt(ordered[1], 10) + 1}${ordered[2]}`\n}\n\n/**\n * Read off the run of wrap markers sitting against one edge of the selection,\n * innermost first. `**_` to the left of the caret yields `['_', '**']`.\n *\n * `markers` must be ordered longest-first so `**` is never read as two `*`.\n *\n * @param {string} text The text on that side of the selection.\n * @param {string[]} markers Known wrap delimiters, longest first.\n * @param {boolean} fromEnd Scan backwards from the end (the text BEFORE the\n * selection) rather than forwards from the start (the text AFTER it).\n * @return {string[]} The markers found, innermost first.\n */\nfunction peelMarkers(text, markers, fromEnd) {\n\tconst found = []\n\tlet rest = text\n\tconst nextMarker = () => markers.find((m) => m !== '' && (fromEnd ? rest.endsWith(m) : rest.startsWith(m)))\n\tfor (let hit = nextMarker(); hit; hit = nextMarker()) {\n\t\tfound.push(hit)\n\t\trest = fromEnd ? rest.slice(0, rest.length - hit.length) : rest.slice(hit.length)\n\t}\n\treturn found\n}\n\n/**\n * Default Toast UI WYSIWYG toolbar layout — used only in `mode: 'wysiwyg'`.\n *\n * @type {Array<Array<string>>}\n */\nconst DEFAULT_WYSIWYG_TOOLBAR = Object.freeze([\n\t['heading', 'bold', 'italic', 'strike'],\n\t['hr', 'quote'],\n\t['ul', 'ol', 'task', 'indent', 'outdent'],\n\t['table', 'image', 'link'],\n\t['code', 'codeblock'],\n])\n\n/**\n * CnMarkdownEditor — Markdown editor with a textarea + live HTML\n * preview, a formatting toolbar, and four layout modes (edit /\n * split / preview / wysiwyg).\n *\n * The default path is a `<textarea>` + `cnRenderMarkdown` preview.\n * Setting `mode: 'wysiwyg'` opts into a rich Toast UI WYSIWYG editor\n * that is **lazily loaded** only when that mode is active — the\n * textarea modes carry no editor dependency. The `v-model` contract\n * is identical across all modes (`value` in, `input` out).\n *\n * ```vue\n * <CnMarkdownEditor v-model=\"article\" placeholder=\"Write your article …\" />\n * <CnMarkdownEditor v-model=\"article\" mode=\"wysiwyg\" />\n * ```\n *\n * Toolbar buttons either wrap the current selection or insert a\n * placeholder (`bold` / `italic` / `link` / `code`) OR prefix the\n * current line (`h1` / `h2` / `list` / `quote`). The `toolbar`\n * prop lets consumers replace the default set.\n */\nexport default {\n\tname: 'CnMarkdownEditor',\n\tprops: {\n\t\t/**\n\t\t * Markdown source (v-model).\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tvalue: { type: String, default: '' },\n\t\t/**\n\t\t * Markdown source, Vue 3's own v-model prop.\n\t\t *\n\t\t * ⚠️ WITHOUT THIS, `v-model` ON THIS COMPONENT DOES NOTHING. Vue 3\n\t\t * compiles `v-model=\"x\"` to `:modelValue` + `@update:modelValue`, so a\n\t\t * component that only declares `value`/`input` never receives the prop\n\t\t * and its emit is never heard — silently, with no warning, looking\n\t\t * exactly like a component that works.\n\t\t *\n\t\t * `value` is kept as the public name (consumers depend on it) and both\n\t\t * are accepted. `undefined` rather than `''` as the default is what\n\t\t * distinguishes \"not passed\" from \"passed as empty\".\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tmodelValue: { type: String, default: undefined },\n\t\t/**\n\t\t * Layout mode. `edit` shows only the textarea, `preview`\n\t\t * shows only the rendered HTML, `split` shows both\n\t\t * side-by-side.\n\t\t *\n\t\t * @type {'edit'|'split'|'preview'}\n\t\t */\n\t\tmode: {\n\t\t\ttype: String,\n\t\t\tdefault: 'split',\n\t\t\tvalidator: (v) => MODES.includes(v),\n\t\t},\n\n\t\t/** Placeholder for the textarea. */\n\t\tplaceholder: { type: String, default: 'Write Markdown…' },\n\t\t/** Aria-label for the textarea. */\n\t\tariaLabel: { type: String, default: 'Markdown editor input' },\n\t\t/** Minimum textarea rows. */\n\t\trows: { type: Number, default: 10 },\n\t\t/** Disable the textarea (still renders the preview). */\n\t\tdisabled: { type: Boolean, default: false },\n\t\t/** Hide the formatting toolbar entirely. */\n\t\thideToolbar: { type: Boolean, default: false },\n\t\t/** Hide the mode-switch button on the toolbar. */\n\t\thideModeSwitch: { type: Boolean, default: false },\n\t\t/** Mode-switch tooltip. */\n\t\tmodeSwitchTooltip: { type: String, default: 'Cycle layout (edit / split / preview)' },\n\t\t/**\n\t\t * Custom toolbar entries. Each entry: `{id, label, prefix,\n\t\t * suffix?, placeholder?, tooltip?, linePrefix?}`. When\n\t\t * `linePrefix: true` the prefix is inserted at the start\n\t\t * of the current line instead of wrapping the selection.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\ttoolbar: { type: Array, default: () => DEFAULT_TOOLBAR.slice() },\n\t\t/** Optional helper text rendered under the editor. */\n\t\thint: { type: String, default: '' },\n\t\t/**\n\t\t * WYSIWYG mode only: Toast UI toolbar layout (array of button groups).\n\t\t * Ignored in the textarea modes.\n\t\t *\n\t\t * @type {Array<Array<string>>}\n\t\t */\n\t\twysiwygToolbar: { type: Array, default: () => DEFAULT_WYSIWYG_TOOLBAR.map((g) => g.slice()) },\n\t\t/** WYSIWYG mode only: editor height (any CSS length). */\n\t\twysiwygHeight: { type: String, default: '300px' },\n\t},\n\n\t// Declaring the emitted events is not cosmetic under Vue 3: an UNdeclared\n\t// event name also stays in `$attrs` and falls through to the root element,\n\t// so the NATIVE `input` event the `<textarea>` bubbles up is re-emitted by\n\t// the component as its own `input` — after the component's own\n\t// `$emit('input', value)` — and listeners receive the raw InputEvent\n\t// instead of the string.\n\temits: ['input', 'update:modelValue', 'update:mode'],\n\tdata() {\n\t\treturn {\n\t\t\tlocalValue: (this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t\t// Whether the lazily-created Toast UI editor instance is live\n\t\t\t// (WYSIWYG mode only). Drives the loading hint.\n\t\t\ttoastEditorReady: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * BEM modifier for the current layout mode.\n\t\t *\n\t\t * @return {string} The class.\n\t\t */\n\t\tmodeClass() {\n\t\t\treturn `cn-markdown-editor--${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Every wrap delimiter the active toolbar can produce, longest first.\n\t\t * Toggling has to recognise the OTHER tools' markers, not just its own,\n\t\t * or alternating bold and italic stacks instead of toggling.\n\t\t *\n\t\t * @return {string[]} The delimiters, longest first.\n\t\t */\n\t\twrapMarkers() {\n\t\t\tconst out = new Set()\n\t\t\tfor (const tool of this.toolbar) {\n\t\t\t\tif (tool.linePrefix || !tool.suffix) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tout.add(tool.prefix)\n\t\t\t\tout.add(tool.suffix)\n\t\t\t}\n\t\t\treturn [...out].sort((a, b) => b.length - a.length)\n\t\t},\n\n\t\t/**\n\t\t * The value the consumer actually bound, whichever prop they used.\n\t\t *\n\t\t * @return {string} The markdown source.\n\t\t */\n\t\tboundValue() {\n\t\t\treturn this.modelValue !== undefined ? this.modelValue : this.value\n\t\t},\n\n\t\t/**\n\t\t * Rendered HTML for the preview pane. Uses\n\t\t * `cnRenderMarkdown` so the output goes through the lib's\n\t\t * sanitised pipeline.\n\t\t *\n\t\t * @return {string} The rendered HTML.\n\t\t */\n\t\trenderedHtml() {\n\t\t\treturn cnRenderMarkdown(this.localValue || '')\n\t\t},\n\n\t\t/**\n\t\t * Label for the mode-switch button (shows the NEXT mode).\n\t\t *\n\t\t * @return {string} The label.\n\t\t */\n\t\tcurrentModeLabel() {\n\t\t\treturn `▦ ${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Toast UI editor options (WYSIWYG mode) — the configured toolbar plus\n\t\t * fixed WYSIWYG defaults.\n\t\t *\n\t\t * @return {object} The Toast UI options object.\n\t\t */\n\t\twysiwygOptions() {\n\t\t\treturn {\n\t\t\t\tminHeight: '200px',\n\t\t\t\tlanguage: 'en-US',\n\t\t\t\thideModeSwitch: true,\n\t\t\t\ttoolbarItems: this.wysiwygToolbar,\n\t\t\t\tinitialEditType: 'wysiwyg',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\t// Both spellings watched, because either may be the one the consumer\n\t\t// bound. `boundValue` collapses them so the body is written once.\n\t\tmodelValue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tvalue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tmode(next) {\n\t\t\tif (next === 'wysiwyg') {\n\t\t\t\tthis.loadWysiwyg()\n\t\t\t}\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.mode === 'wysiwyg') {\n\t\t\tthis.loadWysiwyg()\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\t// The editor is created imperatively, so Vue will not tear it down.\n\t\tif (this.toastEditor && typeof this.toastEditor.destroy === 'function') {\n\t\t\tthis.toastEditor.destroy()\n\t\t}\n\t\tthis.toastEditor = null\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Lazily import and instantiate the Toast UI editor (and its CSS) the\n\t\t * first time WYSIWYG mode is entered. Keeps the ~200 KB editor out of\n\t\t * the default textarea path.\n\t\t *\n\t\t * Uses the framework-agnostic `@toast-ui/editor` constructor rather\n\t\t * than a Vue wrapper: `@toast-ui/vue-editor` is published for Vue 2\n\t\t * only and has no Vue-3 build. The instance is held as a plain (NON\n\t\t * reactive) instance property — putting a third-party class instance\n\t\t * in `data()` would wrap it in Vue 3's reactive proxy and break its\n\t\t * internal identity checks.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync loadWysiwyg() {\n\t\t\tif (this.toastEditor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst [{ default: Editor }] = await Promise.all([\n\t\t\t\t\timport('@toast-ui/editor'),\n\t\t\t\t\timport('@toast-ui/editor/dist/toastui-editor.css'),\n\t\t\t\t])\n\t\t\t\tawait this.$nextTick()\n\t\t\t\tconst el = this.$refs.toastHost\n\t\t\t\tif (!el) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// customHTMLSanitizer does not reach Toast UI's raw HTML\n\t\t\t\t// converters, paste or setHTML; the guarded class routes those\n\t\t\t\t// through DOMPurify 3 as well (see utils/toastUiRawHtmlGuard.js).\n\t\t\t\tconst GuardedEditor = guardedToastUiEditorClass(Editor)\n\t\t\t\tthis.toastEditor = new GuardedEditor({\n\t\t\t\t\tel,\n\t\t\t\t\t...this.wysiwygOptions,\n\t\t\t\t\tinitialValue: this.localValue,\n\t\t\t\t\tpreviewStyle: 'tab',\n\t\t\t\t\theight: this.wysiwygHeight,\n\t\t\t\t\tevents: { change: this.onWysiwygChange },\n\t\t\t\t\t// Replaces the DOMPurify 2.3.3 copy that @toast-ui/editor\n\t\t\t\t\t// inlines into its own bundle (unmaintained since 2023, so\n\t\t\t\t\t// no npm-level fix exists). Same sanitising contract, run\n\t\t\t\t\t// by the maintained DOMPurify 3.x — see the module docs.\n\t\t\t\t\t// Set last so a consumer cannot drop it via wysiwygOptions.\n\t\t\t\t\tcustomHTMLSanitizer: toastUiSanitizer,\n\t\t\t\t})\n\t\t\t\tthis.toastEditorReady = true\n\t\t\t} catch (e) {\n\t\t\t\t// eslint-disable-next-line no-console -- diagnostic for a failure this code already degrades from\n\t\t\t\tconsole.error('CnMarkdownEditor: failed to load the WYSIWYG editor', e)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Toast UI change handler — read the current markdown and emit it via\n\t\t * v-model.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonWysiwygChange() {\n\t\t\tif (!this.toastEditor || typeof this.toastEditor.getMarkdown !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst markdown = this.toastEditor.getMarkdown()\n\t\t\tthis.localValue = markdown\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(markdown)\n\t\t},\n\n\t\t/**\n\t\t * Adopt a value pushed in from outside.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\tonBoundValueChange(next) {\n\t\t\tif (next === this.localValue) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.localValue = next\n\t\t\t// The imperative editor holds its own copy of the document, so an\n\t\t\t// external v-model change has to be pushed into it. Guarded on the\n\t\t\t// current markdown so we don't clobber the caret while the user is\n\t\t\t// typing (our own change handler round-trips here).\n\t\t\tif (this.toastEditor && this.toastEditor.getMarkdown() !== next) {\n\t\t\t\tthis.toastEditor.setMarkdown(next || '')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer the value changed, in both v-model dialects.\n\t\t *\n\t\t * BOTH are emitted, always. A consumer on `@input` and a consumer on\n\t\t * `v-model` are the same consumer as far as this component knows, and\n\t\t * emitting only one silently breaks half of them.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\temitValue(next) {\n\t\t\t/**\n\t\t\t * @event input The value changed. Vue 2's v-model dialect, kept for\n\t\t\t * existing consumers.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * @event update:modelValue The value changed. Vue 3's v-model\n\t\t\t * dialect — what a plain `v-model` listens for.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\n\t\t/**\n\t\t * Textarea input handler — pushes the new value upward via\n\t\t * v-model.\n\t\t *\n\t\t * @param {InputEvent} event The input event.\n\t\t * @return {void}\n\t\t */\n\t\tonInput(event) {\n\t\t\tthis.localValue = event.target.value\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(this.localValue)\n\t\t},\n\n\t\t/**\n\t\t * Keyboard handler. Ctrl/Cmd+B / Ctrl/Cmd+I trigger bold / italic;\n\t\t * Enter continues (or exits) a list; Tab / Shift+Tab indent / dedent a\n\t\t * list item. Anything else falls through to the textarea default.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @return {void}\n\t\t */\n\t\tonKeydown(event) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.ctrlKey || event.metaKey) {\n\t\t\t\tlet toolId = null\n\t\t\t\tif (event.key === 'b' || event.key === 'B') {\n\t\t\t\t\ttoolId = 'bold'\n\t\t\t\t} else if (event.key === 'i' || event.key === 'I') {\n\t\t\t\t\ttoolId = 'italic'\n\t\t\t\t}\n\t\t\t\tif (!toolId) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst tool = this.toolbar.find((t) => t.id === toolId)\n\t\t\t\tif (!tool) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.invokeTool(tool)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.key === 'Enter' && !event.shiftKey) {\n\t\t\t\tthis.handleListEnter(event, ta)\n\t\t\t} else if (event.key === 'Tab') {\n\t\t\t\tthis.handleListTab(event, ta)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Smart Enter inside a list: continue with the next marker (incrementing\n\t\t * ordered / alpha markers), or — when the current item is empty — break\n\t\t * out of the list, leaving a blank line so the user types normally. No-op\n\t\t * (default newline) unless the caret is in a list item's body.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListEnter(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tif (selStart !== ta.selectionEnd) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst lineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst nl = value.indexOf('\\n', selStart)\n\t\t\tconst lineEnd = nl === -1 ? value.length : nl\n\t\t\tconst m = value.slice(lineStart, lineEnd).match(LIST_ITEM_RE)\n\t\t\tif (!m) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [, indent, marker, gap, content] = m\n\t\t\t// Only act once the caret is past the marker (in the item body).\n\t\t\tif (selStart < lineStart + indent.length + marker.length + gap.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tif (content.trim() === '') {\n\t\t\t\t// Empty item → exit the list: drop the marker, leave a blank line.\n\t\t\t\tconst next = `${value.slice(0, lineStart)}${value.slice(lineEnd)}`\n\t\t\t\tthis.applyTextChange(next, lineStart, lineStart)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst insertion = `\\n${indent}${nextListMarker(marker)}${gap}`\n\t\t\tconst next = `${value.slice(0, selStart)}${insertion}${value.slice(selStart)}`\n\t\t\tconst caret = selStart + insertion.length\n\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t},\n\n\t\t/**\n\t\t * Smart Tab inside a list: Tab indents the current line (or every line\n\t\t * spanned by the selection) by one level; Shift+Tab dedents it. Only\n\t\t * hijacks Tab when the caret's line is a list item, so Tab still moves\n\t\t * focus in plain text.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListTab(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tconst selEnd = ta.selectionEnd\n\t\t\tconst firstLineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst firstNl = value.indexOf('\\n', firstLineStart)\n\t\t\tconst firstLineEnd = firstNl === -1 ? value.length : firstNl\n\t\t\tif (!LIST_ITEM_RE.test(value.slice(firstLineStart, firstLineEnd))) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tconst endRef = selEnd > selStart ? selEnd - 1 : selEnd\n\t\t\tconst lastNl = value.indexOf('\\n', endRef)\n\t\t\tconst blockEnd = lastNl === -1 ? value.length : lastNl\n\t\t\tconst lines = value.slice(firstLineStart, blockEnd).split('\\n')\n\t\t\tlet firstDelta = 0\n\t\t\tlet newLines\n\t\t\tif (event.shiftKey) {\n\t\t\t\tnewLines = lines.map((ln, i) => {\n\t\t\t\t\tlet strip = 0\n\t\t\t\t\tif (ln.startsWith('\\t')) {\n\t\t\t\t\t\tstrip = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile (strip < 2 && ln[strip] === ' ') {\n\t\t\t\t\t\t\tstrip++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (i === 0) {\n\t\t\t\t\t\tfirstDelta = -strip\n\t\t\t\t\t}\n\t\t\t\t\treturn ln.slice(strip)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tnewLines = lines.map((ln) => `${LIST_INDENT}${ln}`)\n\t\t\t\tfirstDelta = LIST_INDENT.length\n\t\t\t}\n\t\t\tconst newBlock = newLines.join('\\n')\n\t\t\tconst next = `${value.slice(0, firstLineStart)}${newBlock}${value.slice(blockEnd)}`\n\t\t\tif (selStart === selEnd) {\n\t\t\t\tconst caret = Math.max(firstLineStart, selStart + firstDelta)\n\t\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t\t} else {\n\t\t\t\tthis.applyTextChange(next, firstLineStart, firstLineStart + newBlock.length)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Commit a programmatic edit: update the model, emit `input`, then\n\t\t * restore focus + selection on the next tick.\n\t\t *\n\t\t * @param {string} next The new textarea value.\n\t\t * @param {number} selStart The caret/selection start to restore.\n\t\t * @param {number} selEnd The selection end to restore.\n\t\t * @return {void}\n\t\t */\n\t\tapplyTextChange(next, selStart, selEnd) {\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst ta = this.$refs.textarea\n\t\t\t\tif (!ta) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(selStart, selEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Cycle the layout mode `edit → split → preview → edit`.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcycleMode() {\n\t\t\tconst idx = MODES.indexOf(this.mode)\n\t\t\tconst next = MODES[(idx + 1) % MODES.length]\n\t\t\t/**\n\t\t\t * @event update:mode v-model:mode emit so consumers can bind the layout mode.\n\t\t\t * @type {'edit'|'split'|'preview'}\n\t\t\t */\n\t\t\tthis.$emit('update:mode', next)\n\t\t},\n\n\t\t/**\n\t\t * Apply a toolbar action — either prefix the current line\n\t\t * (`linePrefix: true`) or wrap the current selection.\n\t\t *\n\t\t * @param {object} tool The toolbar entry.\n\t\t * @return {void}\n\t\t */\n\t\tinvokeTool(tool) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst selected = this.localValue.slice(ta.selectionStart, ta.selectionEnd)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\n\t\t\tlet nextValue\n\t\t\tlet nextSelStart\n\t\t\tlet nextSelEnd\n\t\t\tif (tool.linePrefix) {\n\t\t\t\t// Line-prefix mode (headings, list, quote): toggle/replace the\n\t\t\t\t// marker on the current line rather than stacking it. Operates on\n\t\t\t\t// the whole line under the caret, ignoring any selection.\n\t\t\t\tconst lineStart = before.lastIndexOf('\\n') + 1\n\t\t\t\tconst afterNl = after.indexOf('\\n')\n\t\t\t\tconst lineEnd = afterNl === -1 ? this.localValue.length : ta.selectionEnd + afterNl\n\t\t\t\tconst head = this.localValue.slice(0, lineStart)\n\t\t\t\tconst line = this.localValue.slice(lineStart, lineEnd)\n\t\t\t\tconst tail = this.localValue.slice(lineEnd)\n\n\t\t\t\t// Strip an existing recognised marker (heading #…, list -/*, quote >)\n\t\t\t\t// so switching one for another REPLACES it (e.g. `# ` → `## `, never\n\t\t\t\t// `## #`); re-applying the same marker toggles it off.\n\t\t\t\tconst existing = (line.match(/^(#{1,6} |[-*] |> )/) || [''])[0]\n\t\t\t\tconst body = line.slice(existing.length)\n\t\t\t\tconst newLine = existing === tool.prefix ? body : `${tool.prefix}${body}`\n\n\t\t\t\tnextValue = `${head}${newLine}${tail}`\n\t\t\t\t// Keep the caret/selection in the body, shifted by the marker delta.\n\t\t\t\tconst delta = newLine.length - line.length\n\t\t\t\tconst min = lineStart\n\t\t\t\tconst max = lineStart + newLine.length\n\t\t\t\tnextSelStart = Math.min(Math.max(ta.selectionStart + delta, min), max)\n\t\t\t\tnextSelEnd = Math.min(Math.max(ta.selectionEnd + delta, min), max)\n\t\t\t} else {\n\t\t\t\t// Wrap mode (bold/italic/link/code): toggle. If the selection is\n\t\t\t\t// already wrapped in this tool's delimiters — either they're part\n\t\t\t\t// of the selection, or they sit around it — strip them; otherwise\n\t\t\t\t// add them. Stops `**`/`_` from stacking on repeat presses.\n\t\t\t\tconst p = tool.prefix\n\t\t\t\tconst s = tool.suffix || ''\n\t\t\t\tconst wrappedInside = selected.length >= p.length + s.length\n\t\t\t\t\t&& selected.startsWith(p)\n\t\t\t\t\t&& selected.endsWith(s)\n\n\t\t\t\t// Not just the delimiters immediately against the selection: read\n\t\t\t\t// the whole run on each side, so this tool's pair is still found\n\t\t\t\t// with another tool's nested inside it. Toggling bold on\n\t\t\t\t// `**_text_**` has to see the `**` through the `_`, or alternating\n\t\t\t\t// bold and italic stacks markers forever instead of toggling.\n\t\t\t\tconst markers = this.wrapMarkers\n\t\t\t\tconst leftRun = s === '' ? [] : peelMarkers(before, markers, true)\n\t\t\t\tconst rightRun = s === '' ? [] : peelMarkers(after, markers, false)\n\t\t\t\t// Same depth on both sides: that is what makes them a pair.\n\t\t\t\tconst depth = leftRun.findIndex((m, i) => m === p && rightRun[i] === s)\n\n\t\t\t\tif (wrappedInside) {\n\t\t\t\t\tconst inner = selected.slice(p.length, selected.length - s.length)\n\t\t\t\t\tnextValue = `${before}${inner}${after}`\n\t\t\t\t\tnextSelStart = before.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t} else if (depth !== -1) {\n\t\t\t\t\t// Selection is the inner text; drop this tool's pair and leave\n\t\t\t\t\t// every marker nested inside it where it is.\n\t\t\t\t\tconst pStart = before.length\n\t\t\t\t\t\t- leftRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\t\t- p.length\n\t\t\t\t\tconst sStart = rightRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\tnextValue = before.slice(0, pStart)\n\t\t\t\t\t\t+ before.slice(pStart + p.length)\n\t\t\t\t\t\t+ selected\n\t\t\t\t\t\t+ after.slice(0, sStart)\n\t\t\t\t\t\t+ after.slice(sStart + s.length)\n\t\t\t\t\tnextSelStart = before.length - p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + selected.length\n\t\t\t\t} else {\n\t\t\t\t\tconst inner = selected || tool.placeholder || ''\n\t\t\t\t\tconst insertion = `${p}${inner}${s}`\n\t\t\t\t\tnextValue = `${before}${insertion}${after}`\n\t\t\t\t\tnextSelStart = before.length + p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.localValue = nextValue\n\t\t\tthis.emitValue(nextValue)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(nextSelStart, nextSelEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Programmatic insert helper — exposed publicly so parents\n\t\t * can drop content at the caret (e.g. from a file-picker\n\t\t * callback inserting a `` reference).\n\t\t *\n\t\t * @param {string} text The text to insert at the caret.\n\t\t * @return {void}\n\t\t */\n\t\tinsertAtCaret(text) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\tthis.localValue += text\n\t\t\t\tthis.emitValue(this.localValue)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\t\t\tconst next = `${before}${text}${after}`\n\t\t\tconst caret = before.length + text.length\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(caret, caret)\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-markdown-editor {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-main-background);\n\toverflow: hidden;\n}\n\n.cn-markdown-editor__toolbar {\n\tdisplay: flex;\n\tgap: 4px;\n\tpadding: 6px;\n\tborder-bottom: 1px solid var(--color-border);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-markdown-editor__tool {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 4px 8px;\n\tcursor: pointer;\n\tfont-family: monospace;\n\tmin-width: 28px;\n}\n\n.cn-markdown-editor__tool:hover {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n}\n\n.cn-markdown-editor__spacer {\n\tflex: 1 1 auto;\n}\n\n.cn-markdown-editor__panes {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"split\"] {\n\tgrid-template-columns: 1fr 1fr;\n}\n\n.cn-markdown-editor__textarea {\n\tborder: none;\n\toutline: none;\n\tpadding: 10px 12px;\n\tfont-family: monospace;\n\tfont-size: 0.95em;\n\tresize: vertical;\n\twidth: 100%;\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\t/* Nested list indents are single tabs (see LIST_INDENT); render them\n\t compactly rather than the 8-char browser default. */\n\ttab-size: 2;\n\t-moz-tab-size: 2;\n}\n\n.cn-markdown-editor__preview {\n\tpadding: 10px 14px;\n\tborder-left: 1px solid var(--color-border);\n\tbackground: var(--color-main-background);\n\toverflow-y: auto;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"preview\"] .cn-markdown-editor__preview {\n\tborder-left: none;\n}\n\n.cn-markdown-editor__hint {\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 0 10px 8px;\n}\n\n/* WYSIWYG (Toast UI) mode — themed with Nextcloud CSS variables. */\n.cn-markdown-editor__wysiwyg {\n\twidth: 100%;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-defaultUI) {\n\tfont-family: var(--font-face) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar) {\n\tbackground-color: var(--color-background-hover) !important;\n\tborder-bottom: 1px solid var(--color-border-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: transparent !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button:hover) {\n\tbackground-color: var(--color-background-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-contents),\n.cn-markdown-editor__wysiwyg :deep(.ProseMirror) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tfont-family: var(--font-face) !important;\n}\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_openBlock","_Fragment","_renderList","_createElementVNode","_toDisplayString","_withDirectives"],"mappings":";;;;AAGiD,EAAA,KAAK,EAAC,6BAA4B;AAAE,EAAA,IAAI,EAAC,SAAS;;;;;;;;;AA4CrF,EAAA,KAAK,EAAC,6BAA8B;AAAA,EAAA,aAAW,EAAC,qBAAqB;;AACjD,MAAA,UAAA,GAAA,EAAA,GAAG,EAAC;;;AACP,EAAA,KAAK,EAAC,0BAA0B;;;;AAM1C,EAAA,KAAK,EAAC,0BAA0B;;;;uBAtDpDA,kBAuDK,CAAA,KAAA,EAAA;IAvDA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AAqE,CAAA,OAAA,EAArE,WAAqE,EAAAM,eAAA,CAAd,MAAK,CAAA,IAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnObjectListWidget.vue2.js';
|
|
|
2
2
|
import { render } from './CnObjectListWidget.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-2f2783fe";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -510,7 +510,7 @@ var script = {
|
|
|
510
510
|
// `secondary` (a second, muted line under the cell) rides
|
|
511
511
|
// along too: the table draws it, and dropping it here took the
|
|
512
512
|
// list rows' second line away (zuiddrecht-pixel-gaps-3).
|
|
513
|
-
for (const k of ['format', 'widget', 'widgetProps', 'formatter', 'formatterOptions', 'align', 'width', 'type', 'enum', 'enumLabels', 'sortable', 'secondary', 'colorMap', 'grow', 'cellClass', 'emptyValue', 'emptyValueBy', 'emptyLabel', 'firstOf', 'secondaryLabels', 'secondaryRefs']) {
|
|
513
|
+
for (const k of ['format', 'widget', 'widgetProps', 'formatter', 'formatterOptions', 'align', 'width', 'type', 'enum', 'enumLabels', 'sortable', 'secondary', 'colorMap', 'grow', 'cellClass', 'filterable', 'filterField', 'emptyValue', 'emptyValueBy', 'emptyLabel', 'firstOf', 'secondaryLabels', 'secondaryRefs']) {
|
|
514
514
|
if (c[k] !== undefined) {
|
|
515
515
|
out[k] = c[k];
|
|
516
516
|
}
|