From de74c707784648dd48ba1c066aa5d819431637b3 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 6 Dec 2017 01:17:22 +0300 Subject: [PATCH] actually use selected values in popup config dialog --- manage/config-dialog.js | 61 +++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/manage/config-dialog.js b/manage/config-dialog.js index 6b24fdaa..972cb92d 100644 --- a/manage/config-dialog.js +++ b/manage/config-dialog.js @@ -84,25 +84,28 @@ function configDialog(style) { let children; switch (va.type) { case 'color': - va.inputColor = $create('.color-swatch', {va, onclick: showColorpicker}); children = [ $create('.cm-colorview', [ - va.inputColor, + va.inputColor = $create('.color-swatch', { + va, + onclick: showColorpicker + }), ]), ]; break; case 'checkbox': - va.input = $create('input.slider', {type: 'checkbox'}); - va.input.onchange = () => { - va.dirty = true; - va.value = String(Number(va.input.checked)); - }; children = [ $create('span.onoffswitch', [ - va.input, + va.input = $create('input.slider', { + type: 'checkbox', + onchange() { + va.dirty = true; + va.value = String(Number(va.input.checked)); + }, + }), $create('span'), - ]) + ]), ]; break; @@ -110,26 +113,32 @@ function configDialog(style) { case 'dropdown': case 'image': // TODO: a image picker input? - va.input = $create('.select-resizer', [ - $create('select', va.options.map(o => - $create('option', {value: o.name}, o.label))), - $create('SVG:svg.svg-icon.select-arrow', - $create('SVG:use', {'xlink:href': '#svg-icon-select-arrow'})), - ]); - va.input.onchange = () => { - va.dirty = true; - va.value = va.input.value; - }; - children = [va.input]; + children = [ + $create('.select-resizer', [ + va.input = $create('select', { + onchange() { + va.dirty = true; + va.value = this.value; + } + }, + va.options.map(o => + $create('option', {value: o.name}, o.label))), + $create('SVG:svg.svg-icon.select-arrow', + $create('SVG:use', {'xlink:href': '#svg-icon-select-arrow'})), + ]), + ]; break; default: - va.input = $create('input', {type: 'text'}); - va.input.oninput = () => { - va.dirty = true; - va.value = va.input.value; - }; - children = [va.input]; + children = [ + va.input = $create('input', { + type: 'text', + oninput() { + va.dirty = true; + va.value = va.input.value; + }, + }), + ]; break; } elements.push(