Replies: 1 comment
-
在执行 insertText 之前要保证选区在 textarea 之内,可以在 插入之前使用 editor.select() api 去将选区聚焦在编辑区,至于换行问题也可以通过 editor.deleteForward 达到返回上一行的效果 运行了你提供的 demo 似乎报错了,不知道这个报错和讨论有没有关系,哈哈 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
问题描述
怎么在末尾插入文本并且不换行
wangEditor 版本
"@wangeditor-next/editor": "^5.6.15",
是否查阅了文档 ?
(文档链接 https://cycleccc.github.io/docs/ )
是
最小成本的复现步骤
demo
设置一个外部的按钮(并非button,使用button没有发现问题)点击这个按钮后向富文本中末尾追加文本
使用
editor.setHtml('<p>内容</p>')
会导致文本换行,如果使用span标签,如果焦点不在富文本中会导致报错无法追加成功(demo中点击其他区域会复现,或者两个按钮多次点击后复现)使用
editor.insertText('内容')
因为用户的焦点不在文本框中导致没反应,控制台中也没有报错dangerouslyInsertHtml()
同样的问题,不会显示Beta Was this translation helpful? Give feedback.
All reactions