JSFiddle - React, Tailwind, and code Playground

HTML

<div contenteditable="true" id="editable"></div>

CSS

#editable {
    width:200px;
    height:100px;
    border:1px solid #999;
    border-radius: 3px;
    padding: 10px;
    box-sizing:border-box;
}

#editable:focus {
    outline: none;
}

JavaScript

$(document).ready(function() {
    $('#editable').designMode = 'on';
    $('#editable').on('keyup', function(e) {
        console.log(e.which);
        if(e.which == 66 && e.ctrlKey) {
            e.preventDefault();
            console.log('bold');
            document.execCommand ('bold', false, null);
            return false;
        }
    });
});