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', [
va.input = $create('select', {
onchange() {
va.dirty = true;
va.value = this.value;
}
},
va.options.map(o =>
$create('option', {value: o.name}, o.label))), $create('option', {value: o.name}, o.label))),
$create('SVG:svg.svg-icon.select-arrow', $create('SVG:svg.svg-icon.select-arrow',
$create('SVG:use', {'xlink:href': '#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];
break; break;
default: default:
va.input = $create('input', {type: 'text'}); children = [
va.input.oninput = () => { va.input = $create('input', {
type: 'text',
oninput() {
va.dirty = true; va.dirty = true;
va.value = va.input.value; va.value = va.input.value;
}; },
children = [va.input]; }),
];
break; break;
} }
elements.push( elements.push(