mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
fix(client/print): get text notes to print
This commit is contained in:
@@ -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 ]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user