mirror of
https://github.com/docmost/docmost.git
synced 2026-06-22 09:01:37 +10:00
feat(editor): add /time slash command to insert current time (#2290)
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user