@setoelkahfi / svara / commits / 4ef92e6

wip

Seto Elkahfi committed Apr 7, 2025 at 21:59 UTC 4ef92e6d7892f507ca535a32bda79372daf53326
6 files changed +15 -15
src/config/config.ts
+3 -3
@@ -3,7 +3,7 @@ import Mousetrap from "mousetrap";
3 import { getKeybinds } from "./commands";
4 import { path } from "@tauri-apps/api";
5 import { loadTheme } from "./themehandler";
6 -import { Store } from "@tauri-apps/plugin-store";
6 +import { load, Store } from "@tauri-apps/plugin-store";
7 import { setEditorFontFamily, setEditorFontSize, setEditorLineHeight, setEditorTabSize } from "../lib/Editor.svelte";
8 import { watch } from "@tauri-apps/plugin-fs";
9 import { info } from "tauri-plugin-log-api";
@@ -77,12 +77,12 @@ export let appSettings: Store;
77
78 export async function loadDefaultSettings() {
79 const appdataLocal = await path.appLocalDataDir();
80 - appSettings = new Store(`${appdataLocal}default_settings.json`);
80 + appSettings = await load(`${appdataLocal}default_settings.json`);
81
82 await watch(
83 `${appdataLocal}default_settings.json`,
84 () => {
85 - appSettings.load();
85 + appSettings;
86 }
87 )
88
src/lib/File.ts
+2 -2
@@ -11,8 +11,8 @@ import { closeBottomPanel } from "./Statusbar.svelte";
11 import { closeTerminal } from "./Terminal.svelte";
12 import * as dialog from "@tauri-apps/plugin-dialog"
13 import * as fs from "@tauri-apps/plugin-fs"
14 -import * as clipboard from "@tauri-apps/plugin-clipboard-manager"
14 import { invoke } from "@tauri-apps/api/core";
15 +import { readText } from '@tauri-apps/plugin-clipboard-manager';
16
17 export async function openFile() {
18 let newPath = await dialog.open() as string;
@@ -301,7 +301,7 @@ export async function readFile(path) {
301 }
302
303 export async function pasteFile(dest) {
304 - const copied = await clipboard.readText();
304 + const copied = await readText();
305 const filename = copied.split(path.sep).pop();
306 let newpath = `${dest}${path.sep}${filename}`;
307 if (!await fs.exists(copied) || await fs.exists(newpath))
src/lib/FileTree.svelte
+3 -3
@@ -6,7 +6,7 @@
6 import { } from "@tauri-apps/api";
7 import Button from "./utility/Button.svelte";
8 import { commands } from "../config/commands";
9 -import * as clipboard from "@tauri-apps/plugin-clipboard-manager"
9 + import { writeText } from "@tauri-apps/plugin-clipboard-manager";
10
11 let treeDom;
12 let contextmenu = false;
@@ -31,10 +31,10 @@ import * as clipboard from "@tauri-apps/plugin-clipboard-manager"
31 {name: "Open in File Explorer", shortcut: "", action: async () => commands.openInExplorer.command(path)},
32 {name: "New Folder...", shortcut: "", action: () => commands.createFolder.command(path)},
33 {name: "New File...", shortcut: "", action: () => {commands.createFile.command(path)}},
34 - {name: "Copy", shortcut: "Ctrl + C", action: async () => {await clipboard.writeText(path)}},
34 + {name: "Copy", shortcut: "Ctrl + C", action: async () => {await writeText(path)}},
35 {name: "Cut", disabled: true, shortcut: "Ctrl + X", action: () => {console.warn("Feature not implemented yet.")}},
36 {name: "Paste", shortcut: "Ctrl + V", action: async () => {await pasteFile(path)}},
37 - {name: "Copy Filename", shortcut: "", action: async () => {await clipboard.writeText(name)}},
37 + {name: "Copy Filename", shortcut: "", action: async () => {await writeText(name)}},
38 {name: "Rename...", shortcut: "F2", disabled: true, action: () => {console.warn("Feature not implemented yet.")}},
39 {name: "Delete", disabled: true, shortcut: "Delete", action: () => {console.warn("Feature not implemented yet.")}}
40 ]
src/lib/FileTree/FileTreeList.svelte
+3 -3
@@ -11,9 +11,9 @@
11 import {filetree} from "../FileTree.svelte";
12 import ContextMenu from "../utility/ContextMenu.svelte";
13 import { moveFile, moveToTrash, pasteFile } from "../File";
14 - import { clipboard } from "@tauri-apps/api";
14 import { onMount } from "svelte";
15 import { commands } from "../../config/commands";
16 + import { writeText } from "@tauri-apps/plugin-clipboard-manager";
17
18 export let root = false;
19 export let isroot = false;
@@ -40,10 +40,10 @@
40 {name: "Open in File Explorer", shortcut: commands.openInExplorer.keybind, action: async () => commands.openInExplorer.command(path)},
41 {name: "New Folder...", shortcut: "", action: () => commands.createFolder.command(path)},
42 {name: "New File...", shortcut: "", action: () => commands.createFile.command(path)},
43 - {name: "Copy", shortcut: "Ctrl + C", action: async () => {await clipboard.writeText(path)}},
43 + {name: "Copy", shortcut: "Ctrl + C", action: async () => {await writeText(path)}},
44 {name: "Cut", disabled: isroot, shortcut: "Ctrl + X", action: () => {console.warn("Feature not implemented yet.")}},
45 {name: "Paste", shortcut: "Ctrl + V", action: async () => {await pasteFile(path)}},
46 - {name: "Copy Filename", shortcut: "", action: async () => {await clipboard.writeText(name)}},
46 + {name: "Copy Filename", shortcut: "", action: async () => {await writeText(name)}},
47 {name: "Rename...", disabled: isroot, shortcut: commands.renameFile.keybind, action: () => {commands.renameFile.command(name, path)}},
48 {name: "Delete", disabled: isroot, shortcut: "Delete", action: async () => {await moveToTrash(path)}}
49 ]
src/lib/FileTree/FileTreeNode.svelte
+3 -3
@@ -20,8 +20,8 @@
20 import ContextMenu from "../utility/ContextMenu.svelte";
21 import { moveToTrash, openInExplorer, renameFile } from "../File";
22 import { addEditorTab } from "../EditorTabList.svelte";
23 - import { clipboard } from "@tauri-apps/api";
23 import { commands } from "../../config/commands";
24 + import { writeText } from "@tauri-apps/plugin-clipboard-manager";
25
26 export let id;
27 export let name;
@@ -39,9 +39,9 @@
39 let contextmenu = false;
40 let contextmenuitems = [
41 {name: "Open in File Explorer", shortcut: commands.openInExplorer.keybind, action: async () => {commands.openInExplorer.command(path)}},
42 - {name: "Copy", shortcut: "Ctrl + C", action: async () => {await clipboard.writeText(path)}},
42 + {name: "Copy", shortcut: "Ctrl + C", action: async () => {await writeText(path)}},
43 {name: "Cut", shortcut: "Ctrl + X", action: () => {console.warn("Feature not implemented yet.")}},
44 - {name: "Copy Filename", shortcut: "", action: async () => {await clipboard.writeText(name)}},
44 + {name: "Copy Filename", shortcut: "", action: async () => {await writeText(name)}},
45 {name: "Edit", shortcut: "", action: () => {addEditorTab(path, name)}},
46 {name: "Rename...", shortcut: commands.renameFile.keybind, action: () => {commands.renameFile.command(name, path)}},
47 {name: "Delete", shortcut: "Delete", action: async () => {await moveToTrash(path)}}
src/lib/Modals/RenameModal.svelte
+1 -1
@@ -5,7 +5,7 @@
5 import Button from "../utility/Button.svelte";
6 import { _openPopup } from "../../App.svelte";
7 import { checkValidFileName } from "../File";
8 - import { path as p, invoke } from "@tauri-apps/api/core";
8 + import { invoke } from "@tauri-apps/api/core";
9 import * as fs from "@tauri-apps/plugin-fs"
10
11 export let title;