🐛 Improve user experience.
This commit is contained in:
@@ -10,7 +10,8 @@ use tauri_plugin_window_state::{AppHandleExt, StateFlags};
|
||||
|
||||
pub fn get_menu() -> Menu {
|
||||
let close = CustomMenuItem::new("close".to_string(), "Close Window").accelerator("CmdOrCtrl+W");
|
||||
let goto_url_item = CustomMenuItem::new("goto_url".to_string(), "Go to URL...").accelerator("CmdOrCtrl+Shift+L");
|
||||
let goto_url_item = CustomMenuItem::new("goto_url".to_string(), "Go to URL...")
|
||||
.accelerator("CmdOrCtrl+Shift+L");
|
||||
let first_menu = Menu::new()
|
||||
.add_native_item(MenuItem::Copy)
|
||||
.add_native_item(MenuItem::Cut)
|
||||
|
||||
@@ -45,6 +45,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
.pake-modal-content label {
|
||||
display: block;
|
||||
color: #11182B;
|
||||
margin-bottom: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -115,15 +115,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const hrefUrl = new URL(anchorElement.href);
|
||||
const absoluteUrl = hrefUrl.href;
|
||||
|
||||
// 处理外部链接跳转
|
||||
// Handling external link redirection.
|
||||
if (window.location.host !== hrefUrl.host && target === '_blank') {
|
||||
e.preventDefault();
|
||||
invoke('open_browser', { url: absoluteUrl });
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理下载链接让Rust处理
|
||||
if (/\.[a-zA-Z0-9]+$/i.test(absoluteUrl)) {
|
||||
// Process download links for Rust to handle.
|
||||
if (/\.[a-zA-Z0-9]+$/i.test(removeUrlParameters(absoluteUrl))) {
|
||||
e.preventDefault();
|
||||
invoke('download_file', {
|
||||
params: {
|
||||
@@ -140,7 +140,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// Rewrite the window.open function.
|
||||
const originalWindowOpen = window.open;
|
||||
window.open = function (url, name, specs) {
|
||||
console.log('0window.open>>>>>>>', url, name, specs);
|
||||
// Apple login and google login
|
||||
if (name === 'AppleAuthentication') {
|
||||
//do nothing
|
||||
@@ -168,3 +167,9 @@ function getFilenameFromUrl(url) {
|
||||
const filename = urlPath.substring(urlPath.lastIndexOf('/') + 1);
|
||||
return filename;
|
||||
}
|
||||
|
||||
function removeUrlParameters(url) {
|
||||
const parsedUrl = new URL(url);
|
||||
parsedUrl.search = '';
|
||||
return parsedUrl.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user