Browse Source

move editor options

AykutSarac 3 năm trước cách đây
mục cha
commit
8ebd9608b9
1 tập tin đã thay đổi với 10 bổ sung8 xóa
  1. 10 8
      src/containers/JsonEditor/index.tsx

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

@@ -1,5 +1,5 @@
 import React from "react";
-import AceEditor from "react-ace";
+import AceEditor, { IAceOptions } from "react-ace";
 import parseJson from "parse-json";
 import styled from "styled-components";
 import { ErrorContainer } from "./ErrorContainer";
@@ -17,7 +17,14 @@ const StyledEditorWrapper = styled.div`
   user-select: none;
 `;
 
-const aceOptions = { useWorker: false };
+const aceOptions: IAceOptions = {
+  useWorker: false,
+  fontSize: 12,
+  tabSize: 2,
+  showPrintMargin: false,
+  wrap: true,
+  mode: "json",
+};
 
 const JsonEditor: React.FC = () => {
   const {
@@ -86,17 +93,12 @@ const JsonEditor: React.FC = () => {
     <StyledEditorWrapper>
       <ErrorContainer error={error} setError={setError} />
       <AceEditor
+        height="100%"
         value={value}
         onChange={setValue}
-        mode="json"
         theme={editorTheme}
         width={editorWidth}
-        height="100%"
-        fontSize={12}
-        wrapEnabled
         setOptions={aceOptions}
-        showPrintMargin={false}
-        tabSize={2}
       />
     </StyledEditorWrapper>
   );