Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/context/GlobalState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import EdiTDorContext from "./ediTDorContext";
import { editdorReducer } from "./editorReducers";

export const UPDATE_OFFLINE_TD = "UPDATE_OFFLINE_TD";
export const UPDATE_JSON_INDENTATION = "UPDATE_JSON_INDENTATION";
export const UPDATE_IS_MODIFIED = "UPDATE_IS_MODIFIED";
export const SET_FILE_HANDLE = "SET_FILE_HANDLE";
export const REMOVE_FORM_FROM_TD = "REMOVE_FORM_FROM_TD";
Expand Down Expand Up @@ -93,8 +94,17 @@ const GlobalState: React.FC<IGlobalStateProps> = ({ children }) => {
nameRepository: "",
dynamicValues: {},
},
jsonIndentation: 2,
updateJsonIndentation: () => {},
});

const updateJsonIndentation = (indentation: number) => {
dispatch({
type: UPDATE_JSON_INDENTATION,
jsonIndentation: indentation,
});
};

const updateOfflineTD = (offlineTD: string) => {
dispatch({ type: UPDATE_OFFLINE_TD, offlineTD: offlineTD });
};
Expand Down Expand Up @@ -202,6 +212,8 @@ const GlobalState: React.FC<IGlobalStateProps> = ({ children }) => {
updateValidationMessage,
updateNorthboundConnection,
updateContributeCatalog,
jsonIndentation: editdorState.jsonIndentation,
updateJsonIndentation,
}}
>
{children}
Expand Down