1、在contenteditable="true"  中插入contenteditable="false"的元素,如果为其设置css user-select: none;后会导致删除连续的 contenteditable="false" 元素被一次性删除。

eg:编辑器中插入action删除单个导致一串元素被删除。

2、想让 contenteditable 元素粘贴时自动过滤样式可以为元素设置 css 属性 -webkit-user-modify: read-write-plaintext-only方便,这样确实方便,可是会导致元素在contenteditable="false" 状态下也能编辑

3、在contenteditable="true" 中插入 contenteditable="false" 的元素后会导致光标不可见,可以在内容末尾插入一个 br 标签。

eg:文章最后插入标题h2,contenteditable="false,光标不见。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-19
  • 2022-12-23
  • 2021-06-18
  • 2022-01-10
  • 2021-12-19
  • 2021-10-05
  • 2021-12-16
相关资源
相似解决方案