From 49788c436ce7ec76e742a90e4a871da941f73691 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Mon, 14 Jun 2021 13:39:50 -0300 Subject: [PATCH 1/4] fix: add close on blur to overflow menu dropdown --- app/assets/javascripts/components/NotesOptionsPanel.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/components/NotesOptionsPanel.tsx b/app/assets/javascripts/components/NotesOptionsPanel.tsx index cf074b9d5..b1c93c26f 100644 --- a/app/assets/javascripts/components/NotesOptionsPanel.tsx +++ b/app/assets/javascripts/components/NotesOptionsPanel.tsx @@ -72,6 +72,7 @@ export const NotesOptionsPanel = observer(({ appState }: Props) => { maxHeight, }} className="sn-dropdown sn-dropdown--animated min-w-80 max-h-120 max-w-xs flex flex-col py-2 overflow-y-auto fixed" + onBlur={closeOnBlur} > {open && ( Date: Mon, 14 Jun 2021 13:53:56 -0300 Subject: [PATCH 2/4] fix: add close on blur to search options dropdown --- app/assets/javascripts/components/SearchOptions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/components/SearchOptions.tsx b/app/assets/javascripts/components/SearchOptions.tsx index b04f8792c..9db46eeda 100644 --- a/app/assets/javascripts/components/SearchOptions.tsx +++ b/app/assets/javascripts/components/SearchOptions.tsx @@ -64,6 +64,7 @@ const SearchOptions = observer(({ appState }: Props) => { top: optionsPanelTop, }} className="sn-dropdown sn-dropdown--anchor-right sn-dropdown--animated min-w-80 absolute grid gap-2 py-2" + onBlur={closeOnBlur} > Date: Mon, 14 Jun 2021 14:07:06 -0300 Subject: [PATCH 3/4] chore(version-snjs): 2.6.3 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 71f7c0de1..8fae7c363 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.2", + "@standardnotes/snjs": "2.6.3", "mobx": "^6.1.6", "mobx-react-lite": "^3.2.0", "preact": "^10.5.12" diff --git a/yarn.lock b/yarn.lock index 42e488c2d..a14d4d07a 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.2": - version "2.6.2" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.6.2.tgz#dbd835f8c0fcdf951f636b3a5b6d0b54c00de458" - integrity sha512-/6U9sEBtT2MouwbH0OBaQW4eqnvwwNnXUXq+zDfV8UKqJPoEnwLGumnb72cJ8d/67e0haoltc2C8wHicbZgFrQ== +"@standardnotes/snjs@2.6.3": + version "2.6.3" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.6.3.tgz#7677899c050b0616d994423fd4ec9caf03394f35" + integrity sha512-5pWh+BPVPpd6JlP3avo2puGk9EWUaH0+6Y1fN9rMR8oLZ2oc8Dffiy5S4TLNm8zL4q504oMlm1/ALkwwZpKLEQ== dependencies: "@standardnotes/auth" "^2.0.0" "@standardnotes/sncrypto-common" "^1.2.9" From b036174d11b4d0a903b538abf858c5f4fc710bd5 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Mon, 14 Jun 2021 14:11:54 -0300 Subject: [PATCH 4/4] feat: when removing a tag, remove descendants as well --- .../ui_models/app_state/note_tags_state.ts | 12 +++++++++--- .../ui_models/app_state/notes_state.ts | 17 +++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/ui_models/app_state/note_tags_state.ts b/app/assets/javascripts/ui_models/app_state/note_tags_state.ts index 80b5273f8..f263fcb7d 100644 --- a/app/assets/javascripts/ui_models/app_state/note_tags_state.ts +++ b/app/assets/javascripts/ui_models/app_state/note_tags_state.ts @@ -198,9 +198,15 @@ export class NoteTagsState { async removeTagFromActiveNote(tag: SNTag): Promise { const { activeNote } = this; if (activeNote) { - await this.application.changeItem(tag.uuid, (mutator) => { - mutator.removeItemAsRelationship(activeNote); - }); + const descendantTags = this.application.getTagDescendants(tag); + const tagsToRemove = [...descendantTags, tag]; + await Promise.all( + tagsToRemove.map(async (tag) => { + await this.application.changeItem(tag.uuid, (mutator) => { + mutator.removeItemAsRelationship(activeNote); + }); + }) + ); this.application.sync(); this.reloadTags(); } diff --git a/app/assets/javascripts/ui_models/app_state/notes_state.ts b/app/assets/javascripts/ui_models/app_state/notes_state.ts index 46f2ab65e..daa9881aa 100644 --- a/app/assets/javascripts/ui_models/app_state/notes_state.ts +++ b/app/assets/javascripts/ui_models/app_state/notes_state.ts @@ -346,13 +346,18 @@ export class NotesState { async removeTagFromSelectedNotes(tag: SNTag): Promise { const selectedNotes = Object.values(this.selectedNotes); - await this.application.changeItem(tag.uuid, (mutator) => { - for (const note of selectedNotes) { - mutator.removeItemAsRelationship(note); - } - }); + const descendantTags = this.application.getTagDescendants(tag); + const tagsToRemove = [...descendantTags, tag]; + await Promise.all( + tagsToRemove.map(async (tag) => { + await this.application.changeItem(tag.uuid, (mutator) => { + for (const note of selectedNotes) { + mutator.removeItemAsRelationship(note); + } + }); + }) + ); this.application.sync(); - } isTagInSelectedNotes(tag: SNTag): boolean {