diff --git a/apps/client/src/services/note_create.ts b/apps/client/src/services/note_create.ts index 52a4e71d4..a98857266 100644 --- a/apps/client/src/services/note_create.ts +++ b/apps/client/src/services/note_create.ts @@ -29,14 +29,15 @@ import dateNoteService from "../services/date_notes.js"; * * * Hierarchy of general to specific categories(hypernyms -> hyponyms): * - * BaseCreateNoteSharedOpts + * * BaseCreateNoteSharedOpts * | * \-- BaseCreateNoteOpts * | * +-- CreateNoteAtUrlOpts * | +-- CreateNoteIntoURLOpts - * | +-- CreateNoteBeforeURLOpts - * | \-- CreateNoteAfterURLOpts + * | \-- CreateNoteSiblingURLOpts + * | +-- CreateNoteBeforeURLOpts + * | \-- CreateNoteAfterURLOpts * | * \-- CreateNoteIntoInboxURLOpts */ @@ -56,7 +57,6 @@ type BaseCreateNoteSharedOpts = { templateNoteId?: string; activate?: boolean; focus?: "title" | "content"; - targetBranchId?: string; textEditor?: CKTextEditor; } @@ -79,17 +79,16 @@ type CreateNoteAtUrlOpts = BaseCreateNoteOpts & { // `Url` means either parentNotePath or parentNoteId. // The vocabulary is inspired by its loose semantics of getNoteIdFromUrl. parentNoteUrl: string; + /* + * targetBranchId disambiguates the position for cloned notes. This is a + * concern whenever we are given a note URL. + */ + targetBranchId: string; } export type CreateNoteIntoURLOpts = CreateNoteAtUrlOpts; -/* - * targetBranchId disambiguates the position for cloned notes. This is only a - * concern for siblings. The reason for that is specified in the backend. - */ -type CreateNoteSiblingURLOpts = Omit & { - targetBranchId: string; -}; +type CreateNoteSiblingURLOpts = CreateNoteAtUrlOpts; export type CreateNoteBeforeURLOpts = CreateNoteSiblingURLOpts; export type CreateNoteAfterURLOpts = CreateNoteSiblingURLOpts; diff --git a/apps/client/src/widgets/collections/table/context_menu.ts b/apps/client/src/widgets/collections/table/context_menu.ts index 2898eb098..2de55e8f7 100644 --- a/apps/client/src/widgets/collections/table/context_menu.ts +++ b/apps/client/src/widgets/collections/table/context_menu.ts @@ -9,7 +9,7 @@ import branches from "../../../services/branches.js"; import Component from "../../../components/component.js"; import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker.jsx"; import { RefObject } from "preact"; -import { CreateNoteTarget } from "../../../services/note_create.js"; +import { CreateNoteAfterURLOpts, CreateNoteBeforeURLOpts, CreateNoteTarget } from "../../../services/note_create.js"; export function useContextMenu(parentNote: FNote, parentComponent: Component | null | undefined, tabulator: RefObject): Partial { const events: Partial = {}; @@ -186,7 +186,7 @@ export function showRowContextMenu(parentComponent: Component, e: MouseEvent, ro customOpts: { target: CreateNoteTarget.BeforeNoteURL, targetBranchId: rowData.branchId, - } + } as CreateNoteBeforeURLOpts }) }, { @@ -200,7 +200,7 @@ export function showRowContextMenu(parentComponent: Component, e: MouseEvent, ro customOpts: { target: CreateNoteTarget.AfterNoteURL, targetBranchId: branchId, - } + } as CreateNoteAfterURLOpts }); } }, @@ -213,7 +213,7 @@ export function showRowContextMenu(parentComponent: Component, e: MouseEvent, ro customOpts: { target: CreateNoteTarget.AfterNoteURL, targetBranchId: rowData.branchId, - } + } as CreateNoteAfterURLOpts }) }, { kind: "separator" },