feat(revisions): preserve monospace for code notes diff

This commit is contained in:
Elian Doran
2026-04-18 17:36:31 +03:00
parent f4cf8829f7
commit a2cd75c2c4
2 changed files with 11 additions and 2 deletions

View File

@@ -210,6 +210,15 @@ body.desktop .revisions-dialog {
}
}
.revision-diff-code {
font-family: var(--font-family-monospace, monospace);
font-size: 0.9rem;
white-space: pre-wrap;
word-break: break-all;
max-width: 100%;
padding: 0;
}
/* HTML diff styles (htmldiff-js) */
.revision-diff-content {
ins {

View File

@@ -488,7 +488,7 @@ function RevisionContent({ noteContent, revisionItem, fullRevision, showDiff }:
case "text":
return <RevisionContentText content={content} />;
case "code":
return <pre style={CODE_STYLE}>{content}</pre>;
return <div className="revision-diff-code">{content}</div>;
case "image":
switch (revisionItem.mime) {
case "image/svg+xml": {
@@ -571,7 +571,7 @@ function RevisionContentDiff({ noteContent, itemContent, itemType }: {
}
}, [noteContent, itemContent, itemType]);
return <div ref={contentRef} className={clsx("revision-diff-content", { "ck-content": itemType === "text" })} style={itemType !== "text" ? { whiteSpace: "pre-wrap" } : undefined} />;
return <div ref={contentRef} className={clsx("revision-diff-content", itemType === "text" ? "ck-content" : "revision-diff-code")} />;
}