mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-05 04:27:03 +00:00
some more fixes
This commit is contained in:
1 parent
7a3c04f170
commit
2b86a407ba
63 files changed
+12172
-44
No files matched your search
@@ -40,6 +40,9 @@ fn build_menu<R: Runtime>(handle: &tauri::AppHandle<R>) -> tauri::Result<Menu<R>
|
||||
let find = MenuItemBuilder::with_id("find", "Find…")
|
||||
.accelerator("CmdOrCtrl+F")
|
||||
.build(handle)?;
|
||||
let keyboard_shortcuts = MenuItemBuilder::with_id("keyboard-shortcuts", "Keyboard Shortcuts…")
|
||||
.accelerator("CmdOrCtrl+Shift+/")
|
||||
.build(handle)?;
|
||||
let report_issue =
|
||||
MenuItemBuilder::with_id("report-issue", "Report an Issue…").build(handle)?;
|
||||
|
||||
@@ -88,6 +91,11 @@ fn build_menu<R: Runtime>(handle: &tauri::AppHandle<R>) -> tauri::Result<Menu<R>
|
||||
edit.append_items(&[&PredefinedMenuItem::separator(handle)?, &find])?;
|
||||
}
|
||||
|
||||
let shortcuts = SubmenuBuilder::new(handle, "Shortcuts")
|
||||
.item(&keyboard_shortcuts)
|
||||
.build()?;
|
||||
menu.append(&shortcuts)?;
|
||||
|
||||
if let Some(help) = find_submenu("Help") {
|
||||
help.append_items(&[&report_issue])?;
|
||||
}
|
||||
@@ -151,6 +159,7 @@ pub fn run() {
|
||||
#[cfg_attr(mobile, allow(unused_mut))]
|
||||
let mut builder = tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
.plugin(tauri_plugin_dialog::init());
|
||||
|
||||
#[cfg(desktop)]
|
||||
@@ -188,6 +197,7 @@ pub fn run() {
|
||||
| "next-chapter"
|
||||
| "prev-chapter"
|
||||
| "report-issue"
|
||||
| "keyboard-shortcuts"
|
||||
) {
|
||||
app.emit("menu-action", event.id().0.as_str()).ok();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ pub(crate) fn library_dir(app: &tauri::AppHandle) -> Result<PathBuf, String> {
|
||||
|
||||
fn book_path(app: &tauri::AppHandle, id: &str) -> Result<PathBuf, String> {
|
||||
if id.is_empty() || !id.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_') {
|
||||
return Err("invalid book id".to_string());
|
||||
return Err("invalid project id".to_string());
|
||||
}
|
||||
Ok(library_dir(app)?.join(format!("{id}.margin")))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user