-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathExportSettings.tsx
More file actions
104 lines (100 loc) · 3.93 KB
/
ExportSettings.tsx
File metadata and controls
104 lines (100 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import React from "react";
import { getExportSettingsAndUids } from "~/utils/getExportSettings";
import {
GlobalFlagPanel,
GlobalNumberPanel,
GlobalMultiTextPanel,
GlobalSelectPanel,
} from "./components/BlockPropSettingPanels";
import {
GLOBAL_KEYS,
EXPORT_KEYS,
} from "~/components/settings/utils/settingKeys";
import { type SettingsSnapshot } from "./utils/accessors";
const DiscourseGraphExport = ({
globalSettings,
}: {
globalSettings: SettingsSnapshot["globalSettings"];
}) => {
const exportBlockProps = globalSettings.Export;
const exportSettings = getExportSettingsAndUids();
const parentUid = exportSettings.exportUid;
return (
<div className="flex flex-col gap-4 p-1">
{/* TODO: Titles kept as lowercase to match legacy readers in getExportSettings.ts.
Update titles to Sentence case once read side is migrated to block props. */}
<div>
<GlobalFlagPanel
title="remove special characters"
description="Whether or not to remove the special characters in a file name"
settingKeys={[
GLOBAL_KEYS.export,
EXPORT_KEYS.removeSpecialCharacters,
]}
initialValue={exportBlockProps[EXPORT_KEYS.removeSpecialCharacters]}
order={1}
uid={exportSettings.removeSpecialCharacters.uid}
parentUid={parentUid}
/>
<GlobalFlagPanel
title="resolve block references"
description="Replaces block references in the markdown content with the block's content"
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.resolveBlockReferences]}
initialValue={exportBlockProps[EXPORT_KEYS.resolveBlockReferences]}
order={3}
uid={exportSettings.optsRefs.uid}
parentUid={parentUid}
/>
<GlobalFlagPanel
title="resolve block embeds"
description="Replaces block embeds in the markdown content with the block's content tree"
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.resolveBlockEmbeds]}
initialValue={exportBlockProps[EXPORT_KEYS.resolveBlockEmbeds]}
order={4}
uid={exportSettings.optsEmbeds.uid}
parentUid={parentUid}
/>
<GlobalFlagPanel
title="append referenced node"
description="If a referenced node is defined in a node's format, it will be appended to the discourse context"
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.appendReferencedNode]}
initialValue={exportBlockProps[EXPORT_KEYS.appendReferencedNode]}
order={6}
uid={exportSettings.appendRefNodeContext.uid}
parentUid={parentUid}
/>
</div>
<div className="link-type-select-wrapper">
<GlobalSelectPanel
title="link type"
description="How to format links that appear in your export."
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.linkType]}
initialValue={exportBlockProps[EXPORT_KEYS.linkType]}
order={5}
options={["alias", "wikilinks", "roam url"]}
uid={exportSettings.linkType.uid}
parentUid={parentUid}
/>
</div>
<GlobalNumberPanel
title="max filename length"
description="Set the maximum name length for markdown file exports"
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.maxFilenameLength]}
initialValue={exportBlockProps[EXPORT_KEYS.maxFilenameLength]}
order={0}
uid={exportSettings.maxFilenameLength.uid}
parentUid={parentUid}
/>
<GlobalMultiTextPanel
title="frontmatter"
description="Specify all the lines that should go to the Frontmatter of the markdown file"
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.frontmatter]}
initialValue={exportBlockProps[EXPORT_KEYS.frontmatter]}
order={2}
uid={exportSettings.frontmatter.uid}
parentUid={parentUid}
/>
</div>
);
};
export default DiscourseGraphExport;