mirror of
https://github.com/zadam/trilium.git
synced 2026-01-06 14:44:25 +01:00
chore(client): fix typecheck
This commit is contained in:
parent
fffab73061
commit
fef30f4bea
3
apps/client/src/types-pdfjs.d.ts
vendored
Normal file
3
apps/client/src/types-pdfjs.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
interface Window {
|
||||||
|
TRILIUM_VIEW_HISTORY_STORE?: object;
|
||||||
|
}
|
||||||
@ -11,7 +11,8 @@ import froca from "../../services/froca";
|
|||||||
import { subscribeToMessages, unsubscribeToMessage as unsubscribeFromMessage } from "../../services/ws";
|
import { subscribeToMessages, unsubscribeToMessage as unsubscribeFromMessage } from "../../services/ws";
|
||||||
import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumEvent } from "../react/hooks";
|
import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumEvent } from "../react/hooks";
|
||||||
import { allViewTypes, ViewModeMedia, ViewModeProps, ViewTypeOptions } from "./interface";
|
import { allViewTypes, ViewModeMedia, ViewModeProps, ViewTypeOptions } from "./interface";
|
||||||
import ViewModeStorage from "./view_mode_storage";
|
import ViewModeStorage, { type ViewModeStorageType } from "./view_mode_storage";
|
||||||
|
|
||||||
interface NoteListProps {
|
interface NoteListProps {
|
||||||
note: FNote | null | undefined;
|
note: FNote | null | undefined;
|
||||||
notePath: string | null | undefined;
|
notePath: string | null | undefined;
|
||||||
@ -215,7 +216,7 @@ export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOpt
|
|||||||
return noteIds;
|
return noteIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useViewModeConfig<T extends object>(note: FNote | null | undefined, viewType: ViewTypeOptions | undefined) {
|
export function useViewModeConfig<T extends object>(note: FNote | null | undefined, viewType: ViewModeStorageType | undefined) {
|
||||||
const [ viewConfig, setViewConfig ] = useState<{
|
const [ viewConfig, setViewConfig ] = useState<{
|
||||||
config: T | undefined;
|
config: T | undefined;
|
||||||
storeFn: (data: T) => void;
|
storeFn: (data: T) => void;
|
||||||
|
|||||||
@ -4,14 +4,16 @@ import { ViewTypeOptions } from "../collections/interface";
|
|||||||
|
|
||||||
const ATTACHMENT_ROLE = "viewConfig";
|
const ATTACHMENT_ROLE = "viewConfig";
|
||||||
|
|
||||||
|
export type ViewModeStorageType = ViewTypeOptions | "pdfHistory";
|
||||||
|
|
||||||
export default class ViewModeStorage<T extends object> {
|
export default class ViewModeStorage<T extends object> {
|
||||||
|
|
||||||
private note: FNote;
|
private note: FNote;
|
||||||
private attachmentName: string;
|
private attachmentName: string;
|
||||||
|
|
||||||
constructor(note: FNote, viewType: ViewTypeOptions) {
|
constructor(note: FNote, viewType: ViewModeStorageType) {
|
||||||
this.note = note;
|
this.note = note;
|
||||||
this.attachmentName = viewType + ".json";
|
this.attachmentName = `${viewType}.json`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async store(data: T) {
|
async store(data: T) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user