tinymce / tinymce-vue

Official TinyMCE Vue component
MIT License
2.08k stars 208 forks source link

关于富文本插入html标签后,光标定位问题 #397

Closed xdlin424 closed 4 months ago

xdlin424 commented 12 months ago

富文本通过js动态插入html标签后,光标位置会跳转到富文本最前方。

例如原本光标在句子最后,通过appendChild在最后方插入一句文字,光标就会发生跳转,如图 image

请问我想保持光标位置不变,应该怎么做

谢谢!望回复

exalate-issue-sync[bot] commented 12 months ago

Ref: INT-3261

xdlin424 commented 12 months ago

INT-3261貌似是样式继承问题,并不能适用于这里,可能我没有描述清楚,应用场景是这样的: 1.富文本需要根据websocket动态往后插入内容,插入时并不一定换段; 2.富文本同时也可以手动在任意位置插入内容。 现在的问题:点击富文本获取焦点,手动填写内容时,自动插入会改变焦点位置,导致手动填写的内容出现在其他地方。

所以我想问 如何在富文本focus前提下,js自动插入内容,不改变输入框焦点位置

tiny-stale-bot commented 4 months ago

This issue is stale because it has been open 30 days with no activity. Please comment if you wish to keep this issue open or it will be closed in 7 days.

tiny-stale-bot commented 4 months ago

This issue was closed because it has been stalled for 7 days with no activity.