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

fix( text-paste issue 4376): 修复 maxLength 最大字数对外部粘贴进的文本无效 #5831

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cycleccc
Copy link

相关issue #5827

@cycleccc
Copy link
Author

bug成因:

复制的是编辑器外的 text ,源代码 insertText 调用的是原生的而非经过 withMaxLength 重写的

解决思路:

调用 重写后的 insertText 拦截超过字数的 text

@cycleccc
Copy link
Author

相关 issue:

#5837

bug 成因:

  • 只处理了一个 node 的情况,多个 node 没有考虑
  • 外部 text 粘贴 splitNode 产生不必要字符

解决思路:

  • 第一个 node 使用 insertFragment 利用该API底层代码清除多余

    标签

  • 外部 text 当设置了 maxLength 且剩余 length 为0时,不插入任何字符 禁止 splitNode

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

Successfully merging this pull request may close these issues.

None yet

1 participant