mirror of
https://github.com/zadam/trilium.git
synced 2025-11-30 04:24:24 +01:00
fix(insertDateTime): unable to insert date/time via quick editor or shortcut
This commit is contained in:
parent
fe10c9f8c8
commit
5f19710791
@ -98,6 +98,14 @@ export default function EditableText({ note, parentComponent, ntxId, noteContext
|
|||||||
editorApi: editorApiRef.current,
|
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
|
// Include note functionality note
|
||||||
addIncludeNoteToTextCommand() {
|
addIncludeNoteToTextCommand() {
|
||||||
if (!editorApiRef.current) return;
|
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 }) => {
|
useTriliumEvent("addTextToActiveEditor", ({ text }) => {
|
||||||
if (!noteContext?.isActive()) return;
|
if (!noteContext?.isActive()) return;
|
||||||
addTextToEditor(text);
|
addTextToEditor(text);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user