Fix: vars could be undefined
This commit is contained in:
parent
a7cfeb22e4
commit
29b8f51292
|
@ -371,8 +371,11 @@ CodeMirror.hint && (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// USO vars in usercss mode editor
|
// USO vars in usercss mode editor
|
||||||
const list = Object.keys(editor.getStyle().usercssData.vars)
|
const vars = editor.getStyle().usercssData.vars;
|
||||||
.filter(name => name.startsWith(leftPart));
|
const list = vars ?
|
||||||
|
Object.keys(editor.getStyle().usercssData.vars)
|
||||||
|
.filter(name => name.startsWith(leftPart)) :
|
||||||
|
[];
|
||||||
return {
|
return {
|
||||||
list,
|
list,
|
||||||
from: {line, ch: prev},
|
from: {line, ch: prev},
|
||||||
|
|
|
@ -195,7 +195,7 @@ function createStyleElement({style, name}) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const parts = createStyleElement.parts;
|
const parts = createStyleElement.parts;
|
||||||
const configurable = style.usercssData && Object.keys(style.usercssData.vars).length > 0;
|
const configurable = style.usercssData && style.usercssData.vars && Object.keys(style.usercssData.vars).length > 0;
|
||||||
parts.checker.checked = style.enabled;
|
parts.checker.checked = style.enabled;
|
||||||
parts.nameLink.textContent = tWordBreak(style.name);
|
parts.nameLink.textContent = tWordBreak(style.name);
|
||||||
parts.nameLink.href = parts.editLink.href = parts.editHrefBase + style.id;
|
parts.nameLink.href = parts.editLink.href = parts.editHrefBase + style.id;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user