增加pdf中划句或段ai伴读功能
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user