From e70b29468accd6239edad0c5b6b59be31335a76e Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sun, 4 Jun 2023 12:37:41 +0800 Subject: [PATCH] :bug: Fix the issue of not being able to drag and drop files. --- bin/builders/common.ts | 4 +-- dist/cli.js | 54 ++++++++++++++++++------------------- src-tauri/pake.json | 2 +- src-tauri/src/app/window.rs | 1 + 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/bin/builders/common.ts b/bin/builders/common.ts index 369addd..45d8851 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -92,9 +92,9 @@ export async function mergeTauriConfig( const cli_path = path.join(new_dir, "cli.js") const cli_path_target = path.join(old_dir, "cli.js") const about_pake_path = path.join(new_dir, "about_pake.html"); - const about_patk_path_target = path.join(old_dir, "about_pake.html") + const about_pake_path_target = path.join(old_dir, "about_pake.html") fs.copyFile(cli_path, cli_path_target); - fs.copyFile(about_pake_path, about_patk_path_target); + fs.copyFile(about_pake_path, about_pake_path_target); } tauriConf.pake.windows[0].url = file_name; tauriConf.pake.windows[0].url_type = "local"; diff --git a/dist/cli.js b/dist/cli.js index 83b399c..76413c4 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -20,31 +20,31 @@ import dns from 'dns'; import http from 'http'; import updateNotifier from 'update-notifier'; -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - - -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); } const DEFAULT_PAKE_OPTIONS = { @@ -1697,9 +1697,9 @@ function mergeTauriConfig(url, options, tauriConf) { const cli_path = path.join(new_dir, "cli.js"); const cli_path_target = path.join(old_dir, "cli.js"); const about_pake_path = path.join(new_dir, "about_pake.html"); - const about_patk_path_target = path.join(old_dir, "about_pake.html"); + const about_pake_path_target = path.join(old_dir, "about_pake.html"); fs$1.copyFile(cli_path, cli_path_target); - fs$1.copyFile(about_pake_path, about_patk_path_target); + fs$1.copyFile(about_pake_path, about_pake_path_target); } tauriConf.pake.windows[0].url = file_name; tauriConf.pake.windows[0].url_type = "local"; diff --git a/src-tauri/pake.json b/src-tauri/pake.json index 344e2f5..a97dcc7 100644 --- a/src-tauri/pake.json +++ b/src-tauri/pake.json @@ -1,7 +1,7 @@ { "windows": [ { - "url": "https://chat.openai.com", + "url": "https://weread.qq.com/", "transparent": true, "fullscreen": false, "width": 1200, diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs index e05c726..16c7f3e 100644 --- a/src-tauri/src/app/window.rs +++ b/src-tauri/src/app/window.rs @@ -26,6 +26,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind .resizable(window_config.resizable) .fullscreen(window_config.fullscreen) .inner_size(window_config.width, window_config.height) + .disable_file_drop_handler() //Very annoying, otherwise dragging files to the window will not work. .initialization_script(include_str!("../inject/style.js")) .initialization_script(include_str!("../inject/event.js")) .initialization_script(include_str!("../inject/component.js"));