fix: scroll to active entity in explorer on route change (#13085)
* Scroll to active entity in explorer on route change * Removes scroll animation * Open modal via entity explorer * Try tonavigate to canvas only in edit mode * Added cypress to assert modals' presence when triggered from the API page.
This commit is contained in:
parent
98f6a3fede
commit
c925bf2efd
|
|
@ -20,6 +20,11 @@ describe("Modal Widget Functionality", function() {
|
||||||
.click();
|
.click();
|
||||||
cy.get(".t--entity-name:contains(Modal1)").click();
|
cy.get(".t--entity-name:contains(Modal1)").click();
|
||||||
cy.get(".t--modal-widget").should("exist");
|
cy.get(".t--modal-widget").should("exist");
|
||||||
|
|
||||||
|
cy.CreateAPI("FirstAPI");
|
||||||
|
|
||||||
|
cy.get(".t--entity-name:contains(Modal1)").click();
|
||||||
|
cy.get(".t--modal-widget").should("exist");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("3. Display toast on close action", () => {
|
it("3. Display toast on close action", () => {
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,9 @@ export const EntityItem = styled.div<{
|
||||||
background: ${Colors.GREY_2};
|
background: ${Colors.GREY_2};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scroll-margin-top: 36px;
|
||||||
|
scroll-snap-margin-top: 36px;
|
||||||
|
|
||||||
& .${EntityClassNames.TOOLTIP} {
|
& .${EntityClassNames.TOOLTIP} {
|
||||||
${entityTooltipCSS}
|
${entityTooltipCSS}
|
||||||
.${Classes.POPOVER_TARGET} {
|
.${Classes.POPOVER_TARGET} {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useCallback, useMemo } from "react";
|
import React, { useCallback, useEffect, useMemo } from "react";
|
||||||
import { useActiveAction } from "../hooks";
|
import { useActiveAction } from "../hooks";
|
||||||
import { Entity } from "../Entity/index";
|
import { Entity } from "../Entity/index";
|
||||||
import {
|
import {
|
||||||
|
|
@ -45,6 +45,14 @@ function Files() {
|
||||||
|
|
||||||
const activeActionId = useActiveAction();
|
const activeActionId = useActiveAction();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!activeActionId) return;
|
||||||
|
document.getElementById(`entity-${activeActionId}`)?.scrollIntoView({
|
||||||
|
block: "nearest",
|
||||||
|
inline: "nearest",
|
||||||
|
});
|
||||||
|
}, [activeActionId]);
|
||||||
|
|
||||||
const onFilesToggle = useCallback(
|
const onFilesToggle = useCallback(
|
||||||
(isOpen: boolean) => {
|
(isOpen: boolean) => {
|
||||||
saveExplorerStatus(applicationId, "queriesAndJs", isOpen);
|
saveExplorerStatus(applicationId, "queriesAndJs", isOpen);
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,10 @@ import AppsmithConsole from "utils/AppsmithConsole";
|
||||||
import WidgetFactory from "utils/WidgetFactory";
|
import WidgetFactory from "utils/WidgetFactory";
|
||||||
import { Toaster } from "components/ads/Toast";
|
import { Toaster } from "components/ads/Toast";
|
||||||
import { deselectAllInitAction } from "actions/widgetSelectionActions";
|
import { deselectAllInitAction } from "actions/widgetSelectionActions";
|
||||||
|
import { navigateToCanvas } from "pages/Editor/Explorer/Widgets/utils";
|
||||||
|
import { getCurrentPageId } from "selectors/editorSelectors";
|
||||||
|
import { APP_MODE } from "entities/App";
|
||||||
|
import { getAppMode } from "selectors/applicationSelectors";
|
||||||
const WidgetTypes = WidgetFactory.widgetTypes;
|
const WidgetTypes = WidgetFactory.widgetTypes;
|
||||||
|
|
||||||
export function* createModalSaga(action: ReduxAction<{ modalName: string }>) {
|
export function* createModalSaga(action: ReduxAction<{ modalName: string }>) {
|
||||||
|
|
@ -129,6 +133,12 @@ export function* showModalSaga(action: ReduxAction<{ modalId: string }>) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pageId: string = yield select(getCurrentPageId);
|
||||||
|
const appMode: APP_MODE = yield select(getAppMode);
|
||||||
|
|
||||||
|
if (appMode === APP_MODE.EDIT)
|
||||||
|
navigateToCanvas({ pageId, widgetId: action.payload.modalId });
|
||||||
|
|
||||||
yield put({
|
yield put({
|
||||||
type: ReduxActionTypes.SELECT_WIDGET_INIT,
|
type: ReduxActionTypes.SELECT_WIDGET_INIT,
|
||||||
payload: { widgetId: action.payload.modalId },
|
payload: { widgetId: action.payload.modalId },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user