impr(custom text): disallow saving empty custom texts

closes #4904
This commit is contained in:
Miodec 2024-01-10 17:37:48 +01:00
parent eba4b92305
commit 2e77cb38ff

View file

@ -75,6 +75,11 @@ function save(): boolean {
return false;
}
if (text.length === 0) {
Notifications.add("Custom text can't be empty", 0);
return false;
}
text = text.replace(/( *(\r\n|\r|\n) *)/g, "\n ");
CustomText.setCustomText(name, text, checkbox);