mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
fix: fixed issue that caused auto layout alert to popup everytime
This commit is contained in:
parent
d605e4ce9c
commit
de0cce452b
4 changed files with 10 additions and 4 deletions
|
|
@ -289,7 +289,7 @@ export const Container = ({
|
|||
() => ({
|
||||
accept: [ItemTypes.BOX, ItemTypes.COMMENT],
|
||||
async drop(item, monitor) {
|
||||
if (item.currentLayout === 'mobile' && appDefinition.pages[currentPageId]?.autoComputeLayout) {
|
||||
if (item.currentLayout === 'mobile' && item.autoComputeLayout) {
|
||||
turnOffAutoLayout();
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ export const DraggableBox = React.memo(
|
|||
selectionInProgress,
|
||||
isSelectedComponent,
|
||||
isMultipleComponentsSelected,
|
||||
autoComputeLayout,
|
||||
} = useEditorStore(
|
||||
(state) => ({
|
||||
currentLayout: state?.currentLayout,
|
||||
|
|
@ -119,6 +120,7 @@ export const DraggableBox = React.memo(
|
|||
isSelectedComponent:
|
||||
mode === 'edit' ? state?.selectedComponents?.some((component) => component?.id === id) : false,
|
||||
isMultipleComponentsSelected: state?.selectedComponents?.length > 1 ? true : false,
|
||||
autoComputeLayout: state?.appDefinition?.pages?.[state?.currentPageId]?.autoComputeLayout,
|
||||
}),
|
||||
shallow
|
||||
);
|
||||
|
|
@ -136,12 +138,13 @@ export const DraggableBox = React.memo(
|
|||
layouts,
|
||||
canvasWidth,
|
||||
currentLayout,
|
||||
autoComputeLayout,
|
||||
},
|
||||
collect: (monitor) => ({
|
||||
isDragging: monitor.isDragging(),
|
||||
}),
|
||||
}),
|
||||
[id, title, component, index, currentLayout, zoomLevel, parent, layouts, canvasWidth]
|
||||
[id, title, component, index, currentLayout, zoomLevel, parent, layouts, canvasWidth, autoComputeLayout]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -1695,7 +1695,10 @@ const EditorComponent = (props) => {
|
|||
};
|
||||
|
||||
async function turnOffAutoLayout() {
|
||||
const result = await confirm('Turn off Auto Layout ?', 'Turn off Auto Layout');
|
||||
const result = await confirm(
|
||||
'You have to disable auto alignment to manually adjust mobile components. Once disabled, the mobile layout won’t automatically align with desktop changes',
|
||||
'Turn off Auto Layout'
|
||||
);
|
||||
if (result) {
|
||||
turnOffAutoComputeLayout({ pageId: currentPageId, autoComputeLayout: false });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ export const SubContainer = ({
|
|||
() => ({
|
||||
accept: ItemTypes.BOX,
|
||||
drop(item, monitor) {
|
||||
if (item.currentLayout === 'mobile' && appDefinition.pages[currentPageId]?.autoComputeLayout) {
|
||||
if (item.currentLayout === 'mobile' && item.autoComputeLayout) {
|
||||
turnOffAutoLayout();
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue