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