Skip to content

Commit 8a87e2e

Browse files
committed
fix: modify initialState with EditorState types
1 parent 0649259 commit 8a87e2e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/context/GlobalState.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import EdiTDorContext from "./ediTDorContext";
1616
import { editdorReducer } from "./editorReducers";
1717

1818
export const UPDATE_OFFLINE_TD = "UPDATE_OFFLINE_TD";
19+
export const UPDATE_JSON_INDENTATION=
20+
"UPDATE_JSON_INDENTATION";
1921
export const UPDATE_IS_MODIFIED = "UPDATE_IS_MODIFIED";
2022
export const SET_FILE_HANDLE = "SET_FILE_HANDLE";
2123
export const REMOVE_FORM_FROM_TD = "REMOVE_FORM_FROM_TD";
@@ -93,8 +95,17 @@ const GlobalState: React.FC<IGlobalStateProps> = ({ children }) => {
9395
nameRepository: "",
9496
dynamicValues: {},
9597
},
98+
jsonIndentation:2,
99+
updateJsonIndentation:()=>{}
96100
});
97101

102+
const updateJsonIndentation=(indentation:number)=>{
103+
dispatch({
104+
type:UPDATE_JSON_INDENTATION,
105+
jsonIndentation:indentation
106+
})
107+
}
108+
98109
const updateOfflineTD = (offlineTD: string) => {
99110
dispatch({ type: UPDATE_OFFLINE_TD, offlineTD: offlineTD });
100111
};
@@ -202,11 +213,13 @@ const GlobalState: React.FC<IGlobalStateProps> = ({ children }) => {
202213
updateValidationMessage,
203214
updateNorthboundConnection,
204215
updateContributeCatalog,
216+
jsonIndentation:editdorState.jsonIndentation,
217+
updateJsonIndentation
205218
}}
206219
>
207220
{children}
208221
</EdiTDorContext.Provider>
209222
);
210223
};
211224

212-
export default GlobalState;
225+
export default GlobalState;

0 commit comments

Comments
 (0)