This commit is contained in:
Philipinho
2026-01-31 16:46:40 +00:00
parent cff4ba8e50
commit 8e2cf9bb02
5 changed files with 29 additions and 22 deletions
@@ -1,7 +1,3 @@
.container {
width: 100%;
}
.diffSummary {
border: rem(1px) solid
light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
@@ -6,6 +6,8 @@ import { Badge, Divider, Group, Text, Title } from "@mantine/core";
import { Decoration, DecorationSet } from "@tiptap/pm/view";
import { computeHistoryBlockDiff } from "@/features/page-history/utils/history-diff";
import classes from "./history-diff.module.css";
import historyClasses from "./history.module.css";
export interface HistoryEditorProps {
title: string;
@@ -23,7 +25,10 @@ export function HistoryEditor({
editable: false,
});
const [diffCounts, setDiffCounts] = useState<{ added: number; deleted: number }>({
const [diffCounts, setDiffCounts] = useState<{
added: number;
deleted: number;
}>({
added: 0,
deleted: 0,
});
@@ -58,7 +63,10 @@ export function HistoryEditor({
Decoration.node(r.from, r.to, { class: "history-diff-deleted" }),
);
decorationSet = DecorationSet.create(diffDoc, [...decos, ...deletedDecos]);
decorationSet = DecorationSet.create(diffDoc, [
...decos,
...deletedDecos,
]);
} catch {
decorationSet = DecorationSet.empty;
addedCount = 0;
@@ -83,7 +91,7 @@ export function HistoryEditor({
return (
<>
<div className={classes.container}>
<div>
<Title order={1}>{title}</Title>
{previousContent && (
@@ -108,7 +116,10 @@ export function HistoryEditor({
)}
{editor && (
<EditorContent editor={editor} className={classes.historyEditor} />
<EditorContent
editor={editor}
className={historyClasses.historyEditor}
/>
)}
</div>
</>
@@ -26,12 +26,12 @@
}
.sidebar {
max-height: rem(700px);
width: rem(250px);
padding: var(--mantine-spacing-sm);
display: flex;
flex-direction: column;
border-right: rem(1px) solid
max-height: rem(700px);
width: rem(250px);
padding: var(--mantine-spacing-sm);
display: flex;
flex-direction: column;
border-right: rem(1px) solid
light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
}
@@ -44,6 +44,6 @@
}
.sidebarRightSection {
flex: 1;
padding: rem(16px) rem(40px);
flex: 1;
padding: rem(16px) rem(40px);
}
+3 -3
View File
@@ -10,8 +10,8 @@
"module": "./src/index.ts",
"types": "dist/index.d.ts",
"dependencies": {
"diff": "^8.0.3",
"prosemirror-changeset": "^2.3.1",
"rfc6902": "^5.1.2"
"diff": "8.0.3",
"prosemirror-changeset": "2.3.1",
"rfc6902": "5.1.2"
}
}
+3 -3
View File
@@ -745,13 +745,13 @@ importers:
packages/editor-ext:
dependencies:
diff:
specifier: ^8.0.3
specifier: 8.0.3
version: 8.0.3
prosemirror-changeset:
specifier: ^2.3.1
specifier: 2.3.1
version: 2.3.1
rfc6902:
specifier: ^5.1.2
specifier: 5.1.2
version: 5.1.2
packages: