From 5f197107917c1c7e7051f87ef3ec8f7ff5a6349c Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Sat, 29 Nov 2025 22:40:49 +0800 Subject: [PATCH] fix(insertDateTime): unable to insert date/time via quick editor or shortcut --- .../widgets/type_widgets/text/EditableText.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/client/src/widgets/type_widgets/text/EditableText.tsx b/apps/client/src/widgets/type_widgets/text/EditableText.tsx index 5e3d06a76..0106ae0c0 100644 --- a/apps/client/src/widgets/type_widgets/text/EditableText.tsx +++ b/apps/client/src/widgets/type_widgets/text/EditableText.tsx @@ -98,6 +98,14 @@ export default function EditableText({ note, parentComponent, ntxId, noteContext editorApi: editorApiRef.current, }); }, + insertDateTimeToTextCommand() { + if (!editorApiRef.current) return; + const date = new Date(); + const customDateTimeFormat = options.get("customDateTimeFormat"); + const dateString = utils.formatDateTime(date, customDateTimeFormat); + + addTextToEditor(dateString); + }, // Include note functionality note addIncludeNoteToTextCommand() { if (!editorApiRef.current) return; @@ -197,14 +205,6 @@ export default function EditableText({ note, parentComponent, ntxId, noteContext }); } - useTriliumEvent("insertDateTimeToText", ({ ntxId: eventNtxId }) => { - if (eventNtxId !== ntxId) return; - const date = new Date(); - const customDateTimeFormat = options.get("customDateTimeFormat"); - const dateString = utils.formatDateTime(date, customDateTimeFormat); - - addTextToEditor(dateString); - }); useTriliumEvent("addTextToActiveEditor", ({ text }) => { if (!noteContext?.isActive()) return; addTextToEditor(text);