Inserting caret after an inserted node

后端 未结 2 1766
南方客
南方客 2021-02-04 10:20

So I have a method that takes a tag and wraps the selected text in that tag.

function wrap(tag) 
{               
    var sel, range;
    if (window.getSelectio         


        
2条回答
  •  礼貌的吻别
    2021-02-04 10:46

    do this after inserting the node to the range range.collapse(false); this will change position of selection range to the end of the range, so my guess is it should set the cursor at end position

提交回复
热议问题