增加pdf中划句或段ai伴读功能

This commit is contained in:
yhy
2026-08-29 23:07:19 +08:00
parent 1475f8b3c5
commit 0ed8f42029
22 changed files with 2045 additions and 15 deletions
@@ -3,8 +3,11 @@ import { getLocaleID, getString } from "../../../utils/locale";
import { findPdfAttachment } from "../../pdf/extractor";
import { ensureChatPapersStyles } from "../../ui/readerPane";
import {
applyAdaptiveHeight,
buildItemPaneSectionButtons,
onItemPaneSectionToggle,
prepareItemPaneBody,
refreshSectionOpenHeight,
} from "../../ui/itemPaneSection";
import { LecturePaneView } from "./lecturePane";
@@ -26,10 +29,12 @@ export function registerLecturePane() {
l10nID: getLocaleID("item-section-lecture-sidenav"),
icon: iconURL("lecture.svg"),
},
sectionButtons: buildItemPaneSectionButtons("lecture"),
onInit: ({ body }) => {
const doc = body.ownerDocument;
if (doc) ensureChatPapersStyles(doc);
prepareItemPaneBody(body);
applyAdaptiveHeight(body, "lecture");
},
onDestroy: ({ body }) => {
views.get(body)?.destroy();
@@ -65,8 +70,11 @@ export function registerLecturePane() {
err.textContent = getString("lecture-mount-error");
body.append(err);
}
applyAdaptiveHeight(body, "lecture");
const section = body.closest("collapsible-section");
if (section && !section.hasAttribute("open")) {
if (section?.hasAttribute("open")) {
refreshSectionOpenHeight(body);
} else if (section) {
onItemPaneSectionToggle({ body });
}
},