fix(client/print): get text notes to print

This commit is contained in:
Elian Doran
2025-10-19 22:12:41 +03:00
parent 5957ce26f1
commit 678018585f

View File

@@ -2,7 +2,7 @@ import FNote from "./entities/fnote";
import { render } from "preact";
import { CustomNoteList } from "./widgets/collections/NoteList";
import "./print.css";
import { useCallback, useEffect, useRef } from "preact/hooks";
import { useCallback, useLayoutEffect, useRef } from "preact/hooks";
import content_renderer from "./services/content_renderer";
interface RendererProps {
@@ -44,11 +44,12 @@ function App({ note }: { note: FNote }) {
function SingleNoteRenderer({ note, onReady }: RendererProps) {
const containerRef = useRef<HTMLDivElement>(null);
useEffect(() => {
useLayoutEffect(() => {
content_renderer.getRenderedContent(note, {
noChildrenList: true
}).then(({$renderedContent}) => {
containerRef.current?.replaceChildren(...$renderedContent);
requestAnimationFrame(onReady);
});
}, [ note ]);