mirror of
https://github.com/zadam/trilium.git
synced 2025-12-04 22:44:25 +01:00
fix(Omit in types): remove Omit from types to make hierarchy logical consistent and resulting errors from corrected logic.
This commit is contained in:
parent
c6ed0b43fc
commit
00aa470bf2
@ -29,12 +29,13 @@ import dateNoteService from "../services/date_notes.js";
|
||||
*
|
||||
* * Hierarchy of general to specific categories(hypernyms -> hyponyms):
|
||||
*
|
||||
* BaseCreateNoteSharedOpts
|
||||
* * BaseCreateNoteSharedOpts
|
||||
* |
|
||||
* \-- BaseCreateNoteOpts
|
||||
* |
|
||||
* +-- CreateNoteAtUrlOpts
|
||||
* | +-- CreateNoteIntoURLOpts
|
||||
* | \-- CreateNoteSiblingURLOpts
|
||||
* | +-- CreateNoteBeforeURLOpts
|
||||
* | \-- CreateNoteAfterURLOpts
|
||||
* |
|
||||
@ -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<CreateNoteAtUrlOpts, "targetBranchId"> & {
|
||||
targetBranchId: string;
|
||||
};
|
||||
type CreateNoteSiblingURLOpts = CreateNoteAtUrlOpts;
|
||||
export type CreateNoteBeforeURLOpts = CreateNoteSiblingURLOpts;
|
||||
export type CreateNoteAfterURLOpts = CreateNoteSiblingURLOpts;
|
||||
|
||||
|
||||
@ -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<Tabulator>): Partial<EventCallBackMethods> {
|
||||
const events: Partial<EventCallBackMethods> = {};
|
||||
@ -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" },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user