Rangy库集选择了下一个节点的起始偏移量

时间:2016-01-11 13:06:59

标签: javascript range rangy

我有:

        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet" />
		

        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/2.3.2/js/bootstrap.min.js"></script>
		



<div class="div-table">

  <div class="div-table-row">
    <div class="div-table-col">
      <label for="A">A</label>
    </div>
    <div class="div-table-col2">
      <input id="A" name="A" placeholder="A" value="" type="text">
    </div>
  </div>
  <div class="div-table-row">
    <div class="div-table-col">
      <label for="T">T</label>
    </div>
    <div class="div-table-col2">
      <input id="T" name="T" placeholder="T" value="" type="text">
    </div>
  </div>
  <div class="divRow">
    <div class="div-table-col">
      From
          <br/>

    </div>
    <div class="div-table-col2">
      
      
    <button id="From" style="margin-bottom:10px;" title="122344" data-id="From" type="button" class="btn dropdown-toggle form-control selectpicker btn-default" data-toggle="dropdown"><span class="filter-option pull-left">122344</span>&nbsp;<span class="caret"></span></button>
      
      <br/>
    </div>
  </div>

  <div class="divRow">
    <div class="div-table-col">DD & DD</div>
    <div class="div-table-col2">
      
      
      <select id="SSS" style="max-width: 200px;"></select>
      
      
      <select id="SSS" style="max-width: 200px;"></select>
   
      
      
    </div>
    
    
    
    
    
    

    
    
    
  </div>  

  
  
    <div class="div-table-col">
      <label for="AWB">Message </label>    
    </div>
    <div class="div-table-col2">  
      <textarea name="Text" id="Text" cols="10" rows="10" class="input-large">
      </textarea>
    </div>    
    
    

  
  
  </div>
  

当我在<div class="content-sms"><p contenteditable="true">Hellow! <span>#name</span>, you are welcome to the <span>#place</span>.</p></div> 内键入空格键时,我需要选择下一个节点的起始偏移量。

示例:当我输入span时,按空格键我想选择此位置<span>#name[selected here]</span>

这是我创建的两个方法:

<span>#name</span>[selected here], you are welcome to the

我正在使用ES6,我希望你能帮助我。

谢谢。

0 个答案:

没有答案