Explorar o código

style & optimize editor

AykutSarac %!s(int64=3) %!d(string=hai) anos
pai
achega
ce52bc4155
Modificáronse 1 ficheiros con 10 adicións e 7 borrados
  1. 10 7
      src/containers/JsonEditor/index.tsx

+ 10 - 7
src/containers/JsonEditor/index.tsx

@@ -45,20 +45,21 @@ function isJson(
   return false;
   return false;
 }
 }
 
 
+const aceOptions = { useWorker: false };
+
 const JsonEditor: React.FC<{
 const JsonEditor: React.FC<{
   json: string;
   json: string;
-  setJson: React.Dispatch<React.SetStateAction<string>>;
+  setJson: (json: string) => void;
 }> = ({ json, setJson }) => {
 }> = ({ json, setJson }) => {
-  const [error, setError] = React.useState({
-    message: "",
-    isExpanded: true,
-  });
-
   const [editorWidth, setEditorWidth] = React.useState("auto");
   const [editorWidth, setEditorWidth] = React.useState("auto");
   const [config] = useLocalStorage<StorageConfig>("config", defaultConfig);
   const [config] = useLocalStorage<StorageConfig>("config", defaultConfig);
   const [value, setValue] = React.useState(
   const [value, setValue] = React.useState(
     JSON.stringify(JSON.parse(json), null, 2)
     JSON.stringify(JSON.parse(json), null, 2)
   );
   );
+  const [error, setError] = React.useState({
+    message: "",
+    isExpanded: true,
+  });
 
 
   React.useEffect(() => {
   React.useEffect(() => {
     const resizeObserver = new ResizeObserver((observed) => {
     const resizeObserver = new ResizeObserver((observed) => {
@@ -110,7 +111,9 @@ const JsonEditor: React.FC<{
         height="100%"
         height="100%"
         fontSize={12}
         fontSize={12}
         wrapEnabled
         wrapEnabled
-        setOptions={{ useWorker: false }}
+        setOptions={aceOptions}
+        showPrintMargin={false}
+        tabSize={2}
       />
       />
     </StyledEditorWrapper>
     </StyledEditorWrapper>
   );
   );