Fix: move to new format
This commit is contained in:
parent
eaf33afbe3
commit
ccb5f488e5
|
@ -6,6 +6,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function createSourceEditor(style) {
|
function createSourceEditor(style) {
|
||||||
|
const MODE = {
|
||||||
|
stylus: 'stylus',
|
||||||
|
uso: 'css'
|
||||||
|
};
|
||||||
|
|
||||||
// style might be an object reference to background page
|
// style might be an object reference to background page
|
||||||
style = deepCopy(style);
|
style = deepCopy(style);
|
||||||
|
|
||||||
|
@ -347,7 +352,7 @@ function createSourceEditor(style) {
|
||||||
$('#name').value = style.name;
|
$('#name').value = style.name;
|
||||||
$('#enabled').checked = style.enabled;
|
$('#enabled').checked = style.enabled;
|
||||||
$('#url').href = style.url;
|
$('#url').href = style.url;
|
||||||
cm.setOption('mode', style.preprocessor || 'css');
|
cm.setOption('mode', MODE[style.preprocessor] || 'css');
|
||||||
CodeMirror.autoLoadMode(cm, style.preprocessor || 'css');
|
CodeMirror.autoLoadMode(cm, style.preprocessor || 'css');
|
||||||
// beautify only works with regular CSS
|
// beautify only works with regular CSS
|
||||||
$('#beautify').disabled = Boolean(style.preprocessor);
|
$('#beautify').disabled = Boolean(style.preprocessor);
|
||||||
|
|
|
@ -63,11 +63,12 @@ function configDialog(style) {
|
||||||
$element({tag: 'span'})
|
$element({tag: 'span'})
|
||||||
]})
|
]})
|
||||||
];
|
];
|
||||||
} else if (va.type === 'select') {
|
} else if (va.type === 'select' || va.type === 'dropdown' || va.type === 'image') {
|
||||||
|
// TODO: a image picker input?
|
||||||
va.input = $element({
|
va.input = $element({
|
||||||
tag: 'select',
|
tag: 'select',
|
||||||
appendChild: Object.keys(va.select).map(key => $element({
|
appendChild: va.options.map(o => $element({
|
||||||
tag: 'option', value: key, appendChild: va.select[key]
|
tag: 'option', value: o.value, textContent: o.label
|
||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
va.input.onchange = () => {
|
va.input.onchange = () => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user