Skip to content

Commit d155e78

Browse files
author
Jakob Schlanstedt
committed
feat(search): add create into inbox to search
1 parent 62bb8ac commit d155e78

37 files changed

+642
-292
lines changed

apps/client/src/components/entrypoints.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import froca from "../services/froca.js";
1111
import linkService from "../services/link.js";
1212
import { t } from "../services/i18n.js";
1313
import { CreateChildrenResponse, SqlExecuteResponse } from "@triliumnext/commons";
14+
import noteCreateService from "../services/note_create";
1415

1516
export default class Entrypoints extends Component {
1617
constructor() {
@@ -24,23 +25,7 @@ export default class Entrypoints extends Component {
2425
}
2526

2627
async createNoteIntoInboxCommand() {
27-
const inboxNote = await dateNoteService.getInboxNote();
28-
if (!inboxNote) {
29-
console.warn("Missing inbox note.");
30-
return;
31-
}
32-
33-
const { note } = await server.post<CreateChildrenResponse>(`notes/${inboxNote.noteId}/children?target=into`, {
34-
content: "",
35-
type: "text",
36-
isProtected: inboxNote.isProtected && protectedSessionHolder.isProtectedSessionAvailable()
37-
});
38-
39-
await ws.waitForMaxKnownEntityChangeId();
40-
41-
await appContext.tabManager.openTabWithNoteWithHoisting(note.noteId, { activate: true });
42-
43-
appContext.triggerEvent("focusAndSelectTitle", { isNewNote: true });
28+
noteCreateService.createNoteIntoInbox();
4429
}
4530

4631
async toggleNoteHoistingCommand({ noteId = appContext.tabManager.getActiveContextNoteId() }) {

apps/client/src/components/main_tree_executors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default class MainTreeExecutors extends Component {
4848
return;
4949
}
5050

51-
await noteCreateService.createNote(activeNoteContext.notePath, {
51+
await noteCreateService.createNoteIntoPath(activeNoteContext.notePath, {
5252
isProtected: activeNoteContext.note.isProtected,
5353
saveSelection: false
5454
});
@@ -72,7 +72,7 @@ export default class MainTreeExecutors extends Component {
7272
return;
7373
}
7474

75-
await noteCreateService.createNote(parentNotePath, {
75+
await noteCreateService.createNoteIntoPath(parentNotePath, {
7676
target: "after",
7777
targetBranchId: node.data.branchId,
7878
isProtected: isProtected,

apps/client/src/components/root_command_executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export default class RootCommandExecutor extends Component {
233233
// Create a new AI Chat note at the root level
234234
const rootNoteId = "root";
235235

236-
const result = await noteCreateService.createNote(rootNoteId, {
236+
const result = await noteCreateService.createNoteIntoPath(rootNoteId, {
237237
title: "New AI Chat",
238238
type: "aiChat",
239239
content: JSON.stringify({

apps/client/src/menus/tree_context_menu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
273273
const parentNotePath = treeService.getNotePath(this.node.getParent());
274274
const isProtected = treeService.getParentProtectedStatus(this.node);
275275

276-
noteCreateService.createNote(parentNotePath, {
276+
noteCreateService.createNoteIntoPath(parentNotePath, {
277277
target: "after",
278278
targetBranchId: this.node.data.branchId,
279279
type: type,
@@ -283,7 +283,7 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
283283
} else if (command === "insertChildNote") {
284284
const parentNotePath = treeService.getNotePath(this.node);
285285

286-
noteCreateService.createNote(parentNotePath, {
286+
noteCreateService.createNoteIntoPath(parentNotePath, {
287287
type: type,
288288
isProtected: this.node.data.isProtected,
289289
templateNoteId: templateNoteId

0 commit comments

Comments
 (0)