← Back
Editing: BaseReader-CX01F9DF.chunk.mjs.map
{"version":3,"file":"BaseReader-CX01F9DF.chunk.mjs","sources":["../src/components/BaseReader.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n-->\n\n<template>\n\t<div data-text-el=\"editor-content-wrapper\" class=\"editor__content-wrapper\">\n\t\t<EditorContent\n\t\t\tid=\"read-only-editor\"\n\t\t\tclass=\"editor__content text-editor__content\"\n\t\t\t:editor=\"editor\" />\n\t\t<TocContainer v-if=\"useTableOfContents\" />\n\t</div>\n</template>\n\n<script>\nimport { Editor } from '@tiptap/core'\nimport { EditorContent } from '@tiptap/vue-2'\nimport { inject, watch } from 'vue'\nimport { provideEditor } from '../composables/useEditor.ts'\nimport { useEditorFlags } from '../composables/useEditorFlags.ts'\nimport { useEditorMethods } from '../composables/useEditorMethods.ts'\nimport TocContainer from './Editor/TableOfContents/TocContainer.vue'\n\nexport default {\n\tname: 'BaseReader',\n\tcomponents: {\n\t\tEditorContent,\n\t\tTocContainer,\n\t},\n\n\tprops: {\n\t\tcontent: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\tsetup(props) {\n\t\t// extensions is a factory building a list of extensions for the editor\n\t\tconst extensions = inject('extensions')\n\t\tconst editor = new Editor({ extensions: extensions() })\n\t\tprovideEditor(editor)\n\n\t\tconst { useTableOfContents } = useEditorFlags()\n\t\tconst { setContent, setEditable } = useEditorMethods(editor)\n\t\twatch(\n\t\t\t() => props.content,\n\t\t\t(content) => {\n\t\t\t\tconsole.warn({ content })\n\t\t\t\tsetContent(content)\n\t\t\t},\n\t\t)\n\t\tsetEditable(false)\n\n\t\t// Render the initial content last as it may render Vue components\n\t\t// that break the vue context of this setup function.\n\t\tsetContent(props.content, { addToHistory: false })\n\t\treturn { editor, useTableOfContents }\n\t},\n\n\tbeforeDestroy() {\n\t\tthis.editor?.destroy()\n\t},\n}\n</script>\n\n<style scoped lang=\"scss\">\n.editor__content-wrapper {\n\tflex-grow: 1;\n}\n\n.editor__content {\n\tmax-width: var(--text-editor-max-width);\n\tmargin: 0 auto;\n\tposition: relative;\n}\n</style>\n"],"names":["_sfc_main","EditorContent","TocContainer","props","extensions","inject","editor","Editor","provideEditor","useTableOfContents","useEditorFlags","setContent","setEditable","useEditorMethods","watch","content"],"mappings":"4NAwBA,MAAAA,EAAA,CACA,KAAA,aACA,WAAA,CACA,cAAAC,EACA,aAAAC,CACA,EAEA,MAAA,CACA,QAAA,CACA,KAAA,OACA,SAAA,EACA,CACA,EAEA,MAAAC,EAAA,CAEA,MAAAC,EAAAC,EAAA,YAAA,EACAC,EAAA,IAAAC,EAAA,CAAA,WAAAH,EAAA,CAAA,CAAA,EACAI,EAAAF,CAAA,EAEA,KAAA,CAAA,mBAAAG,CAAA,EAAAC,EAAA,EACA,CAAA,WAAAC,EAAA,YAAAC,CAAA,EAAAC,EAAAP,CAAA,EACA,OAAAQ,EACA,IAAAX,EAAA,QACAY,GAAA,CACA,QAAA,KAAA,CAAA,QAAAA,CAAA,CAAA,EACAJ,EAAAI,CAAA,CACA,CACA,EACAH,EAAA,EAAA,EAIAD,EAAAR,EAAA,QAAA,CAAA,aAAA,EAAA,CAAA,EACA,CAAA,OAAAG,EAAA,mBAAAG,CAAA,CACA,EAEA,eAAA,CACA,KAAA,QAAA,QAAA,CACA,CACA"}
Save File
Cancel