From 0c5a6a75481bc816768d593f664c92240cb8e764 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 21 Nov 2025 22:17:54 +0200 Subject: [PATCH] feat(print/table): integrate with the printing mechanism --- .../src/widgets/collections/table/TablePrintView.tsx | 9 +++++++-- apps/client/src/widgets/ribbon/NoteActions.tsx | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/collections/table/TablePrintView.tsx b/apps/client/src/widgets/collections/table/TablePrintView.tsx index abf73f1ee..9582b4360 100644 --- a/apps/client/src/widgets/collections/table/TablePrintView.tsx +++ b/apps/client/src/widgets/collections/table/TablePrintView.tsx @@ -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) { +export default function TablePrintView({ note, noteIds, viewConfig, onReady }: ViewModeProps) { const tabulatorRef = useRef(null); const { columnDefs, rowData, hasChildren } = useData(note, noteIds, viewConfig, undefined, () => {}); const [ html, setHtml ] = useState(); + useEffect(() => { + if (!html) return; + onReady?.(); + }, [ html ]); + return rowData && ( <>

{note.title}

diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx index d7e344dd8..33017221b 100644 --- a/apps/client/src/widgets/ribbon/NoteActions.tsx +++ b/apps/client/src/widgets/ribbon/NoteActions.tsx @@ -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);