fix fmt and lint

pull/367/head
Lucas Nogueira 2 years ago
parent f4fa287a8d
commit 6df7508950
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1

@ -48,44 +48,44 @@
} }
}, },
"fs": { "fs": {
"scope": { "scope": {
"allow": ["$APPDATA/db/**", "$DOWNLOAD/**", "$RESOURCE/**"], "allow": ["$APPDATA/db/**", "$DOWNLOAD/**", "$RESOURCE/**"],
"deny": ["$APPDATA/db/*.stronghold"] "deny": ["$APPDATA/db/*.stronghold"]
}
},
"shell": {
"open": true,
"scope": [
{
"name": "sh",
"cmd": "sh",
"args": [
"-c",
{
"validator": "\\S+"
}
]
},
{
"name": "cmd",
"cmd": "cmd",
"args": [
"/C",
{
"validator": "\\S+"
}
]
}
]
},
"http": {
"scope": ["http://localhost:3003"]
},
"updater": {
"endpoints": [
"https://tauri-update-server.vercel.app/update/{{target}}/{{current_version}}"
]
} }
},
"shell": {
"open": true,
"scope": [
{
"name": "sh",
"cmd": "sh",
"args": [
"-c",
{
"validator": "\\S+"
}
]
},
{
"name": "cmd",
"cmd": "cmd",
"args": [
"/C",
{
"validator": "\\S+"
}
]
}
]
},
"http": {
"scope": ["http://localhost:3003"]
},
"updater": {
"endpoints": [
"https://tauri-update-server.vercel.app/update/{{target}}/{{current_version}}"
]
}
}, },
"tauri": { "tauri": {
"pattern": { "pattern": {

@ -3,13 +3,13 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
window.alert = function (message) { window.alert = function (message) {
window.__TAURI_INVOKE__('plugin:dialog|message', { window.__TAURI_INVOKE__("plugin:dialog|message", {
message: message.toString() message: message.toString(),
}) });
} };
window.confirm = function (message) { window.confirm = function (message) {
return window.__TAURI_INVOKE__('plugin:dialog|confirm', { return window.__TAURI_INVOKE__("plugin:dialog|confirm", {
message: message.toString() message: message.toString(),
}) });
} };

@ -2,39 +2,38 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
;(function () { (function () {
// open <a href="..."> links with the API // open <a href="..."> links with the API
function openLinks() { function openLinks() {
document.querySelector('body').addEventListener( document.querySelector("body").addEventListener("click", function (e) {
'click', var target = e.target;
function (e) { while (target != null) {
var target = e.target if (target.matches("a")) {
while (target != null) { if (
if (target.matches('a')) { target.href &&
if ( ["http://", "https://", "mailto:", "tel:"].some((v) =>
target.href && target.href.startsWith(v)
(['http://', 'https://', 'mailto:', 'tel:'].some(v => target.href.startsWith(v))) && ) &&
target.target === '_blank' target.target === "_blank"
) { ) {
window.__TAURI_INVOKE__('plugin:shell|open', { window.__TAURI_INVOKE__("plugin:shell|open", {
path: target.href path: target.href,
}) });
e.preventDefault() e.preventDefault();
}
break
} }
target = target.parentElement break;
} }
target = target.parentElement;
} }
) });
} }
if ( if (
document.readyState === 'complete' || document.readyState === "complete" ||
document.readyState === 'interactive' document.readyState === "interactive"
) { ) {
openLinks() openLinks();
} else { } else {
window.addEventListener('DOMContentLoaded', openLinks, true) window.addEventListener("DOMContentLoaded", openLinks, true);
} }
})() })();

@ -319,7 +319,7 @@ class WebviewWindowHandle {
/** The window label. It is a unique identifier for the window, can be used to reference it later. */ /** The window label. It is a unique identifier for the window, can be used to reference it later. */
label: WindowLabel; label: WindowLabel;
/** Local event listeners. */ /** Local event listeners. */
listeners: Record<string, Array<EventCallback<any>>>; listeners: Record<string, Array<EventCallback<unknown>>>;
constructor(label: WindowLabel) { constructor(label: WindowLabel) {
this.label = label; this.label = label;

@ -2,16 +2,16 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
document.addEventListener('mousedown', (e) => { document.addEventListener("mousedown", (e) => {
if (e.target.hasAttribute('data-tauri-drag-region') && e.buttons === 1) { if (e.target.hasAttribute("data-tauri-drag-region") && e.buttons === 1) {
// prevents text cursor // prevents text cursor
e.preventDefault() e.preventDefault();
// fix #2549: double click on drag region edge causes content to maximize without window sizing change // fix #2549: double click on drag region edge causes content to maximize without window sizing change
// https://github.com/tauri-apps/tauri/issues/2549#issuecomment-1250036908 // https://github.com/tauri-apps/tauri/issues/2549#issuecomment-1250036908
e.stopImmediatePropagation() e.stopImmediatePropagation();
// start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it // start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it
const cmd = e.detail === 2 ? 'internal_toggle_maximize' : 'start_dragging' const cmd = e.detail === 2 ? "internal_toggle_maximize" : "start_dragging";
window.__TAURI_INVOKE__('plugin:window|' + cmd) window.__TAURI_INVOKE__("plugin:window|" + cmd);
} }
}) });

@ -3,5 +3,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
window.print = function () { window.print = function () {
return window.__TAURI_INVOKE__('plugin:window|print') return window.__TAURI_INVOKE__("plugin:window|print");
} };

@ -2,25 +2,25 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
;(function () { (function () {
function toggleDevtoolsHotkey() { function toggleDevtoolsHotkey() {
const isHotkey = navigator.appVersion.includes('Mac') const isHotkey = navigator.appVersion.includes("Mac")
? event => event.metaKey && event.altKey && event.key === 'I' ? (event) => event.metaKey && event.altKey && event.key === "I"
: event => event.ctrlKey && event.shiftKey && event.key === 'I' : (event) => event.ctrlKey && event.shiftKey && event.key === "I";
document.addEventListener('keydown', event => { document.addEventListener("keydown", (event) => {
if (isHotkey(event)) { if (isHotkey(event)) {
window.__TAURI_INVOKE__('plugin:window|internal_toggle_devtools'); window.__TAURI_INVOKE__("plugin:window|internal_toggle_devtools");
} }
}) });
} }
if ( if (
document.readyState === 'complete' || document.readyState === "complete" ||
document.readyState === 'interactive' document.readyState === "interactive"
) { ) {
toggleDevtoolsHotkey() toggleDevtoolsHotkey();
} else { } else {
window.addEventListener('DOMContentLoaded', toggleDevtoolsHotkey, true) window.addEventListener("DOMContentLoaded", toggleDevtoolsHotkey, true);
} }
})() })();

Loading…
Cancel
Save