mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-20 05:12:54 +08:00
style & optimize editor
This commit is contained in:
parent
e7563b4035
commit
ce52bc4155
@ -45,20 +45,21 @@ function isJson(
|
||||
return false;
|
||||
}
|
||||
|
||||
const aceOptions = { useWorker: false };
|
||||
|
||||
const JsonEditor: React.FC<{
|
||||
json: string;
|
||||
setJson: React.Dispatch<React.SetStateAction<string>>;
|
||||
setJson: (json: string) => void;
|
||||
}> = ({ json, setJson }) => {
|
||||
const [error, setError] = React.useState({
|
||||
message: "",
|
||||
isExpanded: true,
|
||||
});
|
||||
|
||||
const [editorWidth, setEditorWidth] = React.useState("auto");
|
||||
const [config] = useLocalStorage<StorageConfig>("config", defaultConfig);
|
||||
const [value, setValue] = React.useState(
|
||||
JSON.stringify(JSON.parse(json), null, 2)
|
||||
);
|
||||
const [error, setError] = React.useState({
|
||||
message: "",
|
||||
isExpanded: true,
|
||||
});
|
||||
|
||||
React.useEffect(() => {
|
||||
const resizeObserver = new ResizeObserver((observed) => {
|
||||
@ -110,7 +111,9 @@ const JsonEditor: React.FC<{
|
||||
height="100%"
|
||||
fontSize={12}
|
||||
wrapEnabled
|
||||
setOptions={{ useWorker: false }}
|
||||
setOptions={aceOptions}
|
||||
showPrintMargin={false}
|
||||
tabSize={2}
|
||||
/>
|
||||
</StyledEditorWrapper>
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user