diff --git a/app/assets/javascripts/components/NotesOptionsPanel.tsx b/app/assets/javascripts/components/NotesOptionsPanel.tsx
index 050ce0db7..2f1f7485b 100644
--- a/app/assets/javascripts/components/NotesOptionsPanel.tsx
+++ b/app/assets/javascripts/components/NotesOptionsPanel.tsx
@@ -59,28 +59,28 @@ export const NotesOptionsPanel = observer(({ appState }: Props) => {
Actions
- {
- if (event.key === 'Escape' && !submenuOpen) {
- setOpen(false);
- buttonRef.current.focus();
- }
- }}
- ref={panelRef}
- style={{
- ...position,
- maxHeight
- }}
- className="sn-dropdown sn-dropdown--animated max-h-120 max-w-xs flex flex-col py-2 overflow-y-scroll fixed"
- >
- {open && (
-
- )}
-
+ {
+ if (event.key === 'Escape' && !submenuOpen) {
+ setOpen(false);
+ buttonRef.current.focus();
+ }
+ }}
+ ref={panelRef}
+ style={{
+ ...position,
+ maxHeight,
+ }}
+ className="sn-dropdown sn-dropdown--animated max-h-120 max-w-xs flex flex-col py-2 overflow-y-scroll fixed"
+ >
+ {open && (
+
+ )}
+
);
});
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 1c3317f5f..80b5273f8 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
@@ -181,9 +181,15 @@ export class NoteTagsState {
async addTagToActiveNote(tag: SNTag): Promise {
const { activeNote } = this;
if (activeNote) {
- await this.application.changeItem(tag.uuid, (mutator) => {
- mutator.addItemAsRelationship(activeNote);
- });
+ const parentChainTags = this.application.getTagParentChain(tag);
+ const tagsToAdd = [...parentChainTags, tag];
+ await Promise.all(
+ tagsToAdd.map(async (tag) => {
+ await this.application.changeItem(tag.uuid, (mutator) => {
+ mutator.addItemAsRelationship(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 c298c27c2..46f2ab65e 100644
--- a/app/assets/javascripts/ui_models/app_state/notes_state.ts
+++ b/app/assets/javascripts/ui_models/app_state/notes_state.ts
@@ -330,11 +330,17 @@ export class NotesState {
async addTagToSelectedNotes(tag: SNTag): Promise {
const selectedNotes = Object.values(this.selectedNotes);
- await this.application.changeItem(tag.uuid, (mutator) => {
- for (const note of selectedNotes) {
- mutator.addItemAsRelationship(note);
- }
- });
+ const parentChainTags = this.application.getTagParentChain(tag);
+ const tagsToAdd = [...parentChainTags, tag];
+ await Promise.all(
+ tagsToAdd.map(async (tag) => {
+ await this.application.changeItem(tag.uuid, (mutator) => {
+ for (const note of selectedNotes) {
+ mutator.addItemAsRelationship(note);
+ }
+ });
+ })
+ );
this.application.sync();
}