JSFiddle - React, Tailwind, and code Playground

HTML

<div id="that_div" contenteditable="true">
    Paste some text here
</div>

JavaScript

function saveSelection()
{
    var sel;

    if(document.selection)
    {
        return document.selection.createRange();
    }
    else
    {
        sel = window.getSelection();
        if(sel.getRangeAt && sel.rangeCount > 0)
        {
            return sel.getRangeAt(0);
        }
        else
        {
            return null;
        }
    }
    //NOTREACHED
}

function restoreSelection(range)
{
    var sel;

    if(document.selection)
    {
        range.select();
    }
    else
    {
        sel = window.getSelection();
        sel.removeAllRanges();
        sel.addRange((range));
    }
}

jQuery(document).ready(function()
    {
        jQuery("#that_div").on("paste", function()
            {
                setTimeout(function()
                    {
                        // remove any HTML
                        //var selection = saveSelection();
                        jQuery("#that_div").text(jQuery("#that_div").text());
                        //restoreSelection(selection);
                    }, 0);
            });
    });