diff --git a/app/assets/javascripts/components/AutocompleteTagInput.tsx b/app/assets/javascripts/components/AutocompleteTagInput.tsx index 8ccfb3d56..6be62ad80 100644 --- a/app/assets/javascripts/components/AutocompleteTagInput.tsx +++ b/app/assets/javascripts/components/AutocompleteTagInput.tsx @@ -115,6 +115,7 @@ export const AutocompleteTagInput = observer(({ appState }: Props) => { ref={dropdownRef} className={`${tags.length > 0 ? 'w-80' : 'w-70 mr-10'} sn-dropdown flex flex-col py-2 absolute`} style={{ maxHeight: dropdownMaxHeight, maxWidth: tagsContainerMaxWidth }} + onBlur={closeOnBlur} >
{autocompleteTagResults.map((tagResult) => ( diff --git a/app/assets/javascripts/views/tags/tags_view.ts b/app/assets/javascripts/views/tags/tags_view.ts index d7ce1bbc8..5a10a69e1 100644 --- a/app/assets/javascripts/views/tags/tags_view.ts +++ b/app/assets/javascripts/views/tags/tags_view.ts @@ -267,6 +267,7 @@ class TagsViewCtrl extends PureViewCtrl { async clickedAddNewTag() { if (this.getState().editingTag) { + console.log('editing'); return; } const newTag = await this.application.createTemplateItem( @@ -289,10 +290,10 @@ class TagsViewCtrl extends PureViewCtrl { 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 { 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); @@ -345,6 +349,7 @@ class TagsViewCtrl extends PureViewCtrl { this.application.alertService!.alert( "A tag with this name already exists." ); + this.undoCreateTag(newTag); return; } const insertedTag = await this.application.insertItem(newTag); diff --git a/package.json b/package.json index bcc502563..fb2b32c70 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@reach/checkbox": "^0.13.2", "@reach/dialog": "^0.13.0", "@standardnotes/sncrypto-web": "1.2.10", - "@standardnotes/snjs": "2.6.0", + "@standardnotes/snjs": "2.6.1", "mobx": "^6.1.6", "mobx-react-lite": "^3.2.0", "preact": "^10.5.12" diff --git a/yarn.lock b/yarn.lock index de7bfddca..35a42eddb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1936,10 +1936,10 @@ "@standardnotes/sncrypto-common" "^1.2.7" libsodium-wrappers "^0.7.8" -"@standardnotes/snjs@2.6.0": - version "2.6.0" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.6.0.tgz#8ebdfcb0918c308198b38a63d7aa946387b83ac4" - integrity sha512-Gb/kAdMtjVlSiQH7pkDzFxKtIrrY43i2hSejO2c+zCviZspiDZPpXLpEhMJ295ow2tluhOf8zfBUda3LMC6oDw== +"@standardnotes/snjs@2.6.1": + version "2.6.1" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.6.1.tgz#45c3906086a649d03e5c139ef0b30fa90a639e65" + integrity sha512-ZuygivyJvqLMGeOurmg5K3lR0tk6zDgf53qIecFD8redaUpFicegeOlV+RW4m0QthU+ne74DHSCqk2U85oUxrA== dependencies: "@standardnotes/auth" "^2.0.0" "@standardnotes/sncrypto-common" "^1.2.9"