remove hotkey script

pull/361/head
Lucas Nogueira 2 years ago
parent 952b24ecaf
commit 4d8366f323
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1

@ -2,8 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
// open <a href="..."> links with the API
function __openLinks() {
;(function () {
// open <a href="..."> links with the API
function openLinks() {
document.querySelector('body').addEventListener(
'click',
function (e) {
@ -26,19 +27,14 @@ function __openLinks() {
}
}
)
}
}
if (
if (
document.readyState === 'complete' ||
document.readyState === 'interactive'
) {
__openLinks()
} else {
window.addEventListener(
'DOMContentLoaded',
function () {
__openLinks()
},
true
)
}
) {
openLinks()
} else {
window.addEventListener('DOMContentLoaded', openLinks, true)
}
})()

@ -15,10 +15,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
}
init_js.push_str(include_str!("./scripts/drag.js"));
#[cfg(any(debug_assertions, feature = "devtools"))]
{
init_js.push_str(include_str!("./scripts/hotkey.js"));
init_js.push_str(include_str!("./scripts/toggle-devtools.js"));
}
Builder::new("window")
.js_init_script(init_js)

File diff suppressed because one or more lines are too long

@ -1,3 +1,26 @@
window.hotkeys(navigator.appVersion.includes('Mac') ? 'command+option+i' : 'ctrl+shift+i', () => {
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
;(function () {
function toggleDevtoolsHotkey() {
const isHotkey = navigator.appVersion.includes('Mac')
? event => event.metaKey && event.altKey && event.key === 'I'
: event => event.ctrlKey && event.shiftKey && event.key === 'I'
document.addEventListener('keydown', event => {
if (isHotkey(event)) {
window.__TAURI_INVOKE__('plugin:window|internal_toggle_devtools');
});
}
})
}
if (
document.readyState === 'complete' ||
document.readyState === 'interactive'
) {
toggleDevtoolsHotkey()
} else {
window.addEventListener('DOMContentLoaded', toggleDevtoolsHotkey, true)
}
})()

Loading…
Cancel
Save