Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
fix(window): always let the page handle drag and drop
Tw93f62e72252e0f
diff --git a/bin/helpers/cli-program.ts b/bin/helpers/cli-program.tsindex 7cb63f80..0990d706 100644--- a/bin/helpers/cli-program.ts+++ b/bin/helpers/cli-program.ts@@ -209,7 +209,7 @@ ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with.addOption(new Option('--enable-drag-drop',- "Use Tauri's file-drop handler (pages stop receiving file drops)",+ 'Deprecated and ignored: pages handle drag and drop by default',).default(DEFAULT.enableDragDrop).hideHelp(),diff --git a/bin/helpers/merge.ts b/bin/helpers/merge.tsindex acf49ff7..426b3153 100644--- a/bin/helpers/merge.ts+++ b/bin/helpers/merge.ts@@ -58,7 +58,6 @@ export function buildWindowConfigOverrides(password_autosave: options.passwordAutosave,title: options.title,enable_wasm: options.wasm,- enable_drag_drop: options.enableDragDrop,start_to_tray: options.startToTray && options.showSystemTray,force_internal_navigation: options.forceInternalNavigation,internal_url_regex: options.internalUrlRegex,diff --git a/bin/types.ts b/bin/types.tsindex c99f85bf..f95ac86c 100644--- a/bin/types.ts+++ b/bin/types.ts@@ -202,7 +202,6 @@ export interface WindowConfig {password_autosave: boolean;title?: string;enable_wasm: boolean;- enable_drag_drop: boolean;start_to_tray: boolean;force_internal_navigation: boolean;internal_url_regex: string;diff --git a/dist/cli.js b/dist/cli.jsindex e6a14321..b6b6eaf0 100644--- a/dist/cli.js+++ b/dist/cli.js@@ -963,7 +963,6 @@ function buildWindowConfigOverrides(options, platform = asSupportedPlatform(procpassword_autosave: options.passwordAutosave,title: options.title,enable_wasm: options.wasm,- enable_drag_drop: options.enableDragDrop,start_to_tray: options.startToTray && options.showSystemTray,force_internal_navigation: options.forceInternalNavigation,internal_url_regex: options.internalUrlRegex,@@ -3737,7 +3736,7 @@ ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with.addOption(new Option('--wasm', 'Enable WebAssembly support (Flutter Web, etc.)').default(DEFAULT_PAKE_OPTIONS.wasm).hideHelp())- .addOption(new Option('--enable-drag-drop', "Use Tauri's file-drop handler (pages stop receiving file drops)")+ .addOption(new Option('--enable-drag-drop', 'Deprecated and ignored: pages handle drag and drop by default').default(DEFAULT_PAKE_OPTIONS.enableDragDrop).hideHelp()).addOption(new Option('--keep-binary', 'Keep raw binary file alongside installer')diff --git a/docs/cli-usage.md b/docs/cli-usage.mdindex e2a9f2ff..85002779 100644--- a/docs/cli-usage.md+++ b/docs/cli-usage.md@@ -489,14 +489,6 @@ This option adds necessary HTTP headers (`Cross-Origin-Opener-Policy: same-origipake https://flutter.dev --name FlutterApp --wasm```-#### [enable-drag-drop]--Turn on Tauri's own file-drop handler for the window. Default is `false`. You do not need it for a site's drag and drop: with the default, the page itself handles dragging items to reorder them and dragging files in to upload, as it does in a browser. With the flag, Tauri takes file drops before the page sees them, so dropping a file onto an upload area or file input does nothing, and on Windows the page's HTML5 drag and drop stops working as well. Pake apps do not use the events this handler sends, so leave it off unless you have a specific reason to test it.--```shell---enable-drag-drop-```-#### [keep-binary]Keep the raw binary file alongside the installer. Default is `false`. When enabled, also outputs a standalone executable that can run without installation.diff --git a/docs/cli-usage_CN.md b/docs/cli-usage_CN.mdindex 9162bf46..1ff1cd85 100644--- a/docs/cli-usage_CN.md+++ b/docs/cli-usage_CN.md@@ -487,14 +487,6 @@ pake https://www.rememberthemilk.com --name RememberTheMilk --no-restore-last-urpake https://flutter.dev --name FlutterApp --wasm```-#### [enable-drag-drop]--打开 Tauri 自己的文件拖放处理,默认为 `false`。网页里的拖拽不需要它,默认情况下拖动元素排序、把文件拖进来上传都由网页自己处理,和在浏览器里一样;加上这个参数后,Tauri 会先截下拖进来的文件,拖到上传区域或文件输入框上没有反应,Windows 上网页的 HTML5 拖拽也会失效。Pake 应用不使用这个处理发出的事件,没有特别需要就不要加。--```shell---enable-drag-drop-```-#### [keep-binary]构建后保留免安装的独立运行文件,默认为 `false`,除各平台标准安装包外,还会在当前目录额外输出二进制(Unix 为 `AppName-binary`,Windows 为 `AppName.exe`),使用 `--windows-toolchain gnu` 时同步输出 `WebView2Loader.dll`。diff --git a/schema/pake.schema.json b/schema/pake.schema.jsonindex f3927d83..31284233 100644--- a/schema/pake.schema.json+++ b/schema/pake.schema.json@@ -176,7 +176,7 @@},"enableDragDrop": {"type": "boolean",- "description": "Use Tauri's file-drop handler instead of the page's own drag and drop. Off by default; when on, files dropped on the page do not reach it.",+ "description": "Deprecated and ignored. Pages handle drag and drop and file drops by default.","default": false},"keepBinary": {diff --git a/src-tauri/pake.json b/src-tauri/pake.jsonindex b1e872af..4fb760e1 100644--- a/src-tauri/pake.json+++ b/src-tauri/pake.json@@ -17,7 +17,6 @@"incognito": false,"password_autosave": false,"enable_wasm": false,- "enable_drag_drop": false,"maximize": false,"start_to_tray": false,"force_internal_navigation": false,diff --git a/src-tauri/src/app/config.rs b/src-tauri/src/app/config.rsindex 46cf14ba..ed8bfc74 100644--- a/src-tauri/src/app/config.rs+++ b/src-tauri/src/app/config.rs@@ -32,7 +32,6 @@ pub struct WindowConfig {pub password_autosave: bool,pub title: Option<String>,pub enable_wasm: bool,- pub enable_drag_drop: bool,#[serde(default)]pub new_window: bool,pub start_to_tray: bool,diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rsindex 984e2df0..1f8aa020 100644--- a/src-tauri/src/app/window.rs+++ b/src-tauri/src/app/window.rs@@ -570,9 +570,9 @@ fn build_window(window_builder = window_builder.min_inner_size(min_w, min_h);}- if !window_config.enable_drag_drop {- window_builder = window_builder.disable_drag_drop_handler();- }+ // Tauri's drag-drop handler takes file drops before the page and breaks+ // HTML5 drag and drop on Windows; nothing in Pake consumes its events.+ window_builder = window_builder.disable_drag_drop_handler();{let allow_new_window = window_config.new_window;diff --git a/tests/unit/__snapshots__/merge-window-options.test.ts.snap b/tests/unit/__snapshots__/merge-window-options.test.ts.snapindex 1c44b63e..879b598c 100644--- a/tests/unit/__snapshots__/merge-window-options.test.ts.snap+++ b/tests/unit/__snapshots__/merge-window-options.test.ts.snap@@ -6,7 +6,6 @@ exports[`buildWindowConfigOverrides > matches the default snapshot on Linux 1`]"always_on_top": false,"dark_mode": false,"disabled_web_shortcuts": false,- "enable_drag_drop": false,"enable_find": false,"enable_wasm": false,"force_internal_navigation": false,@@ -38,7 +37,6 @@ exports[`buildWindowConfigOverrides > matches the default snapshot on Windows 1`"always_on_top": false,"dark_mode": false,"disabled_web_shortcuts": false,- "enable_drag_drop": false,"enable_find": false,"enable_wasm": false,"force_internal_navigation": false,@@ -70,7 +68,6 @@ exports[`buildWindowConfigOverrides > matches the default snapshot on macOS 1`]"always_on_top": false,"dark_mode": false,"disabled_web_shortcuts": false,- "enable_drag_drop": false,"enable_find": false,"enable_wasm": false,"force_internal_navigation": false,diff --git a/tests/unit/merge-window-options.test.ts b/tests/unit/merge-window-options.test.tsindex 8ad0ce41..c7331b23 100644--- a/tests/unit/merge-window-options.test.ts+++ b/tests/unit/merge-window-options.test.ts@@ -162,12 +162,13 @@ describe('buildWindowConfigOverrides', () => {min_width: 800,min_height: 600,enable_wasm: true,- enable_drag_drop: true,ignore_certificate_errors: true,new_window: true,enable_find: true,force_internal_navigation: true,internal_url_regex: '^https://example\\.com',});+ // --enable-drag-drop is still accepted but no longer reaches the window.+ expect(result).not.toHaveProperty('enable_drag_drop');});});