@@ -4,16 +4,20 @@ import MenuIcon from "components/img/MenuIcon";
44import { NavBarProps } from "cdm/MenuBarModel" ;
55import GlobalFilter from "components/reducers/GlobalFilter" ;
66import PaginationTable from "components/PaginationTable" ;
7- import { NavBarConfig , StyleVariables } from "helpers/Constants" ;
7+ import { InputType , NavBarConfig , StyleVariables } from "helpers/Constants" ;
88import AppBar from "@mui/material/AppBar" ;
99import Box from "@mui/material/Box" ;
1010import IconButton from "@mui/material/IconButton" ;
11+ import InsertDriveFileIcon from "@mui/icons-material/InsertDriveFile" ;
12+ import SettingsIcon from "@mui/icons-material/Settings" ;
1113import Menu from "@mui/material/Menu" ;
1214import MenuItem from "@mui/material/MenuItem" ;
15+
1316import Toolbar from "@mui/material/Toolbar" ;
1417import { c } from "helpers/StylesHelper" ;
1518import Typography from "@mui/material/Typography" ;
1619import DataviewFilters from "components/reducers/DataviewFilters" ;
20+ import { SettingsModal } from "Settings" ;
1721
1822export 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 }
0 commit comments