JSFiddle - React, Tailwind, and code Playground

HTML

paste multline input:<br>
<input size="100">

<!-- sample input, copy below this line --
one
2
hello world
foo bar
m3000
-- end copy -->

<!-- output should look like
one, 2, hello world, foo bar, m3000
-->

JavaScript

$(function(){
    $('input').on('paste', function(e){
        var e = $(this);
        setTimeout(function(){
            e.val( $.trim(e.val()).replace(/\s+/g, ', ') );
        }, 0);
    });
});