Skip to content

Commit

Permalink
Expose tabSize
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Jun 3, 2024
1 parent c1d0807 commit aa79bf1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/jsonEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface JSONEditorProps {
onChange: (value: any) => void;
readOnly?: boolean;
showLines?: boolean;
tabSize?: number;
}

type AvailableEditorProps = Pick<EditorProps, 'height' | 'wrapperProps'>;
Expand All @@ -21,6 +22,7 @@ export const JSONEditor: React.FC<JSONEditorProps & AvailableEditorProps> = ({
onChange,
readOnly = false,
showLines = true,
tabSize = 2,
...props
}) => {
const monacoOnChange: OnChange = value => {
Expand All @@ -47,7 +49,7 @@ export const JSONEditor: React.FC<JSONEditorProps & AvailableEditorProps> = ({

const jsonData = JSON.stringify(value, null, 2);

const extraOptions: EditorProps['options'] = {readOnly};
const extraOptions: EditorProps['options'] = {readOnly, tabSize};
if (!showLines) extraOptions.lineNumbers = 'off';

return (
Expand Down

0 comments on commit aa79bf1

Please sign in to comment.