title: Auto tokenize last item in pasted string using select2
body: <p>I am using jQuery Select2 to create an input that allows auto tokenization.  I've initialized the select2 input with the following options:</p>
  
  <pre><code>{
      tags: [''],
      tokenSeparators = [',', ' ']
  }
  </code></pre>
  
  <p>Very basic stuff.  When I type a string of text into the input, followed by a comma or space, the preceding string is tokenized, exactly as I would expect.</p>
  
  <p>However, I need to support pasting of text into the input.  This is where things fall apart.</p>
  
  <p>If I paste '1,2,3,4' into the input, I get separate tokens for 1, 2, and 3, but 4 is not tokenized.  Instead, it remains as the value of the <code>input.select2-input</code> and when the focus changes the value disappears.</p>
  
  <p>I have tried a number of different approaches, to no avail.</p>
  
  <p>I have attempted intercepting the paste event, getting the pasted string's value with <code>e.originalEvent.clipboardData.getData('text/plain')</code>, cancelling the event, and adding a comma to the end of the string before changing the input's value with a timed out <code>.select2('val', str)</code>.</p>
  
  <p>I have tried simulating a comma <code>keypress</code> event after the paste event. (<code>.trigger({type: 'keypress', which: 188})</code>)</p>
  
  <p>I have tried changing the value of <code>input.select2-input</code> for each item in the array created by splitting the paste string.</p>
  
  <p>Nothing seems to work. Any ideas?</p>