mirror of
https://github.com/zadam/trilium.git
synced 2026-01-05 06:04:25 +01:00
feat(revisions): display audio preview for revisions
This commit is contained in:
parent
2b2ef4251f
commit
d84150e97b
@ -285,7 +285,7 @@ function RevisionContentText({ content }: { content: string | Buffer<ArrayBuffer
|
||||
renderMathInElement(contentRef.current, { trust: true });
|
||||
}
|
||||
}, [content]);
|
||||
return <RawHtmlBlock containerRef={contentRef} className="ck-content" html={content as string} />;;
|
||||
return <RawHtmlBlock containerRef={contentRef} className="ck-content" html={content as string} />;
|
||||
}
|
||||
|
||||
function RevisionContentDiff({ noteContent, itemContent, itemType }: {
|
||||
@ -372,9 +372,9 @@ function FilePreview({ revisionItem, fullRevision }: { revisionItem: RevisionIte
|
||||
<tr>
|
||||
<td colspan={2}>
|
||||
<strong>{t("revisions.preview")}</strong>
|
||||
{fullRevision.content
|
||||
? <pre className="file-preview-content" style={CODE_STYLE}>{fullRevision.content}</pre>
|
||||
: <div>{t("revisions.preview_not_available")}</div>}
|
||||
<div>
|
||||
<FilePreviewInner revisionItem={revisionItem} fullRevision={fullRevision} />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -382,6 +382,23 @@ function FilePreview({ revisionItem, fullRevision }: { revisionItem: RevisionIte
|
||||
);
|
||||
}
|
||||
|
||||
function FilePreviewInner({ revisionItem, fullRevision }: { revisionItem: RevisionItem, fullRevision: RevisionPojo }) {
|
||||
if (revisionItem.mime.startsWith("audio/")) {
|
||||
return (
|
||||
<audio
|
||||
src={`api/revisions/${revisionItem.revisionId}/download`}
|
||||
controls
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (fullRevision.content) {
|
||||
return <pre className="file-preview-content" style={CODE_STYLE}>{fullRevision.content}</pre>;
|
||||
}
|
||||
|
||||
return t("revisions.preview_not_available");
|
||||
}
|
||||
|
||||
async function getNote(noteId?: string | null) {
|
||||
if (noteId) {
|
||||
return await froca.getNote(noteId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user