JSFiddle - React, Tailwind, and code Playground

HTML

Hello, <b>I</b> am in bold.

JavaScript

document.designMode = "on";

window.find("I");
var isAllBold = document.queryCommandState("Bold");
alert("I: " + isAllBold);

window.getSelection().removeAllRanges();

window.find("I am");
isAllBold = document.queryCommandState("Bold");
alert("I am: " + isAllBold);


document.designMode = "off";