This commit is contained in:
Rao 2025-03-07 18:01:07 +08:00
parent ed31d8d00b
commit b8e82aeaaf
1 changed files with 14 additions and 10 deletions

View File

@ -62,16 +62,16 @@ export default function MindEditor({ id }: { id?: string }) {
}); });
const { handleFileUpload } = useTusUpload(); const { handleFileUpload } = useTusUpload();
const [form] = Form.useForm(); const [form] = Form.useForm();
const CustomLinkIconPlugin = (mind) => { const handleIcon = () => {
mind.bus.addListener("operation", async () => { const hyperLinkElement =document.querySelectorAll(".hyper-link");
const hyperLinkElement = console.log("hyperLinkElement", hyperLinkElement);
await document.querySelectorAll(".hyper-link"); hyperLinkElement.forEach((item) => {
console.log("hyperLinkElement", hyperLinkElement); const hyperLinkDom = createRoot(item);
hyperLinkElement.forEach((item) => { hyperLinkDom.render(<LinkOutlined />);
const hyperLinkDom = createRoot(item);
hyperLinkDom.render(<LinkOutlined />);
});
}); });
}
const CustomLinkIconPlugin = (mind) => {
mind.bus.addListener("operation", handleIcon)
}; };
useEffect(() => { useEffect(() => {
if (post?.id && id) { if (post?.id && id) {
@ -133,7 +133,11 @@ export default function MindEditor({ id }: { id?: string }) {
containerRef.current.hidden = true; containerRef.current.hidden = true;
//挂载实例 //挂载实例
setInstance(mind); setInstance(mind);
}, [canEdit]); }, [canEdit]);
useEffect(() => {
handleIcon()
});
useEffect(() => { useEffect(() => {
if ((!id || post) && instance) { if ((!id || post) && instance) {
containerRef.current.hidden = false; containerRef.current.hidden = false;
@ -204,7 +208,7 @@ export default function MindEditor({ id }: { id?: string }) {
} }
console.log(result); console.log(result);
}, },
(error) => {}, (error) => { },
`mind-thumb-${new Date().toString()}` `mind-thumb-${new Date().toString()}`
); );
}; };