1 line
3.6 KiB
Plaintext
1 line
3.6 KiB
Plaintext
{"version":3,"file":"BaseReader-CEyXn00Z.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\n\t\tdata-text-el=\"editor-content-wrapper\"\n\t\tclass=\"content-wrapper text-editor__content-wrapper\"\n\t\t:class=\"{\n\t\t\t'--show-outline': showOutline,\n\t\t}\">\n\t\t<div v-if=\"showOutline\" class=\"text-editor__content-wrapper__left\">\n\t\t\t<EditorOutline />\n\t\t</div>\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<div class=\"text-editor__content-wrapper__right\" />\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 { useEditorMethods } from '../composables/useEditorMethods.ts'\nimport EditorOutline from './Editor/EditorOutline.vue'\nimport {\n\tuseOutlineActions,\n\tuseOutlineStateMixin,\n} from './Editor/Wrapper.provider.js'\n\nexport default {\n\tname: 'BaseReader',\n\tcomponents: {\n\t\tEditorContent,\n\t\tEditorOutline,\n\t},\n\n\tmixins: [useOutlineStateMixin, useOutlineActions],\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 { 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 }\n\t},\n\n\tcomputed: {\n\t\tshowOutline() {\n\t\t\treturn this.$outlineState.visible\n\t\t},\n\t},\n\n\tbeforeDestroy() {\n\t\tthis.editor?.destroy()\n\t},\n}\n</script>\n\n<style scoped lang=\"scss\">\n.editor__content {\n\tmax-width: var(--text-editor-max-width);\n\tmargin: auto;\n\tposition: relative;\n\twidth: 100%;\n}\n\n.text-editor__content-wrapper {\n\t--side-width: calc((100% - var(--text-editor-max-width)) / 2);\n\tdisplay: grid;\n\tgrid-template-columns: 1fr auto;\n\t&.--show-outline {\n\t\tgrid-template-columns: var(--side-width) auto var(--side-width);\n\t}\n\t.text-editor__content-wrapper__left,\n\t.text-editor__content-wrapper__right {\n\t\theight: 100%;\n\t\tposition: relative;\n\t}\n}\n</style>\n"],"names":["_sfc_main","EditorContent","EditorOutline","useOutlineStateMixin","useOutlineActions","props","extensions","inject","editor","Editor","provideEditor","setContent","setEditable","useEditorMethods","watch","content"],"mappings":"wNAmCA,MAAAA,EAAA,CACA,KAAA,aACA,WAAA,CACA,cAAAC,EACA,cAAAC,CACA,EAEA,OAAA,CAAAC,EAAAC,CAAA,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,WAAAG,EAAA,YAAAC,CAAA,EAAAC,EAAAL,CAAA,EACA,OAAAM,EACA,IAAAT,EAAA,QACAU,GAAA,CACA,QAAA,KAAA,CAAA,QAAAA,CAAA,CAAA,EACAJ,EAAAI,CAAA,CACA,CACA,EACAH,EAAA,EAAA,EAIAD,EAAAN,EAAA,QAAA,CAAA,aAAA,EAAA,CAAA,EACA,CAAA,OAAAG,CAAA,CACA,EAEA,SAAA,CACA,aAAA,CACA,OAAA,KAAA,cAAA,OACA,CACA,EAEA,eAAA,CACA,KAAA,QAAA,QAAA,CACA,CACA"} |