1 line
2.2 KiB
Plaintext
1 line
2.2 KiB
Plaintext
{"version":3,"mappings":";yLAgBA,SAASA,GAA2B,CACnC,OAAMC,EAAA,IAAC,OAAO,sCAAkC,qHACjD,CAEI,OAAO,IAAI,OAAW,IACzBC,EAAO,MAAM,6BAA6B,EAE1C,IAAI,OAAO,gBAAgB,CAC1B,GAAI,OACJ,MAAO,CAAC,GAAGC,EAAuB,GAAGC,CAAsB,EAC3D,UAAWJ,EACX,MAAO,KACP,MAAO,UACP,WAAY,GACZ,iBAAkB,MAAOK,GAAa,CAErC,MAAMC,EAAU,OAAO,KAAK,MAAM,iBAClC,GAAIA,aAAmB,KACtB,UAAWC,KAAUD,EACpB,GAAIC,GAAQ,SAAWF,EAAS,QAAUE,GAAQ,MAAO,CACxDL,EAAO,MAAM,8BAA+B,CAC3C,OAAQG,EAAS,MACxB,CAAO,EACD,MAAME,EAAO,KAAI,EACjB,MACD,EAGH,CACF,CAAE","names":["AsyncTextViewerComponent","__vitePreload","logger","openMimetypesMarkdown","openMimetypesPlainText","fileInfo","editors","editor"],"ignoreList":[],"sources":["../src/viewer.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n// eslint-disable-next-line import/no-unresolved, n/no-missing-import\nimport 'vite/modulepreload-polyfill'\n\nimport { logger } from './helpers/logger.js'\nimport { openMimetypesMarkdown, openMimetypesPlainText } from './helpers/mime.js'\n\n/**\n * Wrapper for async registration of ViewerComponent.\n * Note: it should be named function - the name is used for component registration.\n *\n * @return {Promise<import('./components/ViewerComponent.vue')>} ViewerComponent\n */\nfunction AsyncTextViewerComponent() {\n\treturn import('./components/ViewerComponent.vue')\n}\n\nif (typeof OCA.Viewer === 'undefined') {\n\tlogger.error('Viewer app is not installed')\n} else {\n\tOCA.Viewer.registerHandler({\n\t\tid: 'text',\n\t\tmimes: [...openMimetypesMarkdown, ...openMimetypesPlainText],\n\t\tcomponent: AsyncTextViewerComponent,\n\t\tgroup: null,\n\t\ttheme: 'default',\n\t\tcanCompare: true,\n\t\tdownloadCallback: async (fileInfo) => {\n\t\t\t// Save any unsaved changes before download\n\t\t\tconst editors = window.OCA?.Text?.editorComponents\n\t\t\tif (editors instanceof Set) {\n\t\t\t\tfor (const editor of editors) {\n\t\t\t\t\tif (editor?.fileId === fileInfo.fileid && editor?.dirty) {\n\t\t\t\t\t\tlogger.debug('Saving file before download', {\n\t\t\t\t\t\t\tfileId: fileInfo.fileid,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tawait editor.save()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t})\n}\n"],"file":"text-viewer.mjs"} |