简体   繁体   English

TinyMCE:将光标移动到插入文本的末尾

[英]TinyMCE: Move cursor to end of inserted text

I have insert a line break within TinyMCE 我在TinyMCE中插入换行符

tinyMCE.execCommand('mceInsertContent',false, "<br/>");

However the cursor currently stays where it was before.. which makes sense, however I would like code which moves the cursor the end of the html I just inserted? 然而,光标当前保持在之前的位置..这是有道理的,但是我希望代码将光标移动到我刚刚插入的html的末尾?

Adding a space after the <br/> will reposition the cursor: 添加后的空间<br/>将重新定位光标:

So change: 所以改变:

tinyMCE.execCommand('mceInsertContent',false, "<br/>");

to

tinyMCE.execCommand('mceInsertContent',false, "<br/> ");

Example: http://codepen.io/anon/pen/PbKQpJ (demo links above editor) 示例: http//codepen.io/anon/pen/PbKQpJ (编辑器上方的演示链接)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM