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