function toggleWrap(){ let mode = editor.session.getUseWrapMode(); editor.session.setUseWrapMode(!mode) let el = document.getElementById("toolWrap"); if (mode){ el.classList.remove("is-success"); el.classList.add("is-danger"); } else { el.classList.remove("is-danger"); el.classList.add("is-success"); } } function toolFormat(){ beautify.beautify(editor.session); } (function(){ setEditor() }())