fix toggling of newline in beautifier dialog

This commit is contained in:
tophf 2021-12-25 22:17:35 +03:00
parent 440395db9f
commit 6afb4dc634

View File

@ -119,10 +119,9 @@ function createBeautifyUI(scope, options) {
$('.beautify-options').onchange = ({target}) => { $('.beautify-options').onchange = ({target}) => {
const value = target.type === 'checkbox' ? target.checked : target.selectedIndex > 0; const value = target.type === 'checkbox' ? target.checked : target.selectedIndex > 0;
const elLine = target.closest('[newline]');
if (elLine) elLine.setAttribute('newline', value);
prefs.set('editor.beautify', Object.assign(options, {[target.dataset.option]: value})); prefs.set('editor.beautify', Object.assign(options, {[target.dataset.option]: value}));
if (target.parentNode.hasAttribute('newline')) {
target.parentNode.setAttribute('newline', value.toString());
}
beautify(scope, false); beautify(scope, false);
}; };