Disable edition for record page layouts disabled in the side panel (#19248)
## Before https://github.com/user-attachments/assets/8e5151d8-7e90-420c-a826-b6e670c68000 ## After https://github.com/user-attachments/assets/a230bc46-5991-4972-94d1-9fffe894ff4a Fixes https://discord.com/channels/1130383047699738754/1488106565117673513
This commit is contained in:
committed by
GitHub
parent
a303d9ca1b
commit
b1a7155431
+6
-1
@@ -1,5 +1,6 @@
|
||||
import { isLayoutCustomizationModeEnabledState } from '@/layout-customization/states/isLayoutCustomizationModeEnabledState';
|
||||
import { PageLayoutEditModeProviderContext } from '@/page-layout/contexts/PageLayoutEditModeContext';
|
||||
import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { type ReactNode } from 'react';
|
||||
|
||||
@@ -14,9 +15,13 @@ export const RecordPageLayoutEditModeProvider = ({
|
||||
isLayoutCustomizationModeEnabledState,
|
||||
);
|
||||
|
||||
const { isInSidePanel } = useLayoutRenderingContext();
|
||||
|
||||
return (
|
||||
<PageLayoutEditModeProviderContext
|
||||
value={{ isInEditMode: isLayoutCustomizationModeEnabled }}
|
||||
value={{
|
||||
isInEditMode: isLayoutCustomizationModeEnabled && !isInSidePanel,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</PageLayoutEditModeProviderContext>
|
||||
|
||||
+14
-5
@@ -2,6 +2,7 @@ import { PageLayoutEditModeProvider } from '@/page-layout/components/PageLayoutE
|
||||
import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext';
|
||||
import { pageLayoutPersistedComponentState } from '@/page-layout/states/pageLayoutPersistedComponentState';
|
||||
import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutId';
|
||||
import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';
|
||||
import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import {
|
||||
@@ -33,12 +34,20 @@ const PageLayoutTestEditModeProvider = ({
|
||||
layoutType ?? pageLayoutPersisted?.type ?? PageLayoutType.DASHBOARD;
|
||||
|
||||
return (
|
||||
<PageLayoutEditModeProvider
|
||||
layoutType={resolvedLayoutType}
|
||||
pageLayoutId={instanceId}
|
||||
<LayoutRenderingProvider
|
||||
value={{
|
||||
isInSidePanel: false,
|
||||
targetRecordIdentifier: undefined,
|
||||
layoutType: resolvedLayoutType,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</PageLayoutEditModeProvider>
|
||||
<PageLayoutEditModeProvider
|
||||
layoutType={resolvedLayoutType}
|
||||
pageLayoutId={instanceId}
|
||||
>
|
||||
{children}
|
||||
</PageLayoutEditModeProvider>
|
||||
</LayoutRenderingProvider>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user