mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 16:39:02 +01:00
fix(type_widgets/attachments): attachments not refreshing when uploading new revision
This commit is contained in:
parent
24b169d667
commit
a82d15e83d
@ -129,12 +129,19 @@ export function AttachmentDetail({ note, viewScope }: TypeWidgetProps) {
|
|||||||
function AttachmentInfo({ attachment, isFullDetail }: { attachment: FAttachment, isFullDetail?: boolean }) {
|
function AttachmentInfo({ attachment, isFullDetail }: { attachment: FAttachment, isFullDetail?: boolean }) {
|
||||||
const contentWrapper = useRef<HTMLDivElement>(null);
|
const contentWrapper = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
function refresh() {
|
||||||
content_renderer.getRenderedContent(attachment, { imageHasZoom: isFullDetail })
|
content_renderer.getRenderedContent(attachment, { imageHasZoom: isFullDetail })
|
||||||
.then(({ $renderedContent }) => {
|
.then(({ $renderedContent }) => {
|
||||||
contentWrapper.current?.replaceChildren(...$renderedContent);
|
contentWrapper.current?.replaceChildren(...$renderedContent);
|
||||||
})
|
});
|
||||||
}, [ attachment ]);
|
}
|
||||||
|
|
||||||
|
useEffect(refresh, [ attachment ]);
|
||||||
|
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
|
||||||
|
if (loadResults.getAttachmentRows().find(attachment => attachment.attachmentId)) {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
async function copyAttachmentLinkToClipboard() {
|
async function copyAttachmentLinkToClipboard() {
|
||||||
if (attachment.role === "image") {
|
if (attachment.role === "image") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user