fix: cannot create undefined style

This commit is contained in:
Azgaar 2021-11-27 19:38:27 +03:00
parent 7bcac7a7d1
commit 6d5c109d78

View file

@ -1126,8 +1126,9 @@ function addStylePreset() {
position: {my: "center", at: "center", of: "svg"} position: {my: "center", at: "center", of: "svg"}
}); });
const currentStyle = document.getElementById("stylePreset").selectedOptions[0].text; const currentPreset = document.getElementById("stylePreset").selectedOptions[0];
document.getElementById("styleSaverName").value = currentStyle; const styleName = currentPreset ? currentPreset.text : "custom";
document.getElementById("styleSaverName").value = styleName;
styleSaverJSON.value = JSON.stringify(getStyle(), null, 2); styleSaverJSON.value = JSON.stringify(getStyle(), null, 2);
checkName(); checkName();