actually use selected values in popup config dialog

This commit is contained in:
tophf 2017-12-06 01:17:22 +03:00
parent 85c67872a5
commit de74c70778

View File

@ -84,25 +84,28 @@ function configDialog(style) {
let children; let children;
switch (va.type) { switch (va.type) {
case 'color': case 'color':
va.inputColor = $create('.color-swatch', {va, onclick: showColorpicker});
children = [ children = [
$create('.cm-colorview', [ $create('.cm-colorview', [
va.inputColor, va.inputColor = $create('.color-swatch', {
va,
onclick: showColorpicker
}),
]), ]),
]; ];
break; break;
case 'checkbox': case 'checkbox':
va.input = $create('input.slider', {type: 'checkbox'});
va.input.onchange = () => {
va.dirty = true;
va.value = String(Number(va.input.checked));
};
children = [ children = [
$create('span.onoffswitch', [ $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'), $create('span'),
]) ]),
]; ];
break; break;
@ -110,26 +113,32 @@ function configDialog(style) {
case 'dropdown': case 'dropdown':
case 'image': case 'image':
// TODO: a image picker input? // TODO: a image picker input?
va.input = $create('.select-resizer', [ children = [
$create('select', va.options.map(o => $create('.select-resizer', [
$create('option', {value: o.name}, o.label))), va.input = $create('select', {
$create('SVG:svg.svg-icon.select-arrow', onchange() {
$create('SVG:use', {'xlink:href': '#svg-icon-select-arrow'})), va.dirty = true;
]); va.value = this.value;
va.input.onchange = () => { }
va.dirty = true; },
va.value = va.input.value; va.options.map(o =>
}; $create('option', {value: o.name}, o.label))),
children = [va.input]; $create('SVG:svg.svg-icon.select-arrow',
$create('SVG:use', {'xlink:href': '#svg-icon-select-arrow'})),
]),
];
break; break;
default: default:
va.input = $create('input', {type: 'text'}); children = [
va.input.oninput = () => { va.input = $create('input', {
va.dirty = true; type: 'text',
va.value = va.input.value; oninput() {
}; va.dirty = true;
children = [va.input]; va.value = va.input.value;
},
}),
];
break; break;
} }
elements.push( elements.push(