Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

粘贴多个a链接时,会在编辑器底部加上空白行 #5850

Open
hou-zhe opened this issue May 6, 2024 · 5 comments
Open

粘贴多个a链接时,会在编辑器底部加上空白行 #5850

hou-zhe opened this issue May 6, 2024 · 5 comments

Comments

@hou-zhe
Copy link

hou-zhe commented May 6, 2024

bug 描述

粘贴带有a链接的内容时,如果有2个a链接,那么底部会有2个空行,如果20个a链接,底部就会有20个空白行

你预期的样子是?

底部不应该会多出空白行

系统和浏览器及版本号

  • mac pro2
  • Chrome 124.0.6367.62

wangEditor 版本

5.1.23

demo 能否复现该 bug ?

  • 官网demo就会出现

在线 demo

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

最小成本的复现步骤

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

  • 粘贴这段话
    <p><a href=\"www.baidu.com\" target=\"_blank\">第一个a链接</a></p><p><a href=\"www.baidu.com\" target=\"_blank\">第二个a链接</a></p><p><a href=\"www.baidu.com\" target=\"_blank\">第三个a链接</a></p><p><a href=\"www.baidu.com\" target=\"_blank\">第四个a链接</a></p>
  • 复制到官网demo image
  • 底部有3个空行,在打印粘贴事件中的文本就是这样的,但是到编辑器中的时候能看到dom加了好多
@hou-zhe
Copy link
Author

hou-zhe commented May 6, 2024

比如这篇文章中的多个a链接复制一下 https://www.odaily.news/post/5195010

@cycleccc
Copy link

cycleccc commented May 7, 2024

这个应该是粘贴多 node 切割 split 特殊字符的 bug ,和限制最长字数的bug类似。

@cycleccc cycleccc mentioned this issue May 7, 2024
@hou-zhe
Copy link
Author

hou-zhe commented May 7, 2024

这个应该是粘贴多 node 切割 split 特殊字符的 bug ,和限制最长字数的bug类似。

node节点多吗?那可以怎么避免吗,请问,需要去掉链接然后再加上?

@cycleccc
Copy link

cycleccc commented May 7, 2024

避免不了,wangEditor代码层面就会对每一段 node 做切割,切割一次就会多产生一个换行符,这个可能得修改源码,你可以看看我修复的max length 那一块的逻辑自己fork一个发包,或是等我发个包用我修复的版本。#5831

@hou-zhe
Copy link
Author

hou-zhe commented May 7, 2024

避免不了,wangEditor代码层面就会对每一段 node 做切割,切割一次就会多产生一个换行符,这个可能得修改源码,你可以看看我修复的max length 那一块的逻辑自己fork一个发包,或是等我发个包用我修复的版本。#5831

好的,谢谢呀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants