优化窗格显示

This commit is contained in:
yhy
2026-09-01 08:38:36 +08:00
parent af2ee38443
commit 3b07e2a3c1
11 changed files with 137 additions and 30 deletions
+9 -2
View File
@@ -4,7 +4,9 @@ import { ChatView } from "./chatView";
import {
applyAdaptiveHeight,
applyItemPaneSectionButtonIcons,
applyItemPaneSectionHeadLabel,
buildItemPaneSectionButtons,
clearSectionSummary,
onItemPaneSectionToggle,
prepareItemPaneBody,
refreshSectionOpenHeight,
@@ -34,6 +36,7 @@ export function registerChatPane() {
if (doc) ensureStyles(doc);
prepareItemPaneBody(body);
applyAdaptiveHeight(body, "chat");
applyItemPaneSectionHeadLabel(body, "chat");
},
onDestroy: ({ body }) => {
views.get(body)?.destroy();
@@ -45,17 +48,19 @@ export function registerChatPane() {
void tabType;
return true;
},
onRender: ({ body }) => {
onRender: ({ body, setSectionSummary }) => {
body.replaceChildren();
const doc = body.ownerDocument;
if (!doc) return;
applyItemPaneSectionHeadLabel(body, "chat");
clearSectionSummary(body, setSectionSummary);
applyItemPaneSectionButtonIcons(body);
const loading = doc.createElement("div");
loading.className = "chatpapers-loading";
loading.textContent = getString("chat-loading");
body.append(loading);
},
onAsyncRender: async ({ body, item }) => {
onAsyncRender: async ({ body, item, setSectionSummary }) => {
if (!item) return;
const doc = body.ownerDocument;
if (!doc) return;
@@ -63,6 +68,8 @@ export function registerChatPane() {
const view = new ChatView(doc, body, item);
views.set(body, view);
await view.mount();
applyItemPaneSectionHeadLabel(body, "chat");
clearSectionSummary(body, setSectionSummary);
applyAdaptiveHeight(body, "chat");
applyItemPaneSectionButtonIcons(body);
const section = body.closest("collapsible-section");