Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: added author variable to the file name template

Ilian Sapundshievaaa22db0bb1c
diff --git a/src/renderer/components/dialogs/NewFileDialog.tsx b/src/renderer/components/dialogs/NewFileDialog.tsx
index 712e3df1c..097b89008 100644
--- a/src/renderer/components/dialogs/NewFileDialog.tsx
+++ b/src/renderer/components/dialogs/NewFileDialog.tsx
@@ -17,11 +17,6 @@
*/
import AppConfig from '-/AppConfig';
-import {
- extractTags,
- extractFileName,
- generateFileName,
-} from '@tagspaces/tagspaces-common/paths';
import DraggablePaper from '-/components/DraggablePaper';
import TsButton from '-/components/TsButton';
import CreateFile from '-/components/dialogs/components/CreateFile';
@@ -52,6 +47,11 @@ import {
formatDateTime4Tag,
locationType,
} from '@tagspaces/tagspaces-common/misc';
+import {
+ extractFileName,
+ extractTags,
+ generateFileName,
+} from '@tagspaces/tagspaces-common/paths';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import { useContext, useEffect, useReducer, useRef } from 'react';
import { useTranslation } from 'react-i18next';
@@ -135,6 +135,7 @@ function NewFileDialog(props: Props) {
function getFileNameFromTemplate(template: TS.FileTemplate) {
return template.fileNameTmpl
.replace('{timestamp}', formatDateTime4Tag(new Date(), true))
+ .replace('{author}', author)
.replace('{uuid}', getUuid());
}
diff --git a/src/renderer/components/dialogs/components/SettingsTemplates.tsx b/src/renderer/components/dialogs/components/SettingsTemplates.tsx
index 820ab6203..f7f83ecef 100644
--- a/src/renderer/components/dialogs/components/SettingsTemplates.tsx
+++ b/src/renderer/components/dialogs/components/SettingsTemplates.tsx
@@ -176,14 +176,14 @@ function SettingsTemplates(props: Props) {
</b>
. The file name template supports{' '}
<b>
- {'{'}timestamp{'}'}
+ {'{'}timestamp{'}'}, {'{'}author{'}'}
</b>{' '}
and{' '}
<b>
{'{'}uuid{'}'}
- </b>
- . The last one will generate a unique identifier so the new file
- will get an unique name.
+ </b>{' '}
+ variable. The last one will generate a unique identifier so the new
+ file will get an unique name.
</Typography>
<TsButton
disabled={!!window.ExtFileTemplates}