%PDF- %PDF-
Direktori : /www/varak.net/nextcloud.varak.net/apps_old/apps/text/js/ |
Current File : //www/varak.net/nextcloud.varak.net/apps_old/apps/text/js/ViewerComponent-CvhNJemB.chunk.mjs.map |
{"version":3,"file":"ViewerComponent-CvhNJemB.chunk.mjs","sources":["../src/components/ViewerComponent.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<Editor v-if=\"!useSourceView\"\n\t\t:file-id=\"fileid\"\n\t\t:relative-path=\"filename\"\n\t\t:active=\"active || isEmbedded\"\n\t\t:autofocus=\"autofocus\"\n\t\t:share-token=\"shareToken\"\n\t\t:class=\"{ 'text-editor--embedding': isEmbedded }\"\n\t\t:mime=\"mime\"\n\t\t:show-outline-outside=\"showOutlineOutside\" />\n\t<div v-else\n\t\tid=\"editor-container\"\n\t\tdata-text-el=\"editor-container\"\n\t\tclass=\"text-editor source-viewer\">\n\t\t<Component :is=\"readerComponent\"\n\t\t\t:content=\"content\"\n\t\t\t:file-id=\"fileid\"\n\t\t\t:read-only=\"true\"\n\t\t\t:show-menu-bar=\"false\" />\n\t\t<NcButton v-if=\"isEmbedded\" class=\"toggle-interactive\" @click=\"toggleEdit\">\n\t\t\t{{ t('text', 'Edit') }}\n\t\t\t<template #icon>\n\t\t\t\t<PencilIcon />\n\t\t\t</template>\n\t\t</NcButton>\n\t</div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport axios from '@nextcloud/axios'\nimport PencilIcon from 'vue-material-design-icons/Pencil.vue'\nimport NcButton from '@nextcloud/vue/dist/Components/NcButton.js'\nimport PlainTextReader from './PlainTextReader.vue'\nimport MarkdownContentEditor from './Editor/MarkdownContentEditor.vue'\nimport { translate, translatePlural } from '@nextcloud/l10n'\n\nimport { getSharingToken } from '../helpers/token.js'\nimport getEditorInstance from './Editor.singleton.js'\n\nVue.prototype.t = translate\nVue.prototype.n = translatePlural\n\nexport default {\n\tname: 'ViewerComponent',\n\tcomponents: {\n\t\tNcButton: Vue.extend(NcButton),\n\t\tPencilIcon: Vue.extend(PencilIcon),\n\t\tPlainTextReader: Vue.extend(PlainTextReader),\n\t\tMarkdownContentEditor: Vue.extend(MarkdownContentEditor),\n\t\tEditor: getEditorInstance,\n\t},\n\tprovide() {\n\t\treturn {\n\t\t\tisEmbedded: this.isEmbedded,\n\t\t}\n\t},\n\tprops: {\n\t\tfilename: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\t\tfileid: {\n\t\t\ttype: Number,\n\t\t\tdefault: null,\n\t\t},\n\t\tactive: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t\tautofocus: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\t\tshareToken: {\n\t\t\ttype: String,\n\t\t\tdefault: () => getSharingToken(),\n\t\t},\n\t\tmime: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\t\tshowOutlineOutside: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t\tpermissions: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t\tsource: {\n\t\t\ttype: String,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tisEmbedded: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tdata() {\n\t\treturn {\n\t\t\tcontent: '',\n\t\t\thasToggledInteractiveEmbedding: false,\n\t\t}\n\t},\n\tcomputed: {\n\t\t/** @return {boolean} */\n\t\tuseSourceView() {\n\t\t\treturn this.source && (this.fileVersion || !this.fileid || this.isEmbedded) && !this.hasToggledInteractiveEmbedding\n\t\t},\n\n\t\t/** @return {boolean} */\n\t\treaderComponent() {\n\t\t\treturn this.mime === 'text/markdown' ? MarkdownContentEditor : PlainTextReader\n\t\t},\n\t},\n\n\twatch: {\n\t\tsource() {\n\t\t\tthis.loadFileContent()\n\t\t},\n\t},\n\n\tmounted() {\n\t\tthis.loadFileContent()\n\t},\n\n\tmethods: {\n\t\tt: translate,\n\t\tasync loadFileContent() {\n\t\t\tif (this.useSourceView) {\n\t\t\t\tconst response = await axios.get(this.source)\n\t\t\t\tthis.content = response.data\n\t\t\t\tthis.contentLoaded = true\n\t\t\t}\n\t\t\tthis.$emit('update:loaded', true)\n\t\t},\n\t\ttoggleEdit() {\n\t\t\tthis.hasToggledInteractiveEmbedding = true\n\t\t},\n\t},\n}\n</script>\n<style lang=\"scss\" scoped>\n.text-editor:not(.viewer__file--hidden) {\n\toverflow: scroll;\n\ttop: 0;\n\twidth: 100%;\n\tmax-width: 100%;\n\theight: 100%;\n\tleft: 0;\n\tmargin: 0 auto;\n\tposition: relative;\n\tbackground-color: var(--color-main-background);\n\n\t&.source-viewer {\n\t\tdisplay: block;\n\n\t\t.text-editor__content-wrapper {\n\t\t\tmargin-top: var(--header-height);\n\t\t}\n\n\t\t.toggle-interactive {\n\t\t\tposition: sticky;\n\t\t\tbottom: 0;\n\t\t\tright: 0;\n\t\t\tz-index: 1;\n\t\t\tmargin-left: auto;\n\t\t\tmargin-right: 0;\n\t\t}\n\t}\n\n\t&.text-editor--embedding {\n\t\tmin-height: 400px;\n\t}\n\n}\n</style>\n<style lang=\"scss\">\n@import './../css/variables';\n@media only screen and (max-width: 512px) {\n\t// on mobile, modal-container has top: 50px\n\t.text-editor {\n\t\ttop: auto;\n\t}\n}\n\n.viewer[data-handler='text'] .modal-wrapper .modal-container {\n\tbottom: 0;\n}\n</style>\n"],"names":["Vue","translate","translatePlural","_sfc_main","NcButton","PencilIcon","PlainTextReader","MarkdownContentEditor","getEditorInstance","getSharingToken","response","axios"],"mappings":";k8BA6CAA,EAAA,UAAA,EAAAC,EACAD,EAAA,UAAA,EAAAE,EAEA,MAAAC,EAAA,CACA,KAAA,kBACA,WAAA,CACA,SAAAH,EAAA,OAAAI,CAAA,EACA,WAAAJ,EAAA,OAAAK,CAAA,EACA,gBAAA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