Skip to content

Commit 0dd4912

Browse files
author
Jakob Schlanstedt
committed
fix(EditableTest): Fix EdtableText to use new API
1 parent 53a3519 commit 0dd4912

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

apps/client/src/widgets/type_widgets/text/EditableText.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import note_create from "../../../services/note_create";
1717
import TouchBar, { TouchBarButton, TouchBarGroup, TouchBarSegmentedControl } from "../../react/TouchBar";
1818
import { RefObject } from "preact";
1919
import { buildSelectedBackgroundColor } from "../../../components/touch_bar";
20-
import { deferred } from "@triliumnext/commons";
20+
import { CreateNoteAction, deferred } from "@triliumnext/commons";
2121

2222
/**
2323
* The editor can operate into two distinct modes:
@@ -106,17 +106,18 @@ export default function EditableText({ note, parentComponent, ntxId, noteContext
106106
},
107107
loadIncludedNote,
108108
// Creating notes in @-completion
109-
async createNoteForReferenceLink(title: string) {
110-
const notePath = noteContext?.notePath;
111-
if (!notePath) return;
112-
113-
const resp = await note_create.createNoteWithTypePrompt(notePath, {
114-
activate: false,
115-
title: title
116-
});
117-
118-
if (!resp || !resp.note) return;
119-
return resp.note.getBestNotePathString();
109+
async createNoteFromCkEditor (
110+
title: string,
111+
parentNotePath: string | undefined,
112+
action: CreateNoteAction
113+
): Promise<string> {
114+
const { note }= await note_create.createNoteFromAction(
115+
action,
116+
true,
117+
title,
118+
parentNotePath,
119+
)
120+
return note?.getBestNotePathString() ?? "";
120121
},
121122
// Keyboard shortcut
122123
async followLinkUnderCursorCommand() {

0 commit comments

Comments
 (0)