Skip to content

Commit 1a48ef1

Browse files
committed
feat: update monaco version
1 parent fe77036 commit 1a48ef1

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/containers/ConverterLayout/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { EditorProps } from "@monaco-editor/react";
33
export const editorOptions: EditorProps["options"] = {
44
formatOnPaste: true,
55
formatOnType: true,
6+
tabSize: 2,
67
stopRenderingLineAfter: -1,
78
minimap: { enabled: false },
89
stickyScroll: { enabled: false },

src/containers/Editor/components/TextEditor.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
import React from "react";
1+
import React, { useCallback } from "react";
22
import { LoadingOverlay } from "@mantine/core";
33
import styled from "styled-components";
4-
import Editor, { type EditorProps, loader, useMonaco } from "@monaco-editor/react";
4+
import Editor, { type EditorProps, loader, type OnMount, useMonaco } from "@monaco-editor/react";
55
import useConfig from "src/store/useConfig";
66
import useFile from "src/store/useFile";
77

88
loader.config({
99
paths: {
10-
vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.34.0/min/vs",
10+
vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs",
1111
},
1212
});
1313

1414
const editorOptions: EditorProps["options"] = {
1515
formatOnPaste: true,
16+
tabSize: 2,
1617
formatOnType: true,
1718
minimap: { enabled: false },
1819
scrollBeyondLastLine: false,
@@ -63,6 +64,12 @@ const TextEditor = () => {
6364
};
6465
}, [getHasChanges]);
6566

67+
const handleMount: OnMount = useCallback(editor => {
68+
editor.onDidPaste(() => {
69+
editor.getAction("editor.action.formatDocument")?.run();
70+
});
71+
}, []);
72+
6673
return (
6774
<StyledEditorWrapper>
6875
<StyledWrapper>
@@ -72,6 +79,7 @@ const TextEditor = () => {
7279
theme={theme}
7380
value={contents}
7481
options={editorOptions}
82+
onMount={handleMount}
7583
onValidate={errors => setError(errors[0]?.message)}
7684
onChange={contents => setContents({ contents, skipUpdate: true })}
7785
loading={<LoadingOverlay visible />}

src/containers/Modals/SchemaModal/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export const SchemaModal = ({ opened, onClose }: ModalProps) => {
8989
language="json"
9090
options={{
9191
formatOnPaste: true,
92+
tabSize: 2,
9293
formatOnType: true,
9394
scrollBeyondLastLine: false,
9495
minimap: {

src/containers/Modals/UpgradeModal/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const UpgradeModal = ({ opened, onClose }: ModalProps) => {
8484
loop
8585
preload="auto"
8686
playsInline
87-
poster="https://todiagram.com/videos/diagrams.webp"
87+
poster="https://todiagram.com/images/meta/design-tokens.webp"
8888
style={{ display: "block" }}
8989
>
9090
<source src="https://todiagram.com/videos/diagrams.mp4" type="video/mp4" />

0 commit comments

Comments
 (0)