switch textarea to monospace when value starts with slash

This commit is contained in:
LenAnderson
2024-04-09 20:11:02 -04:00
parent e3bb4dd06f
commit 66c5fc554d

View File

@ -2162,4 +2162,13 @@ export function setSlashCommandAutoComplete(textarea, isFloating = false) {
}
window.addEventListener('resize', debounce(updatePosition, 100));
}
setSlashCommandAutoComplete(document.querySelector('#send_textarea'));
/**@type {HTMLTextAreaElement} */
const sendTextarea = document.querySelector('#send_textarea');
setSlashCommandAutoComplete(sendTextarea);
sendTextarea.addEventListener('input', () => {
if (sendTextarea.value[0] == '/') {
sendTextarea.style.fontFamily = 'monospace';
} else {
sendTextarea.style.fontFamily = null;
}
});