+
+
+
+
+
+ {{ store.prefs.searchHotkey }}
+
+
+
Order
1
2
3
+
@@ -49,6 +57,7 @@ const textInputFocused = ref(false)
const props = defineProps<{
path: Array
query: string
+ editorMode?: boolean
}>()
const isInputElement = (el: Element | null): boolean => {
diff --git a/frontend/src/repositories/Document.ts b/frontend/src/repositories/Document.ts
index 6c474f0..bf42a4f 100644
--- a/frontend/src/repositories/Document.ts
+++ b/frontend/src/repositories/Document.ts
@@ -89,6 +89,14 @@ export class Doc {
get print(): boolean {
return (FILE_TYPES.print as readonly string[]).includes(this.ext)
}
+ get text(): boolean {
+ return (FILE_TYPES.text as readonly string[]).includes(this.ext)
+ }
+ get editurl(): string {
+ if (!this.text) return ''
+ const p = this.loc ? `${this.loc}/${this.name}` : this.name
+ return '/#/edit/' + p.replaceAll('?', '%3F').replaceAll('#', '%23')
+ }
get complete(): boolean {
return !this.ghost && (this.dir || this.size <= this.allocated)
}
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 28d3c34..c5da96f 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -1,5 +1,6 @@
import { useMainStore } from '@/stores/main'
import ExplorerView from '@/views/ExplorerView.vue'
+import TextEditorView from '@/views/TextEditorView.vue'
import { createRouter, createWebHashHistory } from 'vue-router'
function getPathDepth(path: string): number {
@@ -10,6 +11,11 @@ function getPathDepth(path: string): number {
const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [
+ {
+ path: '/edit/:pathMatch(.*)*',
+ name: 'editor',
+ component: TextEditorView
+ },
{
path: '/:pathMatch(.*)*',
name: 'explorer',
diff --git a/frontend/src/stores/main.ts b/frontend/src/stores/main.ts
index 91efd14..f3a67c4 100644
--- a/frontend/src/stores/main.ts
+++ b/frontend/src/stores/main.ts
@@ -99,6 +99,7 @@ export const useMainStore = defineStore('main', {
isLoggedIn: false as boolean
},
transitionDirection: 'none' as 'forward' | 'backward' | 'none',
+ editorSave: null as null | (() => void),
space: {
disk: 0,
free: 0,
@@ -327,6 +328,7 @@ export const useMainStore = defineStore('main', {
this.connected = false
this.dialog = ''
this.cursor = ''
+ this.editorSave = null
},
async logout() {
console.log('Logout')
diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts
index 61f345a..317c2a0 100644
--- a/frontend/src/utils/index.ts
+++ b/frontend/src/utils/index.ts
@@ -77,7 +77,65 @@ export const FILE_TYPES = {
imageBrowser: ['avif', 'gif', 'jpg', 'jpeg', 'png', 'webp', 'svg'],
// Images that require server-side preview (browsers cannot display them natively)
image: ['bmp', 'heic', 'heif', 'ico', 'tif', 'tiff'],
- print: ['epub', 'mobi', 'pdf']
+ print: ['epub', 'mobi', 'pdf'],
+ text: [
+ 'txt',
+ 'md',
+ 'json',
+ 'xml',
+ 'yaml',
+ 'yml',
+ 'toml',
+ 'ini',
+ 'conf',
+ 'config',
+ 'cfg',
+ 'log',
+ 'csv',
+ 'tsv',
+ 'py',
+ 'js',
+ 'ts',
+ 'jsx',
+ 'tsx',
+ 'html',
+ 'htm',
+ 'css',
+ 'scss',
+ 'sass',
+ 'less',
+ 'vue',
+ 'php',
+ 'rb',
+ 'go',
+ 'rs',
+ 'java',
+ 'c',
+ 'cpp',
+ 'h',
+ 'hpp',
+ 'cs',
+ 'swift',
+ 'kt',
+ 'sh',
+ 'bash',
+ 'zsh',
+ 'fish',
+ 'ps1',
+ 'bat',
+ 'cmd',
+ 'sql',
+ 'lua',
+ 'r',
+ 'pl',
+ 'dockerfile',
+ 'makefile',
+ 'gitignore',
+ 'gitattributes',
+ 'env',
+ 'diff',
+ 'patch'
+ ]
} as const
export type FileCategory = keyof typeof FILE_TYPES
diff --git a/frontend/src/views/TextEditorView.vue b/frontend/src/views/TextEditorView.vue
new file mode 100644
index 0000000..1ffc0f3
--- /dev/null
+++ b/frontend/src/views/TextEditorView.vue
@@ -0,0 +1,172 @@
+
+
+
+
Loading…
+
{{ error }}
+
+
+
+
+
+
+
+