fix: stabilize local attachment icons and office proxy urls

This commit is contained in:
lix-2026
2026-05-26 09:44:35 +08:00
parent 0a15595066
commit 8cd8b44db3
11 changed files with 564 additions and 14 deletions
@@ -122,6 +122,16 @@ import {
}
};
const enhanceEditorAttachmentLinksSoon = () => {
const run = () => {
if (typeof window.__mnoteEnhanceEditorAttachmentLinks === 'function') {
window.__mnoteEnhanceEditorAttachmentLinks();
}
};
run();
[120, 500, 1200].forEach((delayMs) => window.setTimeout(run, delayMs));
};
const pageAggregateUrl = (bootstrap) => {
const url = new URL(`/api/page-aggregate/${encodeURIComponent(bootstrap.documentId)}`, window.location.origin);
url.searchParams.set('sourceKind', bootstrap.sourceKind || 'local_folder');
@@ -357,6 +367,7 @@ import {
runtimeDescriptor.root.setAttribute('data-runtime-mount-id', String(mountId));
runtimeDescriptor.root.setAttribute('data-editor-host-kind', 'leptos_tiptap_island');
setStatus(runtimeDescriptor, 'mounting-editor');
enhanceEditorAttachmentLinksSoon();
paneViewRegistry.set(paneRole, view);
return view;
} catch (error) {
@@ -572,6 +583,7 @@ import {
} else {
setStatus(runtimeDescriptor, 'ready');
}
enhanceEditorAttachmentLinksSoon();
};
view.onError = (event) => {
const payload = normalizeEnvelopePayload(event);
@@ -580,12 +592,15 @@ import {
view.onChange = (event) => {
scheduleSlashMenuPosition(runtimeDescriptor.root);
handleSessionChange(session, view, event);
enhanceEditorAttachmentLinksSoon();
};
view.onSave = (event) => {
handleSessionChange(session, view, event);
enhanceEditorAttachmentLinksSoon();
};
view.onState = () => {
scheduleSlashMenuPosition(runtimeDescriptor.root);
enhanceEditorAttachmentLinksSoon();
};
view.onKeydown = (event) => {
if (event.key === '/') scheduleSlashMenuPosition(runtimeDescriptor.root);
@@ -664,6 +679,7 @@ import {
runtimeDescriptor.root.setAttribute('data-runtime-mount-id', String(mountId));
runtimeDescriptor.root.setAttribute('data-editor-host-kind', 'leptos_tiptap_island');
setStatus(runtimeDescriptor, 'mounting-editor');
enhanceEditorAttachmentLinksSoon();
paneViewRegistry.set(runtimeDescriptor.paneRole, view);
} catch (error) {
unmountEditorViewBinding(view);