🐛 Fix the issue of not being able to drag and drop files.

This commit is contained in:
Tw93
2023-06-04 12:37:41 +08:00
parent c1c862f29f
commit e70b29468a
4 changed files with 31 additions and 30 deletions

View File

@@ -92,9 +92,9 @@ export async function mergeTauriConfig(
const cli_path = path.join(new_dir, "cli.js") const cli_path = path.join(new_dir, "cli.js")
const cli_path_target = path.join(old_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_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(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 = file_name;
tauriConf.pake.windows[0].url_type = "local"; tauriConf.pake.windows[0].url_type = "local";

54
dist/cli.js vendored
View File

@@ -20,31 +20,31 @@ import dns from 'dns';
import http from 'http'; import http from 'http';
import updateNotifier from 'update-notifier'; import updateNotifier from 'update-notifier';
/****************************************************************************** /******************************************************************************
Copyright (c) Microsoft Corporation. Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted. purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 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 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */ ***************************************************************************** */
/* global Reflect, Promise */ /* global Reflect, Promise */
function __awaiter(thisArg, _arguments, P, generator) { function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 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 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); } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
} }
const DEFAULT_PAKE_OPTIONS = { 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 = path.join(new_dir, "cli.js");
const cli_path_target = path.join(old_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_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(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 = file_name;
tauriConf.pake.windows[0].url_type = "local"; tauriConf.pake.windows[0].url_type = "local";

View File

@@ -1,7 +1,7 @@
{ {
"windows": [ "windows": [
{ {
"url": "https://chat.openai.com", "url": "https://weread.qq.com/",
"transparent": true, "transparent": true,
"fullscreen": false, "fullscreen": false,
"width": 1200, "width": 1200,

View File

@@ -26,6 +26,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
.resizable(window_config.resizable) .resizable(window_config.resizable)
.fullscreen(window_config.fullscreen) .fullscreen(window_config.fullscreen)
.inner_size(window_config.width, window_config.height) .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/style.js"))
.initialization_script(include_str!("../inject/event.js")) .initialization_script(include_str!("../inject/event.js"))
.initialization_script(include_str!("../inject/component.js")); .initialization_script(include_str!("../inject/component.js"));