fix: don't allow empty tags and trim tags
This commit is contained in:
parent
46aea43036
commit
2f248e59d5
|
@ -720,13 +720,17 @@ namespace Glamaholic.Ui {
|
||||||
|
|
||||||
ImGui.SetNextItemWidth(-1);
|
ImGui.SetNextItemWidth(-1);
|
||||||
if (ImGui.InputTextWithHint("##tag-input", "Input a tag and press Enter", ref this._tagInput, 128, ImGuiInputTextFlags.EnterReturnsTrue)) {
|
if (ImGui.InputTextWithHint("##tag-input", "Input a tag and press Enter", ref this._tagInput, 128, ImGuiInputTextFlags.EnterReturnsTrue)) {
|
||||||
if (!plate.Tags.Contains(this._tagInput)) {
|
if (!string.IsNullOrWhiteSpace(this._tagInput)) {
|
||||||
plate.Tags.Add(this._tagInput);
|
var tag = this._tagInput.Trim();
|
||||||
plate.Tags.Sort();
|
|
||||||
this.Ui.Plugin.SaveConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
this._tagInput = string.Empty;
|
if (!plate.Tags.Contains(tag)) {
|
||||||
|
plate.Tags.Add(tag);
|
||||||
|
plate.Tags.Sort();
|
||||||
|
this.Ui.Plugin.SaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._tagInput = string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.BeginChild("tag-list")) {
|
if (ImGui.BeginChild("tag-list")) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user