Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(print/table): render using internal mechanism
Elian Doranf864746b5493
diff --git a/apps/client/src/widgets/collections/table/TablePrintView.css b/apps/client/src/widgets/collections/table/TablePrintView.cssnew file mode 100644index 0000000000..09c6cae071--- /dev/null+++ b/apps/client/src/widgets/collections/table/TablePrintView.css@@ -0,0 +1,7 @@+.tabulator-print-table table,+.tabulator-print-table th,+.tabulator-print-table tr,+.tabulator-print-table td {+ border: 1px solid black !important;+ border-collapse: collapse;+}\ No newline at end of filediff --git a/apps/client/src/widgets/collections/table/TablePrintView.tsx b/apps/client/src/widgets/collections/table/TablePrintView.tsxindex a7e36dfb31..cc73d7cd20 100644--- a/apps/client/src/widgets/collections/table/TablePrintView.tsx+++ b/apps/client/src/widgets/collections/table/TablePrintView.tsx@@ -4,6 +4,7 @@ import useData, { TableConfig } from "./data";import { ExportModule, PrintModule, Tabulator as VanillaTabulator} from 'tabulator-tables';import Tabulator from "./tabulator";import { RawHtmlBlock } from "../../react/RawHtml";+import "./TablePrintView.css";export default function TablePrintView({ note, noteIds, viewConfig }: ViewModeProps<TableConfig>) {const tabulatorRef = useRef<VanillaTabulator>(null);@@ -21,16 +22,19 @@ export default function TablePrintView({ note, noteIds, viewConfig }: ViewModePrdata={rowData}index="branchId"dataTree={hasChildren}- printAsHtml={true}printStyled={true}onReady={() => {const tabulator = tabulatorRef.current;if (!tabulator) return;- setHtml(tabulator.getHtml());+ const generatedTable = tabulator.modules.export.generateTable(tabulator.options.printConfig, tabulator.options.printStyled, tabulator.options.printRowRange, "print");+ if(tabulator.options.printFormatter){+ tabulator.options.printFormatter(tabulator.element, generatedTable);+ }+ setHtml(generatedTable.outerHTML);}}/>) : (- <RawHtmlBlock html={html} />+ <RawHtmlBlock html={html} className="tabulator-print-fullscreen" />)}</div>