liAnran

博客园 首页 新随笔 联系 订阅 管理

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,光标不见。

posted on 2020-09-01 17:11  liAnran  阅读(3111)  评论(0编辑  收藏  举报