Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d32bfcc
feat(search): add create into inbox to search
Oct 12, 2025
9ec6648
refactor(note-create): change order of noteCreate intoPath and intoIn…
Oct 12, 2025
62a2d6a
refactor(ECMAScript Modules jsimport convention): refactor newly crea…
Oct 12, 2025
a820b45
rename MentionAction to CreateNoteAction and move to packages/common
contributor Oct 12, 2025
0b98270
fix typings for creating a note using mentions in ckeditor
contributor Oct 18, 2025
9b6f094
fix(pnpm-lock): fix pnpm lock for triliumnext/commons
Oct 18, 2025
911adbb
fix(jump_to_note): fix enum typescript error in switch statement
Oct 18, 2025
6a90251
refactor(create-note): centralize and add advanced type checking to c…
Oct 21, 2025
5c523d1
fix(note-type-chooser): fix note type chooser, unnecessary stick to o…
Oct 21, 2025
3384c3f
refactor(typeerror): resolve typeerrors by refactoring code
Oct 21, 2025
24fe34a
refactor: cleanup comments
Oct 21, 2025
f38ff23
refactor(note_create): clarify type system
Oct 21, 2025
ebb2def
refactor(note_create): improve comments for type system
Oct 22, 2025
73ccaff
refactor(note_create): reorder function order to simplify diff
Oct 22, 2025
154720b
refactor(note_create): cleanup by removing unused import
Oct 22, 2025
6ddc158
fix(note_create): fix type hierarchy inheriting from wrong type and i…
Oct 22, 2025
b82d756
docs(note_create): improve documentation for type checking system
Oct 22, 2025
ee532ee
docs(note_create): improve clarification of type system
Oct 22, 2025
591bb72
fix(Omit in types): remove Omit from types to make hierarchy logical …
Oct 22, 2025
74a1657
refactor(create_note): rename types to fit ontological concepts better
Oct 22, 2025
e4af137
docs: remove comments duplicating code
Oct 22, 2025
cc95c11
docs(note_create): further clarify type system
Oct 22, 2025
b34c521
refactor(note_create): simplify type implementation and documentation
Oct 28, 2025
d725be9
refactor(note-create): replace enum with optional fields
Oct 28, 2025
c0a8660
refactor(note-create): simplify createNote switch to equivalent small…
Oct 28, 2025
f15b778
refactor(note-create): replace 'at' with 'with'
Oct 28, 2025
4134f00
refactor(note-create): remove unnecessary deep hierarchy
Oct 28, 2025
3080445
fix(note-create): fix type definition for CreateNoteWithUrlOpts
Oct 28, 2025
11a0893
refactor(note-create): remove small redundancy
Oct 28, 2025
e6f03eb
createNote: better typing without cast and never type
contributor Oct 28, 2025
b413d5f
fix(typecheck-proven incorrectness): typecheck caught incorrectness t…
Oct 29, 2025
505dcdd
fix(root-command-executor): fix regression in root_command_executor
Oct 30, 2025
feb337d
refactor(note_autocomplete): simplify big switch statement removing d…
Oct 30, 2025
a75f472
fix(note_create): type casting
Oct 30, 2025
3d3d112
fix(note_autocomplete): fix wrong type of target
Oct 30, 2025
437763e
fix(type-checker): remove as casts hiding type-errors thus bugs. Solv…
Oct 30, 2025
85ad2c5
fix(note-autocomplete): logic error hidden by as typecast
Oct 30, 2025
89c1415
refactor(note-create): remove as typecast
Oct 30, 2025
57fc867
fix(note_autocomplete): fix attributes not linking
Oct 30, 2025
b836760
fix(note_autocomplete): fix wrong definition of types, and resulting …
Oct 30, 2025
a787afc
test(server-e2e): fix test for new create note option
Nov 3, 2025
0030e5c
style(unused-imports): Remove unused-imports
Nov 5, 2025
2cb2f4e
style(row_editing comments): make inline comment proper doc
Nov 5, 2025
7b7975b
style(jump_to_note): remove dead case to improve readability
Nov 5, 2025
0ab9b5d
refactor(create-note-naming): simplify naming
Nov 5, 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 @@ -28,7 +28,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, CreateNoteWithUrlOpts } 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 @@ -357,8 +357,7 @@ export type CommandMappings = {

// Table view
addNewRow: CommandData & {
customOpts: CreateNoteOpts;
parentNotePath?: string;
customOpts?: CreateNoteWithUrlOpts;
};
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: "inbox" }
);
}

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",
parentNoteUrl: 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",
parentNoteUrl: parentNotePath,
targetBranchId: node.data.branchId,
isProtected: isProtected,
saveSelection: false
}
);
}
}
20 changes: 12 additions & 8 deletions apps/client/src/components/root_command_executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,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(
{
parentNoteUrl: 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
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 @@ -273,21 +273,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",
parentNoteUrl: 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",
parentNoteUrl: 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
Loading