Skip to content

Commit 0a31bf5

Browse files
authored
Merge pull request #8498 from sagemathinc/files-new-add-json-8459
frontend/new file dropdown: add JSON
2 parents 035943d + f0b5d9d commit 0a31bf5

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/packages/frontend/file-associations.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,13 @@ file_associations["csv"] = {
230230
opts: {},
231231
};
232232

233+
file_associations["json"] = {
234+
editor: "codemirror",
235+
icon: "js-square",
236+
opts: { mode: "javascript", indent_unit: 2, tab_size: 2 },
237+
name: "JSON",
238+
};
239+
233240
// At https://cs.lmu.edu/~ray/notes/gasexamples/ they use .s, so I'm also including that.
234241
// In fact, GCC only works on files if they end in .s.
235242
file_associations["asm"] = file_associations["s"] = {

src/packages/frontend/project/new/new-file-dropdown.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* License: MS-RSL – see LICENSE.md for details
44
*/
55

6-
import { Button } from "antd";
6+
import { Button, Space } from "antd";
7+
import { useIntl } from "react-intl";
78

89
import { React } from "@cocalc/frontend/app-framework";
910
import {
@@ -15,7 +16,6 @@ import { file_associations } from "@cocalc/frontend/file-associations";
1516
import { EXTs } from "@cocalc/frontend/project/explorer/file-listing/utils";
1617
import { keys } from "@cocalc/util/misc";
1718
import { COLORS } from "@cocalc/util/theme";
18-
import { useIntl } from "react-intl";
1919

2020
// eslint-disable-next-line @typescript-eslint/no-var-requires
2121
const { file_options } = require("@cocalc/frontend/editor");
@@ -127,15 +127,15 @@ export function NewFileDropdown({
127127
className={"pull-right dropdown-splitbutton-left"}
128128
style={{ marginRight: "5px" }}
129129
>
130-
<Button.Group>
130+
<Space.Compact>
131131
<Button size="large" onClick={() => create_file()}>
132132
<span>
133133
<Icon name="file" /> {title}
134134
</span>
135135
</Button>
136136

137137
<DropdownMenu size="large" button={button} items={items} />
138-
</Button.Group>
138+
</Space.Compact>
139139
</span>
140140
);
141141
case "flyout":

0 commit comments

Comments
 (0)