优化窗格显示
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user