self.cmd.range.setStartBefore().collapse(true)self.cmd.select() 通过dom节点设置range的范围 <h1>content</h1> 选在h1之后 <h1>..</h1> 光标在这 选在h1最后一个节点之后 <h1>content 光标在这</h1> 这是容易不理解的地方 转载于:https://www.cnblogs.com/znsongshu/p/6079417.html