src/mixins/multipleSelection.js
/**
     * Handles pasting into the input
     * @param {ClipboardEvent} event
     */
Handles pasting into the input
@param {ClipboardEvent} event
Handles pasting into the input @param { ClipboardEvent } event
handlePaste(event) {
      event.preventDefault();
      const { types } = event.clipboardData;
      let tags = [];
      let input = event.clipboardData.getData('text/plain');
      if (types.includes('text/html')) {
        const pasteBuffer = event.clipboardData.getData('text/html');
        const data = parseDataFromClipboard(pasteBuffer);
        if (data) {
          ({ tags = [], input = '' } = data);
        }
      }
      const selection = getSelectionText();
      if (selection.length) {
        input = this.input.replace(selection, input);
      } else {
        input = insertAt(this.input, input, document.activeElement.selectionStart);
      }
      this.setFilterInput(input.trim());
      if (this.allSelectedTagsAreActive) {
        this.setSelectedTags(tags);
      } else {
        this.updateSelectedTags(tags);
      }
      this.resetActiveTags();
    }
handlePaste ( event ) { event . preventDefault ( ) ; const { types } = event . clipboardData ; let tags = [ ] ; let input = event . clipboardData . getData ( 'text/plain' ) ; if ( types . includes ( 'text/html' ) ) { const pasteBuffer = event . clipboardData . getData ( 'text/html' ) ; const data = parseDataFromClipboard ( pasteBuffer ) ; if ( data ) { ( { tags = [ ] , input = '' } = data ) ; } } const selection = getSelectionText ( ) ; if ( selection . length ) { input = this . input . replace ( selection , input ) ; } else { input = insertAt ( this . input , input , document . activeElement . selectionStart ) ; } this . setFilterInput ( input . trim ( ) ) ; if ( this . allSelectedTagsAreActive ) { this . setSelectedTags ( tags ) ; } else { this . updateSelectedTags ( tags ) ; } this . resetActiveTags ( ) ; }
Handles pasting into the input
 @param {ClipboardEvent} event
Handles pasting into the input @param { ClipboardEvent } event
// try to get the data from `text/html` content // if there is match, get the `tags` and `input` from the JSON data // if we have selected parts of the input, we need to replace it. // this works if you have selected all as well. // inject the new text there hte cursor is currently at.