From 6afb4dc634529b0b38edacffbc99b6c7af9541a6 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 25 Dec 2021 22:17:35 +0300 Subject: [PATCH] fix toggling of `newline` in beautifier dialog --- edit/beautify.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/edit/beautify.js b/edit/beautify.js index 659046d8..cdc271d1 100644 --- a/edit/beautify.js +++ b/edit/beautify.js @@ -119,10 +119,9 @@ function createBeautifyUI(scope, options) { $('.beautify-options').onchange = ({target}) => { 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})); - if (target.parentNode.hasAttribute('newline')) { - target.parentNode.setAttribute('newline', value.toString()); - } beautify(scope, false); };