f7cloud_client/apps/text/js/MarkdownContentEditor-URxyNSkx.chunk.mjs.map
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

1 line
7.1 KiB
Plaintext

{"version":3,"file":"MarkdownContentEditor-URxyNSkx.chunk.mjs","sources":["../src/components/Editor/MarkdownContentEditor.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n-->\n\n<template>\n\t<Wrapper\n\t\t:content-loaded=\"true\"\n\t\t:show-outline-outside=\"showOutlineOutside\"\n\t\t@outline-toggled=\"outlineToggled\">\n\t\t<MainContainer>\n\t\t\t<template v-if=\"showMenuBar\">\n\t\t\t\t<MenuBar v-if=\"!readOnly\" :autohide=\"false\" />\n\t\t\t\t<slot v-else name=\"readonlyBar\">\n\t\t\t\t\t<ReadonlyBar />\n\t\t\t\t</slot>\n\t\t\t</template>\n\t\t\t<ContentContainer :read-only=\"readOnly\" />\n\t\t</MainContainer>\n\t</Wrapper>\n</template>\n\n<script>\nimport { Editor } from '@tiptap/core'\nimport MenuBar from '../Menu/MenuBar.vue'\nimport MainContainer from './MainContainer.vue'\nimport Wrapper from './Wrapper.vue'\n/* eslint-disable import/no-named-as-default */\nimport { getCurrentUser } from '@nextcloud/auth'\nimport History from '@tiptap/extension-history'\nimport { provide, watch } from 'vue'\nimport { provideEditor } from '../../composables/useEditor.ts'\nimport { editorFlagsKey } from '../../composables/useEditorFlags.ts'\nimport { useEditorMethods } from '../../composables/useEditorMethods.ts'\nimport { FocusTrap, RichText } from '../../extensions/index.js'\nimport { createMarkdownSerializer } from '../../extensions/Markdown.js'\nimport AttachmentResolver from '../../services/AttachmentResolver.js'\nimport { ATTACHMENT_RESOLVER } from '../Editor.provider.ts'\nimport ReadonlyBar from '../Menu/ReadonlyBar.vue'\nimport ContentContainer from './ContentContainer.vue'\n\nexport default {\n\tname: 'MarkdownContentEditor',\n\tcomponents: { ContentContainer, ReadonlyBar, MenuBar, MainContainer, Wrapper },\n\tprovide() {\n\t\tconst val = {}\n\n\t\tObject.defineProperties(val, {\n\t\t\t[ATTACHMENT_RESOLVER]: {\n\t\t\t\tget: () => this.$attachmentResolver ?? null,\n\t\t\t},\n\t\t})\n\n\t\treturn val\n\t},\n\n\tprops: {\n\t\tfileId: {\n\t\t\ttype: Number,\n\t\t\tdefault: null,\n\t\t},\n\t\tcontent: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\treadOnly: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t\trelativePath: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t\tshareToken: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\t\tshowMenuBar: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\t\tshowOutlineOutside: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\temits: ['update:content'],\n\n\tsetup(props) {\n\t\tconst extensions = [\n\t\t\tRichText.configure({\n\t\t\t\textensions: [History],\n\t\t\t}),\n\t\t\tFocusTrap,\n\t\t]\n\t\tconst editor = new Editor({ extensions })\n\n\t\tconst { setEditable, setContent } = useEditorMethods(editor)\n\t\twatch(\n\t\t\t() => props.content,\n\t\t\t(content) => {\n\t\t\t\tsetContent(content)\n\t\t\t},\n\t\t)\n\n\t\tsetEditable(!props.readOnly)\n\t\twatch(\n\t\t\t() => props.readOnly,\n\t\t\t(readOnly) => {\n\t\t\t\tsetEditable(!readOnly)\n\t\t\t},\n\t\t)\n\n\t\tprovideEditor(editor)\n\t\tprovide(editorFlagsKey, {\n\t\t\tisPublic: false,\n\t\t\tisRichEditor: true,\n\t\t\tisRichWorkspace: false,\n\t\t})\n\t\treturn { editor, setContent }\n\t},\n\n\tcreated() {\n\t\t// Set content after the setup function\n\t\t// as it may render other vue components such as preview toggle\n\t\t// which breaks the context of the setup function.\n\t\tthis.setContent(this.content, { addToHistory: false })\n\t\tthis.editor.on('create', () => {\n\t\t\tthis.$emit('ready')\n\t\t\tthis.$parent.$emit('ready')\n\t\t})\n\t\tthis.editor.on('update', ({ editor }) => {\n\t\t\tconst markdown = createMarkdownSerializer(editor.schema).serialize(\n\t\t\t\teditor.state.doc,\n\t\t\t)\n\t\t\tthis.emit('update:content', {\n\t\t\t\tjson: editor.state.doc,\n\t\t\t\tmarkdown,\n\t\t\t})\n\t\t})\n\t\tif (this.fileId) {\n\t\t\tthis.$attachmentResolver = new AttachmentResolver({\n\t\t\t\tcurrentDirectory: this.relativePath?.match(/.*\\//),\n\t\t\t\tuser: getCurrentUser(),\n\t\t\t\tshareToken: this.shareToken,\n\t\t\t\tfileId: this.fileId,\n\t\t\t})\n\t\t}\n\t},\n\n\tbeforeDestroy() {\n\t\tthis.editor.destroy()\n\t},\n\n\tmethods: {\n\t\toutlineToggled(visible) {\n\t\t\tthis.emit('outline-toggled', visible)\n\t\t},\n\n\t\t/**\n\t\t * Wrapper to emit events on our own and the parent component\n\t\t *\n\t\t * The parent might be either the root component of src/editor.js or Viewer.vue which collectives currently uses\n\t\t *\n\t\t * Ideally this would be done in a generic way in the src/editor.js API abstraction, but it seems\n\t\t * that there is no proper way to pass any received event along in vue, the only option I've found\n\t\t * in https://github.com/vuejs/vue/issues/230 feels too hacky to me, so we just emit twice for now\n\t\t *\n\t\t * @param {string} event The event name\n\t\t * @param {any} data The data to pass along\n\t\t */\n\t\temit(event, data) {\n\t\t\tthis.$emit(event, data)\n\t\t\tthis.$parent?.$emit(event, data)\n\t\t},\n\t},\n}\n</script>\n\n<style lang=\"scss\">\n@import './../../css/prosemirror';\n@import './../../css/print';\n</style>\n"],"names":["_sfc_main","ContentContainer","ReadonlyBar","MenuBar","MainContainer","Wrapper","val","ATTACHMENT_RESOLVER","props","extensions","RichText","History","FocusTrap","editor","Editor","setEditable","setContent","useEditorMethods","watch","content","readOnly","provideEditor","provide","editorFlagsKey","markdown","createMarkdownSerializer","AttachmentResolver","getCurrentUser","visible","event","data"],"mappings":"yyBAyCA,MAAAA,EAAA,CACA,KAAA,wBACA,WAAA,CAAA,iBAAAC,EAAA,YAAAC,EAAA,QAAAC,EAAA,cAAAC,EAAA,QAAAC,CAAA,EACA,SAAA,CACA,MAAAC,EAAA,CAAA,EAEA,OAAA,OAAA,iBAAAA,EAAA,CACA,CAAAC,CAAA,EAAA,CACA,IAAA,IAAA,KAAA,qBAAA,IACA,CACA,CAAA,EAEAD,CACA,EAEA,MAAA,CACA,OAAA,CACA,KAAA,OACA,QAAA,IACA,EACA,QAAA,CACA,KAAA,OACA,SAAA,EACA,EACA,SAAA,CACA,KAAA,QACA,QAAA,EACA,EACA,aAAA,CACA,KAAA,OACA,QAAA,EACA,EACA,WAAA,CACA,KAAA,OACA,QAAA,IACA,EACA,YAAA,CACA,KAAA,QACA,QAAA,EACA,EACA,mBAAA,CACA,KAAA,QACA,QAAA,EACA,CACA,EACA,MAAA,CAAA,gBAAA,EAEA,MAAAE,EAAA,CACA,MAAAC,EAAA,CACAC,EAAA,UAAA,CACA,WAAA,CAAAC,CAAA,CACA,CAAA,EACAC,CACA,EACAC,EAAA,IAAAC,EAAA,CAAA,WAAAL,CAAA,CAAA,EAEA,CAAA,YAAAM,EAAA,WAAAC,CAAA,EAAAC,EAAAJ,CAAA,EACA,OAAAK,EACA,IAAAV,EAAA,QACAW,GAAA,CACAH,EAAAG,CAAA,CACA,CACA,EAEAJ,EAAA,CAAAP,EAAA,QAAA,EACAU,EACA,IAAAV,EAAA,SACAY,GAAA,CACAL,EAAA,CAAAK,CAAA,CACA,CACA,EAEAC,EAAAR,CAAA,EACAS,EAAAC,EAAA,CACA,SAAA,GACA,aAAA,GACA,gBAAA,EACA,CAAA,EACA,CAAA,OAAAV,EAAA,WAAAG,CAAA,CACA,EAEA,SAAA,CAIA,KAAA,WAAA,KAAA,QAAA,CAAA,aAAA,EAAA,CAAA,EACA,K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