mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-28 16:00:48 +00:00
fix: disable some default webview behaviors
This commit is contained in:
parent
bcc5e18082
commit
26ae473521
47
src-tauri/Cargo.lock
generated
47
src-tauri/Cargo.lock
generated
@ -2622,6 +2622,15 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.8"
|
||||
@ -2957,6 +2966,7 @@ dependencies = [
|
||||
"tauri-plugin-http",
|
||||
"tauri-plugin-notification",
|
||||
"tauri-plugin-os",
|
||||
"tauri-plugin-prevent-default",
|
||||
"tauri-plugin-process",
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-theme",
|
||||
@ -5214,6 +5224,28 @@ version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.26.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.6.1"
|
||||
@ -5644,6 +5676,21 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-prevent-default"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23ee986aa5872bfa37762e06d86e60325f721d602a436165f4be34a16ff8ae3e"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"itertools",
|
||||
"serde",
|
||||
"strum",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-process"
|
||||
version = "2.0.0-rc.0"
|
||||
|
@ -36,6 +36,7 @@ tauri-plugin-updater = "2.0.0-rc"
|
||||
tauri-plugin-upload = "2.0.0-rc"
|
||||
tauri-plugin-theme = "0.4.1"
|
||||
tauri-plugin-decorum = "1.0.0"
|
||||
tauri-plugin-prevent-default = "0.3"
|
||||
tauri-specta = { version = "2.0.0-rc.15", features = ["derive", "typescript"] }
|
||||
specta = "^2.0.0-rc.20"
|
||||
specta-typescript = "0.0.7"
|
||||
|
@ -34,7 +34,6 @@
|
||||
"updater:default",
|
||||
"updater:allow-check",
|
||||
"updater:allow-download-and-install",
|
||||
"core:window:allow-start-dragging",
|
||||
"core:window:allow-create",
|
||||
"core:window:allow-close",
|
||||
"core:window:allow-destroy",
|
||||
@ -63,8 +62,8 @@
|
||||
"theme:allow-get-theme",
|
||||
"core:menu:allow-new",
|
||||
"core:menu:allow-popup",
|
||||
"http:default",
|
||||
"shell:allow-open",
|
||||
"prevent-default:default",
|
||||
{
|
||||
"identifier": "http:default",
|
||||
"allow": [
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","local":true,"windows":["main","panel","settings","search-*","zap-*","event-*","user-*","editor-*"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","os:allow-os-type","updater:default","updater:allow-check","updater:allow-download-and-install","core:window:allow-start-dragging","core:window:allow-create","core:window:allow-close","core:window:allow-destroy","core:window:allow-set-focus","core:window:allow-center","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-set-size","core:window:allow-set-focus","core:window:allow-start-dragging","decorum:allow-show-snap-overlay","clipboard-manager:allow-write-text","clipboard-manager:allow-read-text","core:webview:allow-create-webview-window","core:webview:allow-create-webview","core:webview:allow-set-webview-size","core:webview:allow-set-webview-position","core:webview:allow-webview-close","dialog:allow-open","dialog:allow-ask","dialog:allow-message","process:allow-restart","process:allow-exit","fs:allow-read-file","theme:allow-set-theme","theme:allow-get-theme","core:menu:allow-new","core:menu:allow-popup","http:default","shell:allow-open",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"},{"path":"$RESOURCE/resources/*"}]}],"platforms":["linux","macOS","windows"]}}
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","local":true,"windows":["main","panel","settings","search-*","zap-*","event-*","user-*","editor-*"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","os:allow-os-type","updater:default","updater:allow-check","updater:allow-download-and-install","core:window:allow-create","core:window:allow-close","core:window:allow-destroy","core:window:allow-set-focus","core:window:allow-center","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-set-size","core:window:allow-set-focus","core:window:allow-start-dragging","decorum:allow-show-snap-overlay","clipboard-manager:allow-write-text","clipboard-manager:allow-read-text","core:webview:allow-create-webview-window","core:webview:allow-create-webview","core:webview:allow-set-webview-size","core:webview:allow-set-webview-position","core:webview:allow-webview-close","dialog:allow-open","dialog:allow-ask","dialog:allow-message","process:allow-restart","process:allow-exit","fs:allow-read-file","theme:allow-set-theme","theme:allow-get-theme","core:menu:allow-new","core:menu:allow-popup","shell:allow-open","prevent-default:default",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"},{"path":"$RESOURCE/resources/*"}]}],"platforms":["linux","macOS","windows"]}}
|
@ -7054,6 +7054,41 @@
|
||||
"os:deny-version"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:default -> Default permissions for the prevent-default plugin",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:allow-keyboard -> Enables the keyboard command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:allow-keyboard"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:allow-pointer -> Enables the pointer command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:allow-pointer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:deny-keyboard -> Denies the keyboard command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:deny-keyboard"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:deny-pointer -> Denies the pointer command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:deny-pointer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "process:default -> This permission set configures which\nprocess feeatures are by default exposed.\n\n#### Granted Permissions\n\nThis enables to quit via `allow-exit` and restart via `allow-restart`\nthe application.\n",
|
||||
"type": "string",
|
||||
|
@ -7054,6 +7054,41 @@
|
||||
"os:deny-version"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:default -> Default permissions for the prevent-default plugin",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:allow-keyboard -> Enables the keyboard command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:allow-keyboard"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:allow-pointer -> Enables the pointer command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:allow-pointer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:deny-keyboard -> Denies the keyboard command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:deny-keyboard"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prevent-default:deny-pointer -> Denies the pointer command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prevent-default:deny-pointer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "process:default -> This permission set configures which\nprocess feeatures are by default exposed.\n\n#### Granted Permissions\n\nThis enables to quit via `allow-exit` and restart via `allow-restart`\nthe application.\n",
|
||||
"type": "string",
|
||||
|
@ -10,6 +10,8 @@ use tauri::window::Effect;
|
||||
use tauri::TitleBarStyle;
|
||||
use tauri::WebviewWindowBuilder;
|
||||
use tauri::{LogicalPosition, LogicalSize, Manager, WebviewUrl};
|
||||
#[cfg(target_os = "windows")]
|
||||
use tauri_plugin_decorum::WebviewWindowExt;
|
||||
|
||||
#[derive(Serialize, Deserialize, Type)]
|
||||
pub struct Window {
|
||||
@ -132,7 +134,7 @@ pub fn reload_column(label: String, app_handle: tauri::AppHandle) -> Result<(),
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn open_window(window: Window, app_handle: tauri::AppHandle) -> Result<(), String> {
|
||||
if let Some(window) = app_handle.get_window(&window.label) {
|
||||
@ -152,7 +154,7 @@ pub fn open_window(window: Window, app_handle: tauri::AppHandle) -> Result<(), S
|
||||
.title(&window.title)
|
||||
.min_inner_size(window.width, window.height)
|
||||
.inner_size(window.width, window.height)
|
||||
.hidden_title(window.hidden_title)
|
||||
.hidden_title(true)
|
||||
.title_bar_style(TitleBarStyle::Overlay)
|
||||
.minimizable(window.minimizable)
|
||||
.maximizable(window.maximizable)
|
||||
@ -178,7 +180,6 @@ pub fn open_window(window: Window, app_handle: tauri::AppHandle) -> Result<(), S
|
||||
.minimizable(window.minimizable)
|
||||
.maximizable(window.maximizable)
|
||||
.transparent(true)
|
||||
.decoration(false)
|
||||
.effects(WindowEffectsConfig {
|
||||
state: None,
|
||||
effects: vec![Effect::Mica],
|
||||
@ -217,6 +218,10 @@ pub fn open_main_window(app: tauri::AppHandle) {
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
// Set decoration
|
||||
#[cfg(target_os = "windows")]
|
||||
window.create_overlay_titlebar().unwrap();
|
||||
|
||||
// Restore native border
|
||||
#[cfg(target_os = "macos")]
|
||||
window.add_border(None);
|
||||
|
@ -246,6 +246,7 @@ fn main() {
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.plugin(tauri_plugin_prevent_default::init())
|
||||
.plugin(tauri_plugin_theme::init(ctx.config_mut()))
|
||||
.plugin(tauri_plugin_decorum::init())
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
|
@ -29,17 +29,13 @@ function Screen() {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
return (
|
||||
<div className="h-full flex flex-col">
|
||||
<div
|
||||
data-tauri-drag-region
|
||||
className="shrink-0 h-8 w-full border-b border-black/5 dark:border-white/5"
|
||||
/>
|
||||
<div data-tauri-drag-region className="h-full flex flex-col">
|
||||
<ScrollArea.Root
|
||||
type={"scroll"}
|
||||
scrollHideDelay={300}
|
||||
className="overflow-hidden size-full flex-1"
|
||||
>
|
||||
<ScrollArea.Viewport ref={ref} className="h-full p-3">
|
||||
<ScrollArea.Viewport ref={ref} className="h-full pt-12 px-3 pb-3">
|
||||
<RootEvent />
|
||||
<Virtualizer scrollRef={ref}>
|
||||
<ReplyList />
|
||||
|
Loading…
Reference in New Issue
Block a user