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 =
await document.querySelectorAll(".hyper-link");
console.log("hyperLinkElement", hyperLinkElement); console.log("hyperLinkElement", hyperLinkElement);
hyperLinkElement.forEach((item) => { hyperLinkElement.forEach((item) => {
const hyperLinkDom = createRoot(item); const hyperLinkDom = createRoot(item);
hyperLinkDom.render(<LinkOutlined />); 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;