## Description Core features of Auto Layout and mobile responsiveness, hidden under a feature flag. > Add a TL;DR when description is extra long (helps content team) Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video ## Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? > Manual regression and sanity tests for all fixed canvas functionality. - Manual - Jest - Cypress ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag --------- Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Arsalan <arsalanyaldram0211@outlook.com> Co-authored-by: Aswath K <aswath.sana@gmail.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
import {
|
|
ReduxAction,
|
|
ReduxActionTypes,
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
|
import {
|
|
setPanelPropertySectionState,
|
|
setPanelSelectedPropertyTabIndex,
|
|
setWidgetPropertySectionState,
|
|
setWidgetSelectedPropertyTabIndex,
|
|
} from "actions/editorContextActions";
|
|
|
|
import {
|
|
CodeEditorFocusState,
|
|
setCodeEditorCursorAction,
|
|
setFocusableInputField,
|
|
} from "actions/editorContextActions";
|
|
import { FocusEntity, identifyEntityFromPath } from "navigation/FocusEntity";
|
|
import { all, put, takeLatest } from "redux-saga/effects";
|
|
|
|
/**
|
|
* This method appends the PageId along with the focusable propertyPath
|
|
* @param action
|
|
*/
|
|
function* setEditorFieldFocus(action: ReduxAction<CodeEditorFocusState>) {
|
|
const { cursorPosition, key } = action.payload;
|
|
|
|
const entityInfo = identifyEntityFromPath(window.location.pathname);
|
|
const ignoredEntities = [FocusEntity.DATASOURCE, FocusEntity.PROPERTY_PANE];
|
|
|
|
if (key) {
|
|
if (!ignoredEntities.includes(entityInfo.entity)) {
|
|
yield put(setFocusableInputField(key));
|
|
}
|
|
yield put(setCodeEditorCursorAction(key, cursorPosition));
|
|
}
|
|
}
|
|
|
|
function* setPropertySectionStateSaga(
|
|
action: ReduxAction<{
|
|
key: string;
|
|
isOpen: boolean;
|
|
panelPropertyPath?: string;
|
|
}>,
|
|
) {
|
|
const { isOpen, key, panelPropertyPath } = action.payload;
|
|
|
|
if (panelPropertyPath) {
|
|
yield put(setPanelPropertySectionState(key, isOpen, panelPropertyPath));
|
|
} else {
|
|
yield put(setWidgetPropertySectionState(key, isOpen));
|
|
}
|
|
}
|
|
|
|
function* setSelectedPropertyTabIndexSaga(
|
|
action: ReduxAction<{ index: number; panelPropertyPath?: string }>,
|
|
) {
|
|
const { index, panelPropertyPath } = action.payload;
|
|
|
|
if (panelPropertyPath) {
|
|
yield put(setPanelSelectedPropertyTabIndex(index, panelPropertyPath));
|
|
} else {
|
|
yield put(setWidgetSelectedPropertyTabIndex(index));
|
|
}
|
|
}
|
|
|
|
export default function* editorContextSagas() {
|
|
yield all([
|
|
takeLatest(
|
|
ReduxActionTypes.SET_PROPERTY_SECTION_STATE,
|
|
setPropertySectionStateSaga,
|
|
),
|
|
takeLatest(
|
|
ReduxActionTypes.SET_SELECTED_PROPERTY_TAB_INDEX,
|
|
setSelectedPropertyTabIndexSaga,
|
|
),
|
|
takeLatest(ReduxActionTypes.SET_EDITOR_FIELD_FOCUS, setEditorFieldFocus),
|
|
]);
|
|
}
|