|
9 | 9 | import { toast } from 'svelte-sonner'; |
10 | 10 | import { dev } from '$app/environment'; |
11 | 11 | import { markdown_to_html } from '$lib/markdown/markdown'; |
12 | | - import { onMount, onDestroy } from 'svelte'; |
13 | 12 | import { Button } from '$lib/components/ui/button'; |
14 | 13 | import { fly, fade } from 'svelte/transition'; |
15 | 14 |
|
|
35 | 34 | let detailsMarkdown = $derived(configData.data?.site_description ?? ''); |
36 | 35 |
|
37 | 36 | // Handle physical mouse back button (X1) to return from stage 2 to stage 1 |
38 | | - let _mouseBackHandler: ((e: MouseEvent) => void) | undefined; |
39 | | - onMount(() => { |
40 | | - _mouseBackHandler = (e: MouseEvent) => { |
41 | | - if (e.button === 3 && stage === 2) { |
42 | | - stage = 1; |
43 | | - e.preventDefault(); |
44 | | - } |
45 | | - }; |
46 | | - window.addEventListener('auxclick', _mouseBackHandler as EventListener); |
47 | | - window.addEventListener('pointerdown', _mouseBackHandler as EventListener); |
48 | | - }); |
49 | | -
|
50 | | - onDestroy(() => { |
51 | | - if (_mouseBackHandler) { |
52 | | - window.removeEventListener('auxclick', _mouseBackHandler as EventListener); |
53 | | - window.removeEventListener('pointerdown', _mouseBackHandler as EventListener); |
| 37 | + const handleMouseBack = (e: MouseEvent) => { |
| 38 | + if (e.button === 3 && stage === 2) { |
| 39 | + stage = 1; |
| 40 | + e.preventDefault(); |
54 | 41 | } |
55 | | - }); |
| 42 | + }; |
56 | 43 |
|
57 | 44 | const handleWindowDragEnter = (e: DragEvent) => { |
58 | 45 | e.preventDefault(); |
|
229 | 216 | ondragleave={handleWindowDragLeave} |
230 | 217 | ondrop={handleWindowDrop} |
231 | 218 | onpaste={handlePaste} |
| 219 | + onauxclick={handleMouseBack} |
| 220 | + onpointerdown={handleMouseBack} |
232 | 221 | /> |
233 | 222 |
|
234 | 223 | {#snippet encryptionInfo()} |
|
0 commit comments