From a2ec32f60629481a059fd0f874beb9d86d41f804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20FRERE?= Date: Thu, 21 Nov 2024 23:47:00 +0100 Subject: [PATCH] Updates Tauri to 2.1.1 and fixes the menu to repair all Edit function (copy/paste/cut/select-all/undo/redo) --- package.json | 5 +- pnpm-lock.yaml | 10 ++- src-tauri/Cargo.lock | 150 ++++++++++++++++---------------------- src-tauri/Cargo.toml | 6 +- src-tauri/src/main.rs | 95 ++++++++++-------------- src-tauri/tauri.conf.json | 2 +- 6 files changed, 117 insertions(+), 151 deletions(-) diff --git a/package.json b/package.json index 38b119e..771cd13 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tibetan-translator", - "version": "0.9.9", + "version": "0.9.10", "description": "An attempt at providing access to the best Tibetan dictionaries in a pleasant interface for all devices.", "author": "Lekshe (Jeremy FRERE)", "keywords": [ @@ -51,7 +51,8 @@ "@babel/node": "^7.22.19", "@babel/plugin-proposal-optional-chaining": "^7.21.0", "@babel/preset-env": "^7.23.3", - "@tauri-apps/cli": "2.1.0", + "@tauri-apps/api": "^2.1.1", + "@tauri-apps/cli": "^2.1.1", "@vue/cli-plugin-pwa": "^5.0.8", "@vue/cli-service": "^5.0.8", "babel-loader": "^9.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 932fb3f..09dcdf2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,8 +69,11 @@ importers: '@babel/preset-env': specifier: ^7.23.3 version: 7.24.7(@babel/core@7.24.7) + '@tauri-apps/api': + specifier: ^2.1.1 + version: 2.1.1 '@tauri-apps/cli': - specifier: 2.1.0 + specifier: ^2.1.0 version: 2.1.0 '@vue/cli-plugin-pwa': specifier: ^5.0.8 @@ -868,6 +871,9 @@ packages: '@surma/rollup-plugin-off-main-thread@2.2.3': resolution: {integrity: sha512-lR8q/9W7hZpMWweNiAKU7NQerBnzQQLvi8qnTDU/fxItPhtZVMbPV3lbCwjhIlNBe9Bbr5V+KHshvWmVSG9cxQ==} + '@tauri-apps/api@2.1.1': + resolution: {integrity: sha512-fzUfFFKo4lknXGJq8qrCidkUcKcH2UHhfaaCNt4GzgzGaW2iS26uFOg4tS3H4P8D6ZEeUxtiD5z0nwFF0UN30A==} + '@tauri-apps/cli-darwin-arm64@2.1.0': resolution: {integrity: sha512-ESc6J6CE8hl1yKH2vJ+ALF+thq4Be+DM1mvmTyUCQObvezNCNhzfS6abIUd3ou4x5RGH51ouiANeT3wekU6dCw==} engines: {node: '>= 10'} @@ -5345,6 +5351,8 @@ snapshots: magic-string: 0.25.9 string.prototype.matchall: 4.0.11 + '@tauri-apps/api@2.1.1': {} + '@tauri-apps/cli-darwin-arm64@2.1.0': optional: true diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index bc538ee..9f4554b 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "TibetanTranslator" -version = "0.9.8" +version = "0.9.9" dependencies = [ "open", "serde", @@ -280,7 +280,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a969e13a7589e9e3e4207e153bae624ade2b5622fb4684a4923b23ec3d57719" dependencies = [ "serde", - "toml 0.8.19", + "toml 0.8.2", ] [[package]] @@ -507,7 +507,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -517,7 +517,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" dependencies = [ "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -541,7 +541,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -552,7 +552,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -575,7 +575,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -623,7 +623,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -646,7 +646,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -694,7 +694,7 @@ dependencies = [ "cc", "memchr", "rustc_version", - "toml 0.8.19", + "toml 0.8.2", "vswhom", "winreg", ] @@ -774,7 +774,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -842,7 +842,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1082,11 +1082,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" dependencies = [ "heck 0.4.1", - "proc-macro-crate 2.0.0", + "proc-macro-crate 2.0.2", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1165,7 +1165,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1444,7 +1444,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1899,10 +1899,10 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate 2.0.2", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2328,7 +2328,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2435,20 +2435,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" -dependencies = [ - "toml_edit 0.20.7", -] - -[[package]] -name = "proc-macro-crate" -version = "3.2.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" dependencies = [ - "toml_edit 0.22.22", + "toml_datetime", + "toml_edit 0.20.2", ] [[package]] @@ -2483,9 +2475,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2735,7 +2727,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2801,7 +2793,7 @@ checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2812,7 +2804,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2835,7 +2827,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2886,7 +2878,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -3085,9 +3077,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.87" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -3111,7 +3103,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -3123,7 +3115,7 @@ dependencies = [ "cfg-expr", "heck 0.5.0", "pkg-config", - "toml 0.8.19", + "toml 0.8.2", "version-compare", ] @@ -3174,7 +3166,7 @@ checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -3251,7 +3243,7 @@ dependencies = [ "serde_json", "tauri-utils", "tauri-winres", - "toml 0.8.19", + "toml 0.8.2", "walkdir", ] @@ -3273,7 +3265,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "syn 2.0.87", + "syn 2.0.89", "tauri-utils", "thiserror 2.0.3", "time", @@ -3291,7 +3283,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "tauri-codegen", "tauri-utils", ] @@ -3371,7 +3363,7 @@ dependencies = [ "serde_with", "swift-rs", "thiserror 2.0.3", - "toml 0.8.19", + "toml 0.8.2", "url", "urlpattern", "uuid", @@ -3431,7 +3423,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -3442,7 +3434,7 @@ checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -3528,21 +3520,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.19" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.22", + "toml_edit 0.20.2", ] [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ "serde", ] @@ -3557,31 +3549,20 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap 2.6.0", - "toml_datetime", - "winnow 0.5.40", + "winnow", ] [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.20", + "winnow", ] [[package]] @@ -3611,9 +3592,9 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c92af36a182b46206723bdf8a7942e20838cde1cf062e5b97854d57eb01763b" +checksum = "d48a05076dd272615d03033bf04f480199f7d1b66a8ac64d75c625fc4a70c06b" dependencies = [ "core-graphics", "crossbeam-channel", @@ -3838,7 +3819,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "wasm-bindgen-shared", ] @@ -3872,7 +3853,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3972,7 +3953,7 @@ checksum = "1d228f15bba3b9d56dde8bddbee66fa24545bd17b48d5128ccf4a8742b18e431" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -4071,7 +4052,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -4082,7 +4063,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -4347,15 +4328,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winnow" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.52.0" @@ -4462,7 +4434,7 @@ checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "synstructure", ] @@ -4484,7 +4456,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -4504,7 +4476,7 @@ checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "synstructure", ] @@ -4527,5 +4499,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 082f6f1..68aa67d 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "TibetanTranslator" -version = "0.9.9" +version = "0.9.10" description = "An attempt at providing access to the best Tibetan dictionaries in a pleasant interface for all devices." authors = ["Lekshe (Jeremy FRERE)"] license = "MIT" @@ -15,10 +15,10 @@ name = "app_lib" crate-type = ["staticlib", "cdylib", "rlib"] [build-dependencies] -tauri-build = { version = "2.0.0-rc.0", features = [] } +tauri-build = { version = "2.0.0-rc.13", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "2.0.0-rc.2", features = [] } +tauri = { version = "2.1.1", features = [] } open = "5.0" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 631a2fb..46e568b 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -use tauri::menu::{Menu, Submenu, MenuItem}; +use tauri::menu::{Menu, Submenu, MenuItem, SubmenuBuilder, MenuItemBuilder, AboutMetadata}; fn main() { tauri::Builder::default() @@ -9,47 +9,6 @@ fn main() { let app_menu = Menu::new(app_handle).unwrap(); - // Add version number as non-clickable menu item - let version_menu = MenuItem::with_id( - app_handle, - "version", - format!("Version {}", env!("CARGO_PKG_VERSION")), - false, // Set to false to make it non-clickable - None::<&str> - ).unwrap(); - - // Add separator - let separator = MenuItem::new( - app_handle, - "-------------", // empty text for separator - false, // disabled - None::<&str> - ).unwrap(); - - let website_menu = MenuItem::with_id( - app_handle, - "website", - "Website", - true, - None::<&str> - ).unwrap(); - - let github_menu = MenuItem::with_id( - app_handle, - "github", - "Source code", - true, - None::<&str> - ).unwrap(); - - let support_menu = MenuItem::with_id( - app_handle, - "support", - "Support me", - true, - None::<&str> - ).unwrap(); - let feature_menu = MenuItem::with_id( app_handle, "feature", @@ -69,16 +28,48 @@ fn main() { let contact_menu = MenuItem::with_id( app_handle, "contact", - "Contact me", + "Contact the author", true, None::<&str> ).unwrap(); - let app_submenu = Submenu::new( - app_handle, - "App", - true - ).unwrap(); + let website = MenuItemBuilder::new("Project website") + .id("website") + .build(app)?; + + let github = MenuItemBuilder::new("Source code on Github") + .id("github") + .build(app)?; + + let support = MenuItemBuilder::new("Support the author") + .id("support") + .build(app)?; + + let app_submenu = SubmenuBuilder::new(app, "App") + .about(Some(AboutMetadata { + ..Default::default() + })) + .separator() + .item(&website) + .item(&github) + .item(&support) + .separator() + .services() + .separator() + .hide() + .hide_others() + .quit() + .build()?; + + let edit_submenu = SubmenuBuilder::new(app, "Edit") + .undo() + .redo() + .separator() + .cut() + .copy() + .paste() + .select_all() + .build()?; let help_submenu = Submenu::new( app_handle, @@ -86,19 +77,13 @@ fn main() { true ).unwrap(); - // Build the menu structure - app_submenu.append(&version_menu).unwrap(); - app_submenu.append(&separator).unwrap(); // Add separator after version - app_submenu.append(&website_menu).unwrap(); - app_submenu.append(&github_menu).unwrap(); - app_submenu.append(&support_menu).unwrap(); - help_submenu.append(&feature_menu).unwrap(); help_submenu.append(&bug_menu).unwrap(); help_submenu.append(&contact_menu).unwrap(); let menu = app_menu; menu.append(&app_submenu).unwrap(); + menu.append(&edit_submenu).unwrap(); menu.append(&help_submenu).unwrap(); app.set_menu(menu).unwrap(); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 9b1f132..ccdaf94 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "TibetanTranslator", - "version": "0.9.9", + "version": "0.9.10", "identifier": "com.jerefrer.TibetanTranslator", "build": { "frontendDist": "../dist",