From f7531d1ce8998a60181b9b0d58176aea6169fefc Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Sun, 5 May 2024 15:48:34 +0800 Subject: [PATCH] fix(KeySetting): export key mapping failed --- package.json | 1 - src-tauri/Cargo.toml | 1 - src-tauri/capabilities/default.json | 2 -- src-tauri/src/main.rs | 1 - src/components/keyboard/KeySetting.vue | 4 ++-- 5 files changed, 2 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 23bd1d3..8f96ffa 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ }, "dependencies": { "@tauri-apps/api": ">=2.0.0-beta.8", - "@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.0", "@tauri-apps/plugin-http": "2.0.0-beta.3", "@tauri-apps/plugin-process": "2.0.0-beta.2", "@tauri-apps/plugin-shell": "2.0.0-beta.3", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index cdf1d98..88b0fd9 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -17,7 +17,6 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" anyhow = "1.0" tokio = { version = "1.36.0", features = ["rt-multi-thread", "net", "macros", "io-util", "time", "sync"] } -tauri-plugin-clipboard-manager = "2.1.0-beta.1" tauri-plugin-process = "2.0.0-beta.3" tauri-plugin-shell = "2.0.0-beta.4" tauri-plugin-http = "2.0.0-beta.7" diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 6c2fe4f..6f3aadd 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -22,8 +22,6 @@ "store:allow-clear", "store:allow-entries", "store:allow-delete", - "clipboard-manager:default", - "clipboard-manager:allow-write-text", "process:default", "process:allow-restart", "webview:default", diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 52b7eb2..da39b6f 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -145,7 +145,6 @@ async fn main() { .plugin(tauri_plugin_http::init()) .plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_process::init()) - .plugin(tauri_plugin_clipboard_manager::init()) .plugin(tauri_plugin_store::Builder::new().build()) .setup(|app| { let stores = app diff --git a/src/components/keyboard/KeySetting.vue b/src/components/keyboard/KeySetting.vue index d7a6186..aac5af6 100644 --- a/src/components/keyboard/KeySetting.vue +++ b/src/components/keyboard/KeySetting.vue @@ -15,7 +15,6 @@ import { import { computed, onActivated, onMounted, ref, watch } from "vue"; import { useGlobalStore } from "../../store/global"; import { Store } from "@tauri-apps/plugin-store"; -import { writeText } from "@tauri-apps/plugin-clipboard-manager"; import { loadDefaultKeyconfig } from "../../invoke"; import { KeyMappingConfig } from "../../keyMappingConfig"; import { useKeyboardStore } from "../../store/keyboard"; @@ -241,7 +240,8 @@ function renameKeyMappingConfig() { function exportKeyMappingConfig() { const config = store.keyMappingConfigList[store.curKeyMappingIndex]; const data = JSON.stringify(config, null, 2); - writeText(data) + navigator.clipboard + .writeText(data) .then(() => { message.success("当前按键方案已导出到剪切板"); })