wangeditor-team / wangEditor

wangEditor, open-source Web rich text editor 开源 Web 富文本编辑器
http://www.wangeditor.com/
MIT License
17.54k stars 3.32k forks source link

只要我新增图片之后,在重新setHtml就会报错 #5955

Open wangyunhao993 opened 1 month ago

wangyunhao993 commented 1 month ago

bug 描述

vue3项目用cdn加载的wangEditor,我新增上传照片,然后然后清楚内容, 在重新setHtml上次的内容就会报错,然后没有加载内容

你预期的样子是?

不要报错,且正确加载内容

系统和浏览器及版本号

谷歌最新版浏览器

wangEditor 版本

最新版 请输入内容……

demo 能否复现该 bug ?

能/不能

在线 demo

请尽量提供在线 demo (推荐以下网站),帮助我们最低成本复现 bug

最小成本的复现步骤

(请告诉我们,如何最快的复现该 bug)

cycleccc commented 1 month ago

录个视频看下,报错信息贴一下,最好有最小复现 demo

wangyunhao993 commented 1 month ago

/

https://github.com/user-attachments/assets/a8e128a1-25af-4b8b-a159-838d9ac3128a 看下能看到不

wangyunhao993 commented 1 month ago

报错信息,只复制一半 Error: Cannot find a descendant at path [0,4] in node: {"children":[{"type":"paragraph","children":[{"text":""}]}],"operations":[{"type":"set_selection","properties":null,"newProperties":{"anchor":{"path":[0,4],"offset":0},"focus":{"path":[0,4],"offset":0}}}],"selection":{"anchor":{"path":[0,4],"offset":0},"focus":{"path":[0,4],"offset":0}},"marks":null,"id":"wangEditor-1","isDestroyed":false,"isFullScreen":false,"history":{"undos":[[{"type":"remove_node","path":[0],"node":{"type":"paragraph","children":[{"text":""}]}},{"type":"insert_node","path":[0],"node":{"type":"paragraph","children":[{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260366e0029bce14e.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260366e0029bce14e.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260466e0029c544bc.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260466e0029c544bc.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260466e0029ca4097.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260466e0029ca4097.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260566e0029d2eea0.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260566e0029d2eea0.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260566e0029d86b86.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260566e0029d86b86.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260566e0029dee9ad.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260566e0029dee9ad.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260666e0029e590b8.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260666e0029e590b8.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260666e0029eb28e0.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260666e0029eb28e0.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260666e0029ef41f8.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260666e0029ef41f8.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260766e0029f3a0c4.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260766e0029f3a0c4.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260766e0029faa2a2.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260766e0029faa2a2.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260866e002a06dd72.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260866e002a06dd72.jpg","style":{"width":"","height":""},"children":[{"text":""}]},{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260866e002a0e3e92.jpg","alt":"桥溪村","href":"https://oss.exchain.cc/picture/20240910/2024091016260866e002a0e3e92.jpg","style":{"width":"","height":""},"children":[{"text":""}]}]}},{"type":"insert_node","path":[0,0],"node":{"text":""}},{"type":"insert_node","path":[0,2],"node":{"text":""}},{"type":"insert_node","path":[0,4],"node":{"text":""}},{"type":"insert_node","path":[0,6],"node":{"text":""}},{"type":"insert_node","path":[0,8],"node":{"text":""}},{"type":"insert_node","path":[0,10],"node":{"text":""}},{"type":"insert_node","path":[0,12],"node":{"text":""}},{"type":"insert_node","path":[0,14],"node":{"text":""}},{"type":"insert_node","path":[0,16],"node":{"text":""}},{"type":"insert_node","path":[0,18],"node":{"text":""}},{"type":"insert_node","path":[0,20],"node":{"text":""}},{"type":"insert_node","path":[0,22],"node":{"text":""}},{"type":"insert_node","path":[0,24],"node":{"text":""}},{"type":"insert_node","path":[0,26],"node":{"text":""}}],[{"type":"remove_node","path":[0,1],"node":{"type":"image","src":"https://oss.exchain.cc/picture/20240910/2024091016260366e0029bce14e.jpg","alt":"桥溪

wangyunhao993 commented 1 month ago

我这是项目里面的代码,不好抽出搞domo

cycleccc commented 1 month ago

估计还是和 dialog 里面没销毁有关,你试试销毁dialog,或是等我周末做个复现,wangeditor嵌入dialog报错挺多人提的,我抽空解决下。