mirror of
https://github.com/zadam/trilium.git
synced 2025-11-26 02:24:23 +01:00
feat(print/table): integrate with the printing mechanism
This commit is contained in:
parent
779e2f4633
commit
0c5a6a7548
@ -1,4 +1,4 @@
|
||||
import { useRef, useState } from "preact/hooks";
|
||||
import { useEffect, useRef, useState } from "preact/hooks";
|
||||
import { ViewModeProps } from "../interface";
|
||||
import useData, { TableConfig } from "./data";
|
||||
import { ExportModule, FormatModule, PrintModule, Tabulator as VanillaTabulator} from 'tabulator-tables';
|
||||
@ -6,11 +6,16 @@ import Tabulator from "./tabulator";
|
||||
import { RawHtmlBlock } from "../../react/RawHtml";
|
||||
import "./TablePrintView.css";
|
||||
|
||||
export default function TablePrintView({ note, noteIds, viewConfig }: ViewModeProps<TableConfig>) {
|
||||
export default function TablePrintView({ note, noteIds, viewConfig, onReady }: ViewModeProps<TableConfig>) {
|
||||
const tabulatorRef = useRef<VanillaTabulator>(null);
|
||||
const { columnDefs, rowData, hasChildren } = useData(note, noteIds, viewConfig, undefined, () => {});
|
||||
const [ html, setHtml ] = useState<string>();
|
||||
|
||||
useEffect(() => {
|
||||
if (!html) return;
|
||||
onReady?.();
|
||||
}, [ html ]);
|
||||
|
||||
return rowData && (
|
||||
<>
|
||||
<h1>{note.title}</h1>
|
||||
|
||||
@ -49,7 +49,7 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not
|
||||
const canBeConvertedToAttachment = note?.isEligibleForConversionToAttachment();
|
||||
const isSearchable = ["text", "code", "book", "mindMap", "doc"].includes(note.type);
|
||||
const isInOptionsOrHelp = note?.noteId.startsWith("_options") || note?.noteId.startsWith("_help");
|
||||
const isPrintable = ["text", "code"].includes(note.type) || (note.type === "book" && ["presentation", "list"].includes(note.getLabelValue("viewType") ?? ""));
|
||||
const isPrintable = ["text", "code"].includes(note.type) || (note.type === "book" && ["presentation", "list", "table"].includes(note.getLabelValue("viewType") ?? ""));
|
||||
const isElectron = getIsElectron();
|
||||
const isMac = getIsMac();
|
||||
const hasSource = ["text", "code", "relationMap", "mermaid", "canvas", "mindMap", "aiChat"].includes(note.type);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user