mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-02-04 01:32:54 +08:00
editor disable worker
This commit is contained in:
parent
5d0b45e25c
commit
e0b0591266
@ -1,12 +1,13 @@
|
|||||||
import React, { ComponentType } from "react";
|
import React from "react";
|
||||||
import dynamic from "next/dynamic";
|
import AceEditor from "react-ace";
|
||||||
import { IAceEditorProps } from "react-ace";
|
|
||||||
import { StorageConfig } from "src/typings/global";
|
import { StorageConfig } from "src/typings/global";
|
||||||
import { useLocalStorage } from "usehooks-ts";
|
import { useLocalStorage } from "usehooks-ts";
|
||||||
import { defaultConfig } from "src/constants/data";
|
import { defaultConfig } from "src/constants/data";
|
||||||
import parseJson from "parse-json";
|
import parseJson from "parse-json";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { Error, ErrorContainer } from "./ErrorContainer";
|
import { Error, ErrorContainer } from "./ErrorContainer";
|
||||||
|
require("ace-builds/src-noconflict/mode-json");
|
||||||
|
require("ace-builds/src-noconflict/theme-tomorrow_night");
|
||||||
|
|
||||||
const StyledEditorWrapper = styled.div`
|
const StyledEditorWrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -16,18 +17,6 @@ const StyledEditorWrapper = styled.div`
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const AceEditor: ComponentType<IAceEditorProps> = dynamic(
|
|
||||||
async () => {
|
|
||||||
const Ace = require("react-ace").default;
|
|
||||||
require("ace-builds/src-noconflict/mode-json");
|
|
||||||
require("ace-builds/src-noconflict/theme-tomorrow_night");
|
|
||||||
return Ace;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ssr: false,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
function isJson(
|
function isJson(
|
||||||
value: string,
|
value: string,
|
||||||
setState: React.Dispatch<React.SetStateAction<Error>>
|
setState: React.Dispatch<React.SetStateAction<Error>>
|
||||||
@ -121,6 +110,7 @@ const JsonEditor: React.FC<{
|
|||||||
height="100%"
|
height="100%"
|
||||||
fontSize={14}
|
fontSize={14}
|
||||||
wrapEnabled
|
wrapEnabled
|
||||||
|
setOptions={{ useWorker: false }}
|
||||||
/>
|
/>
|
||||||
</StyledEditorWrapper>
|
</StyledEditorWrapper>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user