From 7ad9db3e42cf1d792c081558f86f51f4f6e1b73b Mon Sep 17 00:00:00 2001
From: Rao <1227431568@qq.com>
Date: Thu, 27 Feb 2025 16:51:47 +0800
Subject: [PATCH 1/2] rht
---
.../src/components/common/editor/MindEditor.tsx | 15 ++++++---------
apps/web/src/index.css | 2 +-
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/apps/web/src/components/common/editor/MindEditor.tsx b/apps/web/src/components/common/editor/MindEditor.tsx
index bd4c877..b1d4a39 100755
--- a/apps/web/src/components/common/editor/MindEditor.tsx
+++ b/apps/web/src/components/common/editor/MindEditor.tsx
@@ -24,7 +24,7 @@ const MIND_OPTIONS = {
draggable: true,
contextMenu: true,
toolBar: true,
- //nodeMenu: true,
+ nodeMenu: true,
keypress: true,
locale: "zh_CN" as const,
theme: {
@@ -67,7 +67,7 @@ export default function MindEditor({ id }: { id?: string }) {
const canEdit: boolean = useMemo(() => {
//登录了且是作者、超管、无id新建模式
const isAuth = isAuthenticated && user?.id == post?.authorId;
- return !id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST);
+ return !Boolean(id) || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST);
}, [user])
const navigate = useNavigate();
const { create, update } = usePost();
@@ -183,14 +183,11 @@ export default function MindEditor({ id }: { id?: string }) {
);
};
return (
-
+
{canEdit && taxonomies && (
)}
-
e.preventDefault()} />
+
e.preventDefault()} />
{canEdit && instance &&
}
{isLoading && (
Date: Thu, 27 Feb 2025 19:17:23 +0800
Subject: [PATCH 2/2] rht
---
apps/web/src/app/main/layout/MainLayout.tsx | 2 +-
apps/web/src/components/common/editor/MindEditor.tsx | 2 +-
apps/web/src/components/models/post/SubPost/CourseCard.tsx | 2 +-
apps/web/src/components/models/post/SubPost/PathCard.tsx | 1 +
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/apps/web/src/app/main/layout/MainLayout.tsx b/apps/web/src/app/main/layout/MainLayout.tsx
index fa6627a..739bcaa 100755
--- a/apps/web/src/app/main/layout/MainLayout.tsx
+++ b/apps/web/src/app/main/layout/MainLayout.tsx
@@ -11,7 +11,7 @@ export function MainLayout() {
-
+
diff --git a/apps/web/src/components/common/editor/MindEditor.tsx b/apps/web/src/components/common/editor/MindEditor.tsx
index b1d4a39..88d745b 100755
--- a/apps/web/src/components/common/editor/MindEditor.tsx
+++ b/apps/web/src/components/common/editor/MindEditor.tsx
@@ -66,7 +66,7 @@ export default function MindEditor({ id }: { id?: string }) {
});
const canEdit: boolean = useMemo(() => {
//登录了且是作者、超管、无id新建模式
- const isAuth = isAuthenticated && user?.id == post?.authorId;
+ const isAuth = isAuthenticated && user?.id == post?.author.id
return !Boolean(id) || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST);
}, [user])
const navigate = useNavigate();
diff --git a/apps/web/src/components/models/post/SubPost/CourseCard.tsx b/apps/web/src/components/models/post/SubPost/CourseCard.tsx
index 25ce782..6140607 100644
--- a/apps/web/src/components/models/post/SubPost/CourseCard.tsx
+++ b/apps/web/src/components/models/post/SubPost/CourseCard.tsx
@@ -8,7 +8,7 @@ export default function CourseCard({ post }: { post: PostDto }) {
post={post}
onClick={() => {
navigate(`/course/${post?.id}/detail`);
-
+ window.scrollTo({ top: 0, behavior: "smooth" });
}}>
);
}
diff --git a/apps/web/src/components/models/post/SubPost/PathCard.tsx b/apps/web/src/components/models/post/SubPost/PathCard.tsx
index c6e5a85..9de4ed0 100644
--- a/apps/web/src/components/models/post/SubPost/PathCard.tsx
+++ b/apps/web/src/components/models/post/SubPost/PathCard.tsx
@@ -9,6 +9,7 @@ export default function PathCard({ post }: { post: PostDto }) {
post={post}
onClick={() => {
navigate(`/path/editor/${post?.id}`);
+ window.scrollTo({ top: 0, behavior: "smooth" });
}}>
);
}