mirror of
https://github.com/zadam/trilium.git
synced 2026-01-02 04:34:25 +01:00
chore(pdfjs): fix typecheck issues
This commit is contained in:
parent
94204b4739
commit
0ff4756ef4
12
apps/client/src/types-pdfjs.d.ts
vendored
12
apps/client/src/types-pdfjs.d.ts
vendored
@ -1,3 +1,15 @@
|
||||
interface Window {
|
||||
/**
|
||||
* By default, pdf.js will try to store information about the opened PDFs such as zoom and scroll position in local storage.
|
||||
* The Trilium alternative is to use attachments stored at note level.
|
||||
* This variable represents the direct content used by the pdf.js viewer in its local storage key, but in plain JS object format.
|
||||
* The variable must be set early at startup, before pdf.js fully initializes.
|
||||
*/
|
||||
TRILIUM_VIEW_HISTORY_STORE?: object;
|
||||
|
||||
/**
|
||||
* If set to true, hides the pdf.js viewer default sidebar containing the outline, page navigation, etc.
|
||||
* This needs to be set early in the main method.
|
||||
*/
|
||||
TRILIUM_HIDE_SIDEBAR?: boolean;
|
||||
}
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
*/
|
||||
|
||||
import { NoteType } from "@triliumnext/commons";
|
||||
import { VNode, type JSX } from "preact";
|
||||
import { type JSX,VNode } from "preact";
|
||||
|
||||
import { TypeWidgetProps } from "./type_widgets/type_widget";
|
||||
|
||||
/**
|
||||
@ -13,7 +14,7 @@ import { TypeWidgetProps } from "./type_widgets/type_widget";
|
||||
*/
|
||||
export type ExtendedNoteType = Exclude<NoteType, "launcher" | "text" | "code"> | "empty" | "readOnlyCode" | "readOnlyText" | "editableText" | "editableCode" | "attachmentDetail" | "attachmentList" | "protectedSession" | "aiChat";
|
||||
|
||||
export type TypeWidget = ((props: TypeWidgetProps) => VNode | JSX.Element);
|
||||
export type TypeWidget = ((props: TypeWidgetProps) => VNode | JSX.Element | undefined);
|
||||
type NoteTypeView = () => (Promise<{ default: TypeWidget } | TypeWidget> | TypeWidget);
|
||||
|
||||
interface NoteTypeMapping {
|
||||
|
||||
@ -64,7 +64,7 @@ async function generateThumbnail(pageNumber: number) {
|
||||
|
||||
// Render page to canvas
|
||||
await page.render({
|
||||
canvasContext: context,
|
||||
canvas: canvas,
|
||||
viewport: viewport
|
||||
}).promise;
|
||||
|
||||
|
||||
@ -126,7 +126,6 @@ export function setupActiveHeadingTracking() {
|
||||
function updateActiveHeading() {
|
||||
if (!headingPositions || headingPositions.length === 0) return;
|
||||
|
||||
const currentPage = app.page - 1; // PDF.js uses 1-based, we need 0-based
|
||||
const viewer = app.pdfViewer;
|
||||
const container = viewer.container;
|
||||
const scrollTop = container.scrollTop;
|
||||
|
||||
22
packages/pdfjs-viewer/src/typings.d.ts
vendored
22
packages/pdfjs-viewer/src/typings.d.ts
vendored
@ -14,10 +14,32 @@ declare global {
|
||||
_readFromStorage: () => Promise<string>;
|
||||
}
|
||||
|
||||
interface PdfJsDestination {
|
||||
|
||||
}
|
||||
|
||||
interface Window {
|
||||
PDFViewerApplication?: {
|
||||
initializedPromise: Promise<void>;
|
||||
pdfDocument: PDFDocumentProxy;
|
||||
pdfViewer: {
|
||||
currentPageNumber: number;
|
||||
optionalContentConfigPromise: {
|
||||
setVisibility(groupId: string, visible: boolean);
|
||||
getGroup(groupId: string): {
|
||||
name: string;
|
||||
usage: {};
|
||||
};
|
||||
getOrder(): {}[]
|
||||
};
|
||||
getPageView(pageIndex: number): {
|
||||
div: HTMLDivElement;
|
||||
};
|
||||
container: HTMLElement;
|
||||
};
|
||||
pdfLinkService: {
|
||||
goToDestination(dest: PdfJsDestination);
|
||||
};
|
||||
eventBus: {
|
||||
on(event: string, listener: (...args: any[]) => void): void;
|
||||
dispatch(event: string, data?: any): void;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user