From b8e82aeaaf2f8085cf321010eefbfd137f5aafaf Mon Sep 17 00:00:00 2001
From: Rao <1227431568@qq.com>
Date: Fri, 7 Mar 2025 18:01:07 +0800
Subject: [PATCH] rht
---
.../components/common/editor/MindEditor.tsx | 24 +++++++++++--------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/apps/web/src/components/common/editor/MindEditor.tsx b/apps/web/src/components/common/editor/MindEditor.tsx
index 065917e..0b1dff6 100755
--- a/apps/web/src/components/common/editor/MindEditor.tsx
+++ b/apps/web/src/components/common/editor/MindEditor.tsx
@@ -62,16 +62,16 @@ export default function MindEditor({ id }: { id?: string }) {
});
const { handleFileUpload } = useTusUpload();
const [form] = Form.useForm();
- const CustomLinkIconPlugin = (mind) => {
- mind.bus.addListener("operation", async () => {
- const hyperLinkElement =
- await document.querySelectorAll(".hyper-link");
- console.log("hyperLinkElement", hyperLinkElement);
- hyperLinkElement.forEach((item) => {
- const hyperLinkDom = createRoot(item);
- hyperLinkDom.render();
- });
+ const handleIcon = () => {
+ const hyperLinkElement =document.querySelectorAll(".hyper-link");
+ console.log("hyperLinkElement", hyperLinkElement);
+ hyperLinkElement.forEach((item) => {
+ const hyperLinkDom = createRoot(item);
+ hyperLinkDom.render();
});
+ }
+ const CustomLinkIconPlugin = (mind) => {
+ mind.bus.addListener("operation", handleIcon)
};
useEffect(() => {
if (post?.id && id) {
@@ -133,7 +133,11 @@ export default function MindEditor({ id }: { id?: string }) {
containerRef.current.hidden = true;
//挂载实例
setInstance(mind);
+
}, [canEdit]);
+ useEffect(() => {
+ handleIcon()
+ });
useEffect(() => {
if ((!id || post) && instance) {
containerRef.current.hidden = false;
@@ -204,7 +208,7 @@ export default function MindEditor({ id }: { id?: string }) {
}
console.log(result);
},
- (error) => {},
+ (error) => { },
`mind-thumb-${new Date().toString()}`
);
};