Fix first local markdown open reload

This commit is contained in:
lix-2026
2026-05-26 16:24:00 +08:00
parent 14fec9ef6a
commit bb17513821
4 changed files with 45 additions and 10 deletions
@@ -257,6 +257,12 @@ import {
shell.setAttribute('data-layout-density', String(options.layoutDensity || 'normal'));
shell.setAttribute('data-page-font', String(options.pageFont || 'default'));
shell.setAttribute('data-page-show-heading-numbers', String(Boolean(options.showHeadingNumbers)));
const hideTitleHeader = Boolean(options.hideTitleHeader || options.hide_title_header);
const header = shell.querySelector('.document-shell-header');
if (header instanceof HTMLElement) {
header.hidden = hideTitleHeader;
header.setAttribute('data-page-title-hidden', String(hideTitleHeader));
}
}
pane.querySelectorAll('[data-page-title-input="true"]').forEach((node) => {
if (!(node instanceof HTMLTextAreaElement)) return;
@@ -756,6 +762,22 @@ import {
bindMainEditorPageTab('primary');
bindMainEditorPageTab('secondary');
const shouldPrewarmPrimaryRuntime = paneRuntimes.length === 0
&& document.querySelector('.mnote-workspace-empty-editor-host')
&& document.querySelector(`${ROOT_SELECTOR}[data-pane-role="primary"]`);
if (shouldPrewarmPrimaryRuntime) {
const prewarmRuntime = () => {
loadRuntime().catch((error) => {
console.warn('mnote editor runtime prewarm failed', error);
});
};
if (typeof window.requestIdleCallback === 'function') {
window.requestIdleCallback(prewarmRuntime, { timeout: 2000 });
} else {
window.setTimeout(prewarmRuntime, 800);
}
}
window.addEventListener('pagehide', () => {
Array.from(documentSessionRegistry.values()).forEach((session) => {
sessionViews(session).forEach((view) => {