console
function setFontStyle() {
const fontStyle = document.getElementById('fontStyle').value;
document.execCommand(fontStyle, false, null);
}
function saveContent() {
const editor = document.getElementById('editor');
const content = editor.innerHTML;
console.log(content);
}
<div id="editor" contenteditable="true" style="border: 1px solid #ccc; min-height: 200px;"></div>
<select id="fontStyle">
<option value="normal">Normal</option>
<option value="bold">Bold</option>
<option value="italic">Italic</option>
</select>
<button onclick="setFontStyle()">Set Style</button>