editor disable worker

This commit is contained in:
Aykut Saraç 2022-03-19 15:49:44 +03:00
parent 5d0b45e25c
commit e0b0591266

View File

@ -1,12 +1,13 @@
import React, { ComponentType } from "react";
import dynamic from "next/dynamic";
import { IAceEditorProps } from "react-ace";
import React from "react";
import AceEditor from "react-ace";
import { StorageConfig } from "src/typings/global";
import { useLocalStorage } from "usehooks-ts";
import { defaultConfig } from "src/constants/data";
import parseJson from "parse-json";
import styled from "styled-components";
import { Error, ErrorContainer } from "./ErrorContainer";
require("ace-builds/src-noconflict/mode-json");
require("ace-builds/src-noconflict/theme-tomorrow_night");
const StyledEditorWrapper = styled.div`
display: flex;
@ -16,18 +17,6 @@ const StyledEditorWrapper = styled.div`
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(
value: string,
setState: React.Dispatch<React.SetStateAction<Error>>
@ -121,6 +110,7 @@ const JsonEditor: React.FC<{
height="100%"
fontSize={14}
wrapEnabled
setOptions={{ useWorker: false }}
/>
</StyledEditorWrapper>
);