fix: use Svelte dispatch for verstak-link events in MarkdownPreview
Problem: MarkdownPreview dispatched DOM CustomEvent via link.dispatchEvent()
which doesn't propagate through Svelte's event system. The on:verstak-link
handler on <MarkdownPreview> in NoteEditorPanel only catches Svelte dispatch()
events, not DOM CustomEvents from {@html} content.
Fix: Replaced DOM CustomEvent dispatch with Svelte createEventDispatcher.
Now handleClick() in MarkdownPreview calls dispatch('verstak-link', {...})
which properly propagates through NoteEditorPanel → App.svelte chain.
Also: removed unused importInternalLink import (was unused after
InternalLinkPicker replaced the manual modal).
This commit is contained in:
parent
db961ff0c3
commit
2cbb2986c1
File diff suppressed because one or more lines are too long
|
|
@ -19,7 +19,7 @@
|
||||||
background: #13131f;
|
background: #13131f;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="module" crossorigin src="/assets/main-BuG9iGkd.js"></script>
|
<script type="module" crossorigin src="/assets/main-DwDG7FeH.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/main-bQpH1es2.css">
|
<link rel="stylesheet" crossorigin href="/assets/main-bQpH1es2.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { createEventDispatcher } from 'svelte';
|
||||||
import { renderMarkdown, isInternalLink, parseVerstakUrl, isAllowedVerstakType } from '../../markdown/markdown';
|
import { renderMarkdown, isInternalLink, parseVerstakUrl, isAllowedVerstakType } from '../../markdown/markdown';
|
||||||
import { t } from '../../i18n';
|
import { t } from '../../i18n';
|
||||||
|
|
||||||
export let content = '';
|
export let content = '';
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
let html = '';
|
let html = '';
|
||||||
let error = '';
|
let error = '';
|
||||||
|
|
||||||
|
|
@ -30,10 +33,7 @@
|
||||||
const parsed = parseVerstakUrl(href);
|
const parsed = parseVerstakUrl(href);
|
||||||
if (!parsed || !isAllowedVerstakType(parsed.type)) return;
|
if (!parsed || !isAllowedVerstakType(parsed.type)) return;
|
||||||
|
|
||||||
link.dispatchEvent(new CustomEvent('verstak-link', {
|
dispatch('verstak-link', { type: parsed.type, id: parsed.id, href });
|
||||||
bubbles: true,
|
|
||||||
detail: { type: parsed.type, id: parsed.id, href },
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue