diff --git a/apps/client/public/locales/en-US/translation.json b/apps/client/public/locales/en-US/translation.json index a182138ac..aa20b9144 100644 --- a/apps/client/public/locales/en-US/translation.json +++ b/apps/client/public/locales/en-US/translation.json @@ -398,6 +398,8 @@ "Insert mermaid diagram": "Insert mermaid diagram", "Insert and design Drawio diagrams": "Insert and design Drawio diagrams", "Insert current date": "Insert current date", + "Time": "Time", + "Insert current time": "Insert current time", "Draw and sketch excalidraw diagrams": "Draw and sketch excalidraw diagrams", "Multiple": "Multiple", "Turn into": "Turn into", diff --git a/apps/client/src/features/editor/components/slash-menu/menu-items.ts b/apps/client/src/features/editor/components/slash-menu/menu-items.ts index 1f05dc62f..a85f4a710 100644 --- a/apps/client/src/features/editor/components/slash-menu/menu-items.ts +++ b/apps/client/src/features/editor/components/slash-menu/menu-items.ts @@ -21,6 +21,7 @@ import { IconMenu4, IconPageBreak, IconCalendar, + IconClock, IconAppWindow, IconSitemap, IconColumns3, @@ -474,6 +475,25 @@ const CommandGroups: SlashMenuGroupedItemsType = { .run(); }, }, + { + title: "Time", + description: "Insert current time", + searchTerms: ["time", "now", "clock"], + icon: IconClock, + command: ({ editor, range }: CommandProps) => { + const currentTime = new Date().toLocaleTimeString(i18n.language, { + hour: "numeric", + minute: "numeric", + }); + + editor + .chain() + .focus() + .deleteRange(range) + .insertContent(currentTime) + .run(); + }, + }, { title: "Status", description: "Insert inline status badge.",