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 mermaid diagram": "Insert mermaid diagram",
|
||||||
"Insert and design Drawio diagrams": "Insert and design Drawio diagrams",
|
"Insert and design Drawio diagrams": "Insert and design Drawio diagrams",
|
||||||
"Insert current date": "Insert current date",
|
"Insert current date": "Insert current date",
|
||||||
|
"Time": "Time",
|
||||||
|
"Insert current time": "Insert current time",
|
||||||
"Draw and sketch excalidraw diagrams": "Draw and sketch excalidraw diagrams",
|
"Draw and sketch excalidraw diagrams": "Draw and sketch excalidraw diagrams",
|
||||||
"Multiple": "Multiple",
|
"Multiple": "Multiple",
|
||||||
"Turn into": "Turn into",
|
"Turn into": "Turn into",
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
IconMenu4,
|
IconMenu4,
|
||||||
IconPageBreak,
|
IconPageBreak,
|
||||||
IconCalendar,
|
IconCalendar,
|
||||||
|
IconClock,
|
||||||
IconAppWindow,
|
IconAppWindow,
|
||||||
IconSitemap,
|
IconSitemap,
|
||||||
IconColumns3,
|
IconColumns3,
|
||||||
@@ -474,6 +475,25 @@ const CommandGroups: SlashMenuGroupedItemsType = {
|
|||||||
.run();
|
.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",
|
title: "Status",
|
||||||
description: "Insert inline status badge.",
|
description: "Insert inline status badge.",
|
||||||
|
|||||||
Reference in New Issue
Block a user