fix: tag rename to empty string should preserve its original title
This commit is contained in:
@@ -267,6 +267,7 @@ class TagsViewCtrl extends PureViewCtrl<unknown, TagState> {
|
||||
|
||||
async clickedAddNewTag() {
|
||||
if (this.getState().editingTag) {
|
||||
console.log('editing');
|
||||
return;
|
||||
}
|
||||
const newTag = await this.application.createTemplateItem(
|
||||
@@ -289,10 +290,10 @@ class TagsViewCtrl extends PureViewCtrl<unknown, TagState> {
|
||||
|
||||
async saveTag($event: Event, tag: SNTag) {
|
||||
($event.target! as HTMLInputElement).blur();
|
||||
if (!this.titles[tag.uuid]?.length) {
|
||||
return this.undoCreateTag(tag);
|
||||
}
|
||||
if (this.getState().templateTag) {
|
||||
if (!this.titles[tag.uuid]?.length) {
|
||||
return this.undoCreateTag(tag);
|
||||
}
|
||||
return this.saveNewTag();
|
||||
} else {
|
||||
return this.saveTagRename(tag);
|
||||
@@ -314,6 +315,9 @@ class TagsViewCtrl extends PureViewCtrl<unknown, TagState> {
|
||||
if (newTitle.length === 0) {
|
||||
this.titles[tag.uuid] = this.editingOriginalName;
|
||||
this.editingOriginalName = undefined;
|
||||
await this.setState({
|
||||
editingTag: undefined
|
||||
});
|
||||
return;
|
||||
}
|
||||
const existingTag = this.application.findTagByTitle(newTitle);
|
||||
|
||||
Reference in New Issue
Block a user