use serde::{Deserialize, Serialize}; use tauri::{AppHandle, Emitter}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ContextMenuInfo { pub x: f64, pub y: f64, pub client_x: f64, pub client_y: f64, pub tag_name: Option, pub src: Option, pub href: Option, pub text: Option, pub page_url: Option, } /// Called from the child WebView's contextmenu event handler. /// Emits the context menu info to the React shell which renders its own menu. #[tauri::command] pub fn browser_context_menu(app: AppHandle, info: ContextMenuInfo) -> Result<(), String> { app.emit("browser://context-menu", info).map_err(|e| e.to_string()) }