Skip to content
Open
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
f1e8c25
feat(search): add create into inbox to search
Oct 12, 2025
76e9771
refactor(note-create): change order of noteCreate intoPath and intoIn…
Oct 12, 2025
f28e6a3
refactor(ECMAScript Modules jsimport convention): refactor newly crea…
Oct 12, 2025
2bdffc3
rename MentionAction to CreateNoteAction and move to packages/common
contributor Oct 12, 2025
d2e7526
fix typings for creating a note using mentions in ckeditor
contributor Oct 18, 2025
90fd8fb
fix(jump_to_note): fix enum typescript error in switch statement
Oct 18, 2025
09d2978
refactor(create-note): centralize and add advanced type checking to c…
Oct 21, 2025
cbcf70a
fix(note-type-chooser): fix note type chooser, unnecessary stick to o…
Oct 21, 2025
8af3ffe
refactor(typeerror): resolve typeerrors by refactoring code
Oct 21, 2025
1f35568
refactor: cleanup comments
Oct 21, 2025
1a36e54
refactor(note_create): clarify type system
Oct 21, 2025
99dd660
refactor(note_create): improve comments for type system
Oct 22, 2025
8f2365d
refactor(note_create): reorder function order to simplify diff
Oct 22, 2025
3029354
refactor(note_create): cleanup by removing unused import
Oct 22, 2025
cfc3b2b
fix(note_create): fix type hierarchy inheriting from wrong type and i…
Oct 22, 2025
83cc099
docs(note_create): improve documentation for type checking system
Oct 22, 2025
9ed3858
docs(note_create): improve clarification of type system
Oct 22, 2025
215a5d6
fix(Omit in types): remove Omit from types to make hierarchy logical …
Oct 22, 2025
cfd6cf4
refactor(create_note): rename types to fit ontological concepts better
Oct 22, 2025
fc22389
docs: remove comments duplicating code
Oct 22, 2025
08b3031
docs(note_create): further clarify type system
Oct 22, 2025
fd5db08
refactor(note_create): simplify type implementation and documentation
Oct 28, 2025
54808d5
refactor(note-create): replace enum with optional fields
Oct 28, 2025
ba5ce25
refactor(note-create): simplify createNote switch to equivalent small…
Oct 28, 2025
3fde55b
refactor(note-create): replace 'at' with 'with'
Oct 28, 2025
3efc5f3
refactor(note-create): remove unnecessary deep hierarchy
Oct 28, 2025
f0dfaeb
fix(note-create): fix type definition for CreateNoteWithUrlOpts
Oct 28, 2025
050f0e8
refactor(note-create): remove small redundancy
Oct 28, 2025
0d4d7dd
createNote: better typing without cast and never type
contributor Oct 28, 2025
efc3068
fix(typecheck-proven incorrectness): typecheck caught incorrectness t…
Oct 29, 2025
2254568
fix(root-command-executor): fix regression in root_command_executor
Oct 30, 2025
e615221
refactor(note_autocomplete): simplify big switch statement removing d…
Oct 30, 2025
7777fa6
fix(note_create): type casting
Oct 30, 2025
9ac8e15
fix(note_autocomplete): fix wrong type of target
Oct 30, 2025
f1db934
fix(type-checker): remove as casts hiding type-errors thus bugs. Solv…
Oct 30, 2025
77e48a9
fix(note-autocomplete): logic error hidden by as typecast
Oct 30, 2025
6ea6628
refactor(note-create): remove as typecast
Oct 30, 2025
1ba903d
fix(note_autocomplete): fix attributes not linking
Oct 30, 2025
0ab21e3
fix(note_autocomplete): fix wrong definition of types, and resulting …
Oct 30, 2025
77790bf
test(server-e2e): fix test for new create note option
Nov 3, 2025
cf947d6
style(unused-imports): Remove unused-imports
Nov 5, 2025
970fe26
style(row_editing comments): make inline comment proper doc
Nov 5, 2025
ba3596b
style(jump_to_note): remove dead case to improve readability
Nov 5, 2025
643e271
refactor(create-note-naming): simplify naming
Nov 5, 2025
8bf4dbb
refactor(autocomplete-pipline): refactor autocomplete -> create -> se…
Nov 21, 2025
a885556
feat(search): add create into inbox to search
Nov 21, 2025
da063cc
fix(AttributeEditor): wrong order of Arguments
Nov 21, 2025
53b9e67
refactor(note_create): Inbox -> Default naming in functions, paramete…
Nov 21, 2025
0aa12e8
refactor(url -> link): let link refer to url and path.
Nov 21, 2025
42f102b
refactor(note_create) use correct terminology link not url
Nov 21, 2025
1233b24
fix(createNoteFromAction): don't overwrite promptForType but use the …
Nov 21, 2025
d7cae4d
fix(translation): restore missing translations
Nov 21, 2025
53a3519
fix(translation): missing ','
Nov 21, 2025
0dd4912
fix(EditableTest): Fix EdtableText to use new API
Nov 21, 2025
3b83a22
fix(EditableTest): cutIntoNoteCommand createNote to new API
Nov 21, 2025
c43f7d1
fix(NoteAutocomplete): use new API
Nov 21, 2025
c0e18fc
fix(include_note): fix wrongly merged code
Nov 21, 2025
842f94d
fix(note_create): warn message
Nov 21, 2025
a0932ed
fix(note_create): use correct API for intoDefaultLocation
Nov 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions apps/client/src/components/app_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import TouchBarComponent from "./touch_bar.js";
import type { CKTextEditor } from "@triliumnext/ckeditor5";
import type CodeMirror from "@triliumnext/codemirror";
import { StartupChecks } from "./startup_checks.js";
import type { CreateNoteOpts } from "../services/note_create.js";
import type { CreateNoteOpts, CreateNoteWithLinkOpts } from "../services/note_create.js";
import { ColumnComponent } from "tabulator-tables";
import { ChooseNoteTypeCallback } from "../widgets/dialogs/note_type_chooser.jsx";
import type RootContainer from "../widgets/containers/root_container.js";
Expand Down Expand Up @@ -359,8 +359,7 @@ export type CommandMappings = {

// Table view
addNewRow: CommandData & {
customOpts: CreateNoteOpts;
parentNotePath?: string;
customOpts?: CreateNoteWithLinkOpts;
};
addNewTableColumn: CommandData & {
columnToEdit?: ColumnComponent;
Expand Down
21 changes: 4 additions & 17 deletions apps/client/src/components/entrypoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import froca from "../services/froca.js";
import linkService from "../services/link.js";
import { t } from "../services/i18n.js";
import { CreateChildrenResponse, SqlExecuteResponse } from "@triliumnext/commons";
import noteCreateService from "../services/note_create.js";

export default class Entrypoints extends Component {
constructor() {
Expand All @@ -24,23 +25,9 @@ export default class Entrypoints extends Component {
}

async createNoteIntoInboxCommand() {
const inboxNote = await dateNoteService.getInboxNote();
if (!inboxNote) {
console.warn("Missing inbox note.");
return;
}

const { note } = await server.post<CreateChildrenResponse>(`notes/${inboxNote.noteId}/children?target=into`, {
content: "",
type: "text",
isProtected: inboxNote.isProtected && protectedSessionHolder.isProtectedSessionAvailable()
});

await ws.waitForMaxKnownEntityChangeId();

await appContext.tabManager.openTabWithNoteWithHoisting(note.noteId, { activate: true });

appContext.triggerEvent("focusAndSelectTitle", { isNewNote: true });
await noteCreateService.createNote(
{ target: "default" }
);
}

async toggleNoteHoistingCommand({ noteId = appContext.tabManager.getActiveContextNoteId() }) {
Expand Down
28 changes: 18 additions & 10 deletions apps/client/src/components/main_tree_executors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ export default class MainTreeExecutors extends Component {
return;
}

await noteCreateService.createNote(activeNoteContext.notePath, {
isProtected: activeNoteContext.note.isProtected,
saveSelection: false
});
await noteCreateService.createNote(
{
target: "into",
parentNoteLink: activeNoteContext.notePath,
isProtected: activeNoteContext.note.isProtected,
saveSelection: false,
promptForType: false,
}
);
}

async createNoteAfterCommand() {
Expand All @@ -72,11 +77,14 @@ export default class MainTreeExecutors extends Component {
return;
}

await noteCreateService.createNote(parentNotePath, {
target: "after",
targetBranchId: node.data.branchId,
isProtected: isProtected,
saveSelection: false
});
await noteCreateService.createNote(
{
target: "after",
parentNoteLink: parentNotePath,
targetBranchId: node.data.branchId,
isProtected: isProtected,
saveSelection: false
}
);
}
}
22 changes: 13 additions & 9 deletions apps/client/src/components/root_command_executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class RootCommandExecutor extends Component {
}

async searchInSubtreeCommand({ notePath }: CommandListenerData<"searchInSubtree">) {
const noteId = treeService.getNoteIdFromUrl(notePath);
const noteId = treeService.getNoteIdFromLink(notePath);

this.searchNotesCommand({ ancestorNoteId: noteId });
}
Expand Down Expand Up @@ -240,14 +240,18 @@ export default class RootCommandExecutor extends Component {
// Create a new AI Chat note at the root level
const rootNoteId = "root";

const result = await noteCreateService.createNote(rootNoteId, {
title: "New AI Chat",
type: "aiChat",
content: JSON.stringify({
messages: [],
title: "New AI Chat"
})
});
const result = await noteCreateService.createNote(
{
parentNoteLink: rootNoteId,
target: "into",
title: "New AI Chat",
type: "aiChat",
content: JSON.stringify({
messages: [],
title: "New AI Chat"
}),
}
);

if (!result.note) {
toastService.showError("Failed to create AI Chat note");
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/components/tab_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export default class TabManager extends Component {

// preload all notes at once
await froca.getNotes([...noteContextsToOpen.flatMap((tab: NoteContextState) =>
[treeService.getNoteIdFromUrl(tab.notePath), tab.hoistedNoteId])], true);
[treeService.getNoteIdFromLink(tab.notePath), tab.hoistedNoteId])], true);

const filteredNoteContexts = noteContextsToOpen.filter((openTab: NoteContextState) => {
const noteId = treeService.getNoteIdFromUrl(openTab.notePath);
const noteId = treeService.getNoteIdFromLink(openTab.notePath);
if (!noteId || !(noteId in froca.notes)) {
// note doesn't exist so don't try to open tab for it
return false;
Expand Down
34 changes: 22 additions & 12 deletions apps/client/src/menus/tree_context_menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,21 +287,31 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
const parentNotePath = treeService.getNotePath(this.node.getParent());
const isProtected = treeService.getParentProtectedStatus(this.node);

noteCreateService.createNote(parentNotePath, {
target: "after",
targetBranchId: this.node.data.branchId,
type: type,
isProtected: isProtected,
templateNoteId: templateNoteId
});

noteCreateService.createNote(
{
target: "after",
parentNoteLink: parentNotePath,
targetBranchId: this.node.data.branchId,
type: type,
isProtected: isProtected,
templateNoteId: templateNoteId,
promptForType: false,
}
);
} else if (command === "insertChildNote") {
const parentNotePath = treeService.getNotePath(this.node);

noteCreateService.createNote(parentNotePath, {
type: type,
isProtected: this.node.data.isProtected,
templateNoteId: templateNoteId
});
noteCreateService.createNote(
{
target: "into",
parentNoteLink: parentNotePath,
type: type,
isProtected: this.node.data.isProtected,
templateNoteId: templateNoteId,
promptForType: false,
}
);
} else if (command === "openNoteInSplit") {
const subContexts = appContext.tabManager.getActiveContext()?.getSubContexts();
const { ntxId } = subContexts?.[subContexts.length - 1] ?? {};
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/services/content_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async function renderText(note: FNote | FAttachment, $renderedContent: JQuery<HT
renderMathInElement($renderedContent[0], { trust: true });
}

const getNoteIdFromLink = (el: HTMLElement) => treeService.getNoteIdFromUrl($(el).attr("href") || "");
const getNoteIdFromLink = (el: HTMLElement) => treeService.getNoteIdFromLink($(el).attr("href") || "");
const referenceLinks = $renderedContent.find("a.reference-link");
const noteIdsToPrefetch = referenceLinks.map((i, el) => getNoteIdFromLink(el));
await froca.getNotes(noteIdsToPrefetch);
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/services/hoisted_note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function checkNoteAccess(notePath: string, noteContext: NoteContext) {
const hoistedNoteId = noteContext.hoistedNoteId;

if (!resolvedNotePath.includes(hoistedNoteId) && (!resolvedNotePath.includes("_hidden") || resolvedNotePath.includes("_lbBookmarks"))) {
const noteId = treeService.getNoteIdFromUrl(resolvedNotePath);
const noteId = treeService.getNoteIdFromLink(resolvedNotePath);
if (!noteId) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/services/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export function parseNavigationStateFromUrl(url: string | undefined) {

return {
notePath,
noteId: treeService.getNoteIdFromUrl(notePath),
noteId: treeService.getNoteIdFromLink(notePath),
ntxId,
hoistedNoteId,
viewScope,
Expand Down
Loading