fix local markdown attachment regressions
This commit is contained in:
@@ -36,6 +36,19 @@ import {
|
||||
const ERROR_EVENT = `${EVENT_PREFIX}:error`;
|
||||
const COMMAND_EVENT = `${EVENT_PREFIX}:command`;
|
||||
const BRIDGE_PROTOCOL = 'mnote.leptos_tiptap.bridge.v1';
|
||||
const DEV_HOT_BUSTER = (() => {
|
||||
try {
|
||||
return new URL(import.meta.url).searchParams.get('devHot') || '';
|
||||
} catch (_) {
|
||||
return '';
|
||||
}
|
||||
})();
|
||||
|
||||
const withDevHot = (path) => {
|
||||
const url = new URL(path, window.location.origin);
|
||||
if (DEV_HOT_BUSTER) url.searchParams.set('devHot', DEV_HOT_BUSTER);
|
||||
return url.toString();
|
||||
};
|
||||
|
||||
const parseJsonScript = (id) => {
|
||||
const node = document.getElementById(id);
|
||||
@@ -66,12 +79,12 @@ import {
|
||||
return window.__mnoteLeptosTiptapRuntimePromise;
|
||||
}
|
||||
window.__mnoteLeptosTiptapRuntimePromise = (async () => {
|
||||
const manifestResponse = await fetch('/api/leptos-tiptap-runtime/manifest.json');
|
||||
const manifestResponse = await fetch(withDevHot('/api/leptos-tiptap-runtime/manifest.json'));
|
||||
if (!manifestResponse.ok) throw new Error(`manifest_failed_${manifestResponse.status}`);
|
||||
const manifest = await manifestResponse.json();
|
||||
if (!manifest.entryAssetPath) throw new Error('island manifest 缺少 entryAssetPath');
|
||||
const entryUrl = `/api/leptos-tiptap-runtime/${manifest.entryAssetPath}`;
|
||||
const wasmUrl = manifest.wasmAssetPath ? `/api/leptos-tiptap-runtime/${manifest.wasmAssetPath}` : undefined;
|
||||
const entryUrl = withDevHot(`/api/leptos-tiptap-runtime/${manifest.entryAssetPath}`);
|
||||
const wasmUrl = manifest.wasmAssetPath ? withDevHot(`/api/leptos-tiptap-runtime/${manifest.wasmAssetPath}`) : undefined;
|
||||
const runtime = await import(entryUrl);
|
||||
if (typeof runtime.default !== 'function' || typeof runtime.mount !== 'function' || typeof runtime.unmount !== 'function') {
|
||||
throw new Error('island runtime 导出不完整');
|
||||
@@ -204,6 +217,7 @@ import {
|
||||
window.dispatchEvent(new CustomEvent('mnote:page-aggregate-synced', {
|
||||
detail: { scriptId, documentId: aggregateDocumentId(nextAggregate) }
|
||||
}));
|
||||
enhanceEditorAttachmentLinksSoon();
|
||||
} catch (error) {
|
||||
console.warn('mnote Page Aggregate script 同步失败', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user