From a4c2c039d2cc53380f45e6300dd2505eb05858b5 Mon Sep 17 00:00:00 2001 From: 409 <409dev@protonmail.com> Date: Sat, 6 Sep 2025 01:21:13 +0200 Subject: [PATCH] basic text editor --- backend/src/lib/outbound/file_system.rs | 1 + frontend/components/actions/UploadDialog.vue | 2 +- .../components/{ => viewers}/ImageViewer.vue | 15 +- frontend/components/viewers/TextEditor.vue | 152 ++++++++++++++++++ frontend/layouts/default.vue | 5 + frontend/layouts/share.vue | 8 +- frontend/lib/api/warrens.ts | 9 -- frontend/pages/share.vue | 27 +++- frontend/pages/warrens/files.vue | 29 +++- frontend/stores/index.ts | 3 - frontend/stores/viewers/image.ts | 13 ++ frontend/stores/viewers/index.ts | 4 + frontend/stores/viewers/text.ts | 71 ++++++++ 13 files changed, 315 insertions(+), 24 deletions(-) rename frontend/components/{ => viewers}/ImageViewer.vue (60%) create mode 100644 frontend/components/viewers/TextEditor.vue create mode 100644 frontend/stores/viewers/image.ts create mode 100644 frontend/stores/viewers/index.ts create mode 100644 frontend/stores/viewers/text.ts diff --git a/backend/src/lib/outbound/file_system.rs b/backend/src/lib/outbound/file_system.rs index 53784dc..3458d5b 100644 --- a/backend/src/lib/outbound/file_system.rs +++ b/backend/src/lib/outbound/file_system.rs @@ -214,6 +214,7 @@ impl FileSystem { let mut file = fs::OpenOptions::new() .write(true) .create(true) + .truncate(true) .open(&file_path) .await?; diff --git a/frontend/components/actions/UploadDialog.vue b/frontend/components/actions/UploadDialog.vue index f637a03..21fdc92 100644 --- a/frontend/components/actions/UploadDialog.vue +++ b/frontend/components/actions/UploadDialog.vue @@ -35,7 +35,7 @@ const fileInputElement = ref( const uploading = ref(false); const dropZoneRef = ref(); -const dropZone = useDropZone(dropZoneRef, { +useDropZone(dropZoneRef, { onDrop, multiple: true, }); diff --git a/frontend/components/ImageViewer.vue b/frontend/components/viewers/ImageViewer.vue similarity index 60% rename from frontend/components/ImageViewer.vue rename to frontend/components/viewers/ImageViewer.vue index 39a5b06..f80b202 100644 --- a/frontend/components/ImageViewer.vue +++ b/frontend/components/viewers/ImageViewer.vue @@ -1,18 +1,17 @@