feat: Add date/time template options to template titles

This commit is contained in:
Tom Moor
2022-12-24 15:53:05 +00:00
parent b8f748be52
commit c41bd9592e
10 changed files with 126 additions and 45 deletions

View File

@@ -34,6 +34,7 @@ import withStores from "~/components/withStores";
import type { Editor as TEditor } from "~/editor";
import { NavigationNode } from "~/types";
import { client } from "~/utils/ApiClient";
import { replaceTitleVariables } from "~/utils/date";
import { emojiToUrl } from "~/utils/emoji";
import { isModKey } from "~/utils/keyboard";
import {
@@ -186,8 +187,12 @@ class DocumentScene extends React.Component<Props> {
}
if (!this.title) {
this.title = template.title;
this.props.document.title = template.title;
const title = replaceTitleVariables(
template.title,
this.props.auth.user || undefined
);
this.title = title;
this.props.document.title = title;
}
this.props.document.text = template.text;