mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 15:55:52 +01:00
feat(render): add a floating button to refresh
This commit is contained in:
@@ -69,7 +69,7 @@ export const MOBILE_FLOATING_BUTTONS: FloatingButtonsList = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
function RefreshBackendLogButton({ note, parentComponent, noteContext, isDefaultViewMode }: FloatingButtonContext) {
|
function RefreshBackendLogButton({ note, parentComponent, noteContext, isDefaultViewMode }: FloatingButtonContext) {
|
||||||
const isEnabled = note.noteId === "_backendLog" && isDefaultViewMode;
|
const isEnabled = (note.noteId === "_backendLog" || note.type === "render") && isDefaultViewMode;
|
||||||
return isEnabled && <FloatingButton
|
return isEnabled && <FloatingButton
|
||||||
text={t("backend_log.refresh")}
|
text={t("backend_log.refresh")}
|
||||||
icon="bx bx-refresh"
|
icon="bx bx-refresh"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { t } from "../../services/i18n";
|
|||||||
import RawHtml from "../react/RawHtml";
|
import RawHtml from "../react/RawHtml";
|
||||||
import { useTriliumEvent } from "../react/hooks";
|
import { useTriliumEvent } from "../react/hooks";
|
||||||
|
|
||||||
export default function Render({ note, noteContext }: TypeWidgetProps) {
|
export default function Render({ note, noteContext, ntxId }: TypeWidgetProps) {
|
||||||
const contentRef = useRef<HTMLDivElement>(null);
|
const contentRef = useRef<HTMLDivElement>(null);
|
||||||
const [ renderNotesFound, setRenderNotesFound ] = useState(false);
|
const [ renderNotesFound, setRenderNotesFound ] = useState(false);
|
||||||
|
|
||||||
@@ -22,6 +22,10 @@ export default function Render({ note, noteContext }: TypeWidgetProps) {
|
|||||||
if (noteContext?.isActive()) return;
|
if (noteContext?.isActive()) return;
|
||||||
refresh();
|
refresh();
|
||||||
});
|
});
|
||||||
|
useTriliumEvent("refreshData", ({ ntxId: eventNtxId }) => {
|
||||||
|
if (eventNtxId !== ntxId) return;
|
||||||
|
refresh();
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="note-detail-render note-detail-printable">
|
<div className="note-detail-render note-detail-printable">
|
||||||
|
|||||||
Reference in New Issue
Block a user