支持command快捷键

This commit is contained in:
Tw93
2022-10-17 15:39:57 +08:00
parent c1f381bcb8
commit 227a61238a
2 changed files with 36 additions and 10 deletions

View File

@@ -94,6 +94,25 @@ fn main() -> wry::Result<()> {
domEl.addEventListener('touchstart', (e) => {
window.ipc.postMessage('drag_window');
})
document.addEventListener('keyup', function (event) {
if (event.key == "ArrowUp" && event.metaKey){
scrollTo(0,0);
}
if (event.key == "ArrowDown" && event.metaKey){
window.scrollTo(0, document.body.scrollHeight);
}
if (event.key == "ArrowLeft" && event.metaKey){
window.history.go(-1);
}
if (event.key == "ArrowRight" && event.metaKey){
window.history.go(1);
}
if (event.key == "r" && event.metaKey){
window.location.reload();
}
})
});
})();
"#;
@@ -119,7 +138,7 @@ fn main() -> wry::Result<()> {
};
let _webview = WebViewBuilder::new(window)?
.with_url("https://weread.qq.com/")?
.with_url("https://witeboard.com/")?
// .with_devtools(true)
.with_initialization_script(script)
.with_ipc_handler(handler)