Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit bcc2136

Browse files
committed
Merge branch '324-the-new-sort-works-but-is-not-persisted-with-version-234'
2 parents be3cb4e + 590e20f commit bcc2136

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

src/components/NavBar.tsx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ import MenuIcon from "components/img/MenuIcon";
44
import { NavBarProps } from "cdm/MenuBarModel";
55
import GlobalFilter from "components/reducers/GlobalFilter";
66
import PaginationTable from "components/PaginationTable";
7-
import { NavBarConfig, StyleVariables } from "helpers/Constants";
7+
import { InputType, NavBarConfig, StyleVariables } from "helpers/Constants";
88
import AppBar from "@mui/material/AppBar";
99
import Box from "@mui/material/Box";
1010
import IconButton from "@mui/material/IconButton";
11+
import InsertDriveFileIcon from "@mui/icons-material/InsertDriveFile";
12+
import SettingsIcon from "@mui/icons-material/Settings";
1113
import Menu from "@mui/material/Menu";
1214
import MenuItem from "@mui/material/MenuItem";
15+
1316
import Toolbar from "@mui/material/Toolbar";
1417
import { c } from "helpers/StylesHelper";
1518
import Typography from "@mui/material/Typography";
1619
import DataviewFilters from "components/reducers/DataviewFilters";
20+
import { SettingsModal } from "Settings";
1721

1822
export function NavBar(navBarProps: NavBarProps) {
1923
const { table } = navBarProps;
@@ -29,6 +33,28 @@ export function NavBar(navBarProps: NavBarProps) {
2933
setAnchorEl(event.currentTarget);
3034
};
3135

36+
const handleSettingsClick = () => {
37+
setAnchorEl(null);
38+
new SettingsModal(
39+
view,
40+
{
41+
onSettingsChange: (settings) => {
42+
/**
43+
* Settings are saved into the database file, so we don't need to do anything here.
44+
*/
45+
},
46+
},
47+
view.plugin.settings
48+
).open();
49+
};
50+
51+
const handleOpenAsMarkdownClick = () => {
52+
setAnchorEl(null);
53+
view.plugin.databaseFileModes[(view.leaf as any).id || view.file.path] =
54+
InputType.MARKDOWN;
55+
view.plugin.setMarkdownView(view.leaf);
56+
};
57+
3258
return (
3359
<Box sx={{ flexGrow: 1 }}>
3460
<AppBar
@@ -71,7 +97,15 @@ export function NavBar(navBarProps: NavBarProps) {
7197
"aria-labelledby": "long-button",
7298
}}
7399
>
74-
<MenuItem>
100+
<MenuItem onClick={handleSettingsClick} disableRipple>
101+
<SettingsIcon />
102+
Settings
103+
</MenuItem>
104+
<MenuItem onClick={handleOpenAsMarkdownClick} disableRipple>
105+
<InsertDriveFileIcon />
106+
Open as Markdown
107+
</MenuItem>
108+
<MenuItem disableRipple>
75109
{/* CSV buttton download */}
76110
<CsvButton
77111
columns={columns}

src/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ export default class DBFolderPlugin extends Plugin {
395395
);
396396
}
397397
registerCommands() {
398-
// TODO - add command to create a new database
399398
this.addCommand({
400399
id: 'create-new-database-folder',
401400
name: 'Create a new database table',

0 commit comments

Comments
 (0)