Add a button to toggle visible whitespace for now. Not yet persisted.

This commit is contained in:
2024-02-25 22:31:31 -05:00
parent 637119d46d
commit 60ada22674
2 changed files with 38 additions and 1 deletions

View File

@ -1662,6 +1662,29 @@ async function sourcePretty() {
}
}
function toggleVisibleWhitespace() {
let editor_style = document.getElementById('editor_style');
/*
* There is likely a better way to do this, but stomping on the CSS was
* the easiest to wrangle at the time.
*/
if (editor_style.innerHTML.length) {
editor_style.innerHTML = '';
} else {
editor_style.innerHTML = css`
.cm-trailingSpace {
background-color: unset !important;
}
.cm-highlightTab {
background-image: unset !important;
}
.cm-highlightSpace:before {
content: unset !important;
}
`;
}
}
// TODOC
window.addEventListener('load', function () {
window.addEventListener('hashchange', hashChange);
@ -1687,6 +1710,9 @@ window.addEventListener('load', function () {
document
.getElementById('pretty')
.addEventListener('click', () => sourcePretty());
document
.getElementById('whitespace')
.addEventListener('click', () => toggleVisibleWhitespace());
document
.getElementById('trace_button')
.addEventListener('click', function (event) {