This commit is contained in:
linfeng 2025-03-07 18:44:41 +08:00
commit 53e203e968
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 [form] = Form.useForm();
const CustomLinkIconPlugin = (mind) => {
mind.bus.addListener("operation", async () => {
const hyperLinkElement =
await document.querySelectorAll(".hyper-link");
const handleIcon = () => {
const hyperLinkElement =document.querySelectorAll(".hyper-link");
console.log("hyperLinkElement", hyperLinkElement);
hyperLinkElement.forEach((item) => {
const hyperLinkDom = createRoot(item);
hyperLinkDom.render(<LinkOutlined />);
});
});
}
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()}`
);
};