mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
Cross-platform groundwork: platform detection, iOS config, Windows drag-drop fix, Android 10 storage fix (#72), bundled fonts
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
const isMobile = /android|ios/i.test(navigator.userAgent);
|
||||
const isMobile = /android|iphone|ipad|ipod/i.test(navigator.userAgent);
|
||||
|
||||
// Reactively apply theme class to <html> whenever $theme changes
|
||||
$effect(() => {
|
||||
@@ -160,6 +160,25 @@
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// On Windows the native OS drag-drop handler is disabled (dragDropEnabled:false
|
||||
// in tauri.windows.conf.json) so HTML5 drag-and-drop works for reordering. With it
|
||||
// off, a file dropped outside a drop zone would make the webview navigate to / open
|
||||
// that file, replacing the app. Swallow any drag that bubbles up unhandled. Real drop
|
||||
// zones (editor, sidebar reordering) call preventDefault in their own handlers first;
|
||||
// these bubble-phase listeners only act as a fallback. On macOS/Linux OS file drops are
|
||||
// intercepted natively and never surface as HTML5 events, so this is a harmless no-op there.
|
||||
onMount(() => {
|
||||
function preventNavigate(e: DragEvent) {
|
||||
e.preventDefault();
|
||||
}
|
||||
window.addEventListener('dragover', preventNavigate);
|
||||
window.addEventListener('drop', preventNavigate);
|
||||
return () => {
|
||||
window.removeEventListener('dragover', preventNavigate);
|
||||
window.removeEventListener('drop', preventNavigate);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:document oncontextmenu={(e) => { if (!isMobile) e.preventDefault(); }} />
|
||||
|
||||
Reference in New Issue
Block a user