fix(修复问题): 修复字体框及侧栏刷新闪烁
build.yaml / build (push) Successful in 46s

This commit is contained in:
xiaoqidun committed 2026-10-31 23:24:58 +08:00
1 parent 62b700c593
commit 1d40268c9f
1 file changed
+10 -4
+10 -4
View File
@@ -5704,11 +5704,17 @@ async function refreshEditorPage(doc, index, openSeq, clearSelection = false) {
const search = refreshSearchPages([index], openSeq); const search = refreshSearchPages([index], openSeq);
state.documentSelection = null; state.documentSelection = null;
pageView.resetPageLoading(); pageView.resetPageLoading();
let details;
try { try {
const page = await pageView.loadPageData(index, { openSeq, priority: 0, refresh: true }); const [page, prepared] = await Promise.all([
pageView.loadPageData(index, { openSeq, priority: 0, refresh: true }),
callWASM("ofdgoDocumentInfo").catch(err => ({ detailsError: err.message })),
]);
if (openSeq !== state.openSeq) { if (openSeq !== state.openSeq) {
return; return;
} }
details = prepared.detailsError ? null : prepared;
Object.assign(doc, { detailsPending: false, detailsError: "" }, prepared);
if (clearSelection) { if (clearSelection) {
const pending = canvasEditor.pendingSelection; const pending = canvasEditor.pendingSelection;
canvasEditor.clear(); canvasEditor.clear();
@@ -5737,7 +5743,7 @@ async function refreshEditorPage(doc, index, openSeq, clearSelection = false) {
pageView.releasePageResources(); pageView.releasePageResources();
renderMeta(true); renderMeta(true);
updateControls(); updateControls();
loadDocumentDetails(openSeq); loadDocumentDetails(openSeq, details);
await search; await search;
for (const shell of el.svgHost.children) pageView.observeFlowPage(shell); for (const shell of el.svgHost.children) pageView.observeFlowPage(shell);
for (const button of el.pageList.children) pageView.observeThumbnail(button, Number(button.dataset.pageIndex), openSeq); for (const button of el.pageList.children) pageView.observeThumbnail(button, Number(button.dataset.pageIndex), openSeq);
@@ -7317,13 +7323,13 @@ function completePDF(tab) {
return task.promise; return task.promise;
} }
async function loadDocumentDetails(openSeq) { async function loadDocumentDetails(openSeq, details) {
const tab = documentTab(), state = tab.state; const tab = documentTab(), state = tab.state;
const callWASM = (name, ...args) => callTabWASM(tab, name, ...args); const callWASM = (name, ...args) => callTabWASM(tab, name, ...args);
if (openSeq !== state.openSeq || !state.doc) return; if (openSeq !== state.openSeq || !state.doc) return;
if (state.sourcePDF && !state.pdfComplete && !state.editorInfo) { completePDF(tab); return; } if (state.sourcePDF && !state.pdfComplete && !state.editorInfo) { completePDF(tab); return; }
try { try {
const details = await callWASM("ofdgoDocumentInfo"); details ||= await callWASM("ofdgoDocumentInfo");
if (openSeq !== state.openSeq) return; if (openSeq !== state.openSeq) return;
Object.assign(state.doc, details, { detailsPending: false, detailsError: "" }); Object.assign(state.doc, details, { detailsPending: false, detailsError: "" });
renderMeta(); renderMeta();