blob: 6edebb098da85c23f191778f38600346c95736bb [file] [log] [blame]
<style>
body {
width: 100%;
height: 100%;
}
#editable {
width: 100%;
height: 400px;
font-size: 400px;
white-space: nowrap;
border: 1px blue dashed;
}
</style>
<div id="editable" contenteditable>Hello world</div>
<script>
document.addEventListener("selectionchange", () => {
if (!getSelection().rangeCount || getSelection().isCollapsed)
return;
setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("selected"), 0);
});
</script>