mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-12 19:02:53 +08:00
feat: update monaco version
This commit is contained in:
parent
fe77036aca
commit
1a48ef11ab
@ -3,6 +3,7 @@ import type { EditorProps } from "@monaco-editor/react";
|
||||
export const editorOptions: EditorProps["options"] = {
|
||||
formatOnPaste: true,
|
||||
formatOnType: true,
|
||||
tabSize: 2,
|
||||
stopRenderingLineAfter: -1,
|
||||
minimap: { enabled: false },
|
||||
stickyScroll: { enabled: false },
|
||||
|
@ -1,18 +1,19 @@
|
||||
import React from "react";
|
||||
import React, { useCallback } from "react";
|
||||
import { LoadingOverlay } from "@mantine/core";
|
||||
import styled from "styled-components";
|
||||
import Editor, { type EditorProps, loader, useMonaco } from "@monaco-editor/react";
|
||||
import Editor, { type EditorProps, loader, type OnMount, useMonaco } from "@monaco-editor/react";
|
||||
import useConfig from "src/store/useConfig";
|
||||
import useFile from "src/store/useFile";
|
||||
|
||||
loader.config({
|
||||
paths: {
|
||||
vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.34.0/min/vs",
|
||||
vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs",
|
||||
},
|
||||
});
|
||||
|
||||
const editorOptions: EditorProps["options"] = {
|
||||
formatOnPaste: true,
|
||||
tabSize: 2,
|
||||
formatOnType: true,
|
||||
minimap: { enabled: false },
|
||||
scrollBeyondLastLine: false,
|
||||
@ -63,6 +64,12 @@ const TextEditor = () => {
|
||||
};
|
||||
}, [getHasChanges]);
|
||||
|
||||
const handleMount: OnMount = useCallback(editor => {
|
||||
editor.onDidPaste(() => {
|
||||
editor.getAction("editor.action.formatDocument")?.run();
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<StyledEditorWrapper>
|
||||
<StyledWrapper>
|
||||
@ -72,6 +79,7 @@ const TextEditor = () => {
|
||||
theme={theme}
|
||||
value={contents}
|
||||
options={editorOptions}
|
||||
onMount={handleMount}
|
||||
onValidate={errors => setError(errors[0]?.message)}
|
||||
onChange={contents => setContents({ contents, skipUpdate: true })}
|
||||
loading={<LoadingOverlay visible />}
|
||||
|
@ -89,6 +89,7 @@ export const SchemaModal = ({ opened, onClose }: ModalProps) => {
|
||||
language="json"
|
||||
options={{
|
||||
formatOnPaste: true,
|
||||
tabSize: 2,
|
||||
formatOnType: true,
|
||||
scrollBeyondLastLine: false,
|
||||
minimap: {
|
||||
|
@ -84,7 +84,7 @@ export const UpgradeModal = ({ opened, onClose }: ModalProps) => {
|
||||
loop
|
||||
preload="auto"
|
||||
playsInline
|
||||
poster="https://todiagram.com/videos/diagrams.webp"
|
||||
poster="https://todiagram.com/images/meta/design-tokens.webp"
|
||||
style={{ display: "block" }}
|
||||
>
|
||||
<source src="https://todiagram.com/videos/diagrams.mp4" type="video/mp4" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user