mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-27 15:22:56 +08:00
toggle search input
This commit is contained in:
parent
75850a7709
commit
7282bfd2af
@ -38,6 +38,7 @@ export const defaultConfig: StorageConfig = {
|
||||
expand: true,
|
||||
autoformat: true,
|
||||
hideEditor: false,
|
||||
showSearch: false,
|
||||
zoomScale: 0.8,
|
||||
transform: 0,
|
||||
searchNode: "",
|
||||
|
@ -8,6 +8,7 @@ export enum ConfigActionType {
|
||||
TOGGLE_EXPAND,
|
||||
TOGGLE_AUTOFORMAT,
|
||||
TOGGLE_DOCK,
|
||||
TOGGLE_SEARCH,
|
||||
ZOOM_IN,
|
||||
ZOOM_OUT,
|
||||
CENTER_VIEW,
|
||||
@ -28,6 +29,16 @@ export const useConfigReducer: React.Reducer<AppConfig, ReducerAction> = (
|
||||
case ConfigActionType.SET_CONFIG:
|
||||
return { ...state, settings: action.payload };
|
||||
|
||||
case ConfigActionType.TOGGLE_SEARCH:
|
||||
return {
|
||||
...state,
|
||||
settings: {
|
||||
...state.settings,
|
||||
showSearch: !state.settings.showSearch,
|
||||
...(state.settings.showSearch && { searchNode: "" }),
|
||||
},
|
||||
};
|
||||
|
||||
case ConfigActionType.SET_SEARCH_NODE:
|
||||
return {
|
||||
...state,
|
||||
|
@ -5,6 +5,7 @@ export interface StorageConfig {
|
||||
expand: boolean;
|
||||
autoformat: boolean;
|
||||
hideEditor: boolean;
|
||||
showSearch: boolean;
|
||||
zoomScale: number;
|
||||
transform: number;
|
||||
searchNode: string;
|
||||
|
Loading…
x
Reference in New Issue
Block a user