2022-11-03 16:39:51 +00:00
|
|
|
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
2022-10-17 15:16:38 +00:00
|
|
|
import { EvaluatedPopupState } from "reducers/uiReducers/editorContextReducer";
|
|
|
|
|
|
2022-11-15 06:20:18 +00:00
|
|
|
export const setFocusableCodeEditorField = (path: string | undefined) => {
|
2022-10-17 15:16:38 +00:00
|
|
|
return {
|
2022-11-15 06:20:18 +00:00
|
|
|
type: ReduxActionTypes.SET_FOCUSABLE_CODE_EDITOR_FIELD,
|
2022-10-17 15:16:38 +00:00
|
|
|
payload: { path },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-15 06:20:18 +00:00
|
|
|
export const setCodeEditorCursorHistory = (
|
|
|
|
|
path: string,
|
|
|
|
|
cursorPosition: { ch: number; line: number },
|
|
|
|
|
) => {
|
2022-10-17 15:16:38 +00:00
|
|
|
return {
|
2022-11-15 06:20:18 +00:00
|
|
|
type: ReduxActionTypes.SET_CODE_EDITOR_CURSOR_HISTORY,
|
|
|
|
|
payload: { cursorPosition, path },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type CodeEditorFocusState = {
|
|
|
|
|
key: string | undefined;
|
|
|
|
|
cursorPosition: {
|
|
|
|
|
ch: number;
|
|
|
|
|
line: number;
|
2022-10-17 15:16:38 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const generateKeyAndSetCodeEditorLastFocus = (
|
2022-11-15 06:20:18 +00:00
|
|
|
payload: CodeEditorFocusState,
|
2022-10-17 15:16:38 +00:00
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.GENERATE_KEY_AND_SET_CODE_EDITOR_LAST_FOCUS,
|
2022-11-15 06:20:18 +00:00
|
|
|
payload,
|
2022-10-17 15:16:38 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const generateKeyAndSetEvalPopupState = (
|
|
|
|
|
key: string | undefined,
|
|
|
|
|
evalPopupState: EvaluatedPopupState,
|
|
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.GENERATE_KEY_AND_SET_EVAL_POPUP_STATE,
|
|
|
|
|
payload: { key, evalPopupState },
|
|
|
|
|
};
|
|
|
|
|
};
|