mirror of
https://github.com/xlmnxp/extractify.zip.git
synced 2024-11-23 17:13:12 +03:00
41 lines
906 B
Vue
41 lines
906 B
Vue
{19655f0b57085c56e76b5b407ed2a1d0c18caa2b true 906 text-editor.vue 0xc00309f3b0}
<script lang="ts" setup>
|
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
|
|
import { ref, onMounted } from 'vue'
|
|
import { FilesManager } from '~/composables/files-manager';
|
|
// @ts-ignore
|
|
import { iFile } from '~/composables/worker/7zip-manager';
|
|
|
|
interface Props {
|
|
file: iFile,
|
|
filesManager: FilesManager
|
|
}
|
|
|
|
const editor = ref()
|
|
|
|
let { file, filesManager } = defineProps<Props>()
|
|
|
|
// files manager
|
|
onMounted(async () => {
|
|
const darkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
|
|
let fileContent = await filesManager.getFileContent(file.path);
|
|
monaco.editor.create(editor.value, {
|
|
value: fileContent?.toString()!,
|
|
language: file.extension,
|
|
readOnly: true,
|
|
theme: darkMode ? 'vs-dark' : 'vs-light'
|
|
})
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div id="editor" ref="editor"></div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
#editor {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
}
|
|
</style>
|