diff --git a/editor/src/components/canvas/canvas-strategies/strategies/draw-to-insert-strategy.spec.browser2.tsx b/editor/src/components/canvas/canvas-strategies/strategies/draw-to-insert-strategy.spec.browser2.tsx index af5ab649508d..9c26194be566 100644 --- a/editor/src/components/canvas/canvas-strategies/strategies/draw-to-insert-strategy.spec.browser2.tsx +++ b/editor/src/components/canvas/canvas-strategies/strategies/draw-to-insert-strategy.spec.browser2.tsx @@ -324,9 +324,9 @@ export var storyboard = ( gridColumn: '2', gridRow: '1', height: '60px', - left: '84px', - position: 'absolute', - top: '151px', + left: '', + position: '', + top: '', width: '40px', }) }) @@ -371,9 +371,9 @@ export var storyboard = ( gridColumn: '1', gridRow: '1', height: '30px', - left: '126px', - position: 'absolute', - top: '76px', + left: '', + position: '', + top: '', width: '20px', }) }) diff --git a/editor/src/components/canvas/canvas-strategies/strategies/grid-draw-to-insert-strategy.tsx b/editor/src/components/canvas/canvas-strategies/strategies/grid-draw-to-insert-strategy.tsx index 7036621bc9c1..50965cc71a8e 100644 --- a/editor/src/components/canvas/canvas-strategies/strategies/grid-draw-to-insert-strategy.tsx +++ b/editor/src/components/canvas/canvas-strategies/strategies/grid-draw-to-insert-strategy.tsx @@ -47,6 +47,7 @@ import { setGridPropsCommands } from './grid-helpers' import { newReparentSubjects } from './reparent-helpers/reparent-strategy-helpers' import { getReparentTargetUnified } from './reparent-helpers/reparent-strategy-parent-lookup' import { getGridCellUnderMouseFromMetadata } from './grid-cell-bounds' +import { nukeAllAbsolutePositioningPropsCommands } from '../../../inspector/inspector-common' export const gridDrawToInsertText: CanvasStrategyFactory = ( canvasState: InteractionCanvasState, @@ -211,25 +212,10 @@ const gridDrawToInsertStrategyInner = ? [] : getWrappingCommands(insertedElementPath, maybeWrapperWithUid) - const isClick = interactionData.type === 'DRAG' && interactionData.drag == null - - // for click-to-insert, don't use absolute positioning - const clickToInsertCommands = isClick - ? [ - deleteProperties('always', insertedElementPath, [ - PP.create('style', 'position'), - PP.create('style', 'top'), - PP.create('style', 'left'), - PP.create('style', 'bottom'), - PP.create('style', 'right'), - ]), - ] - : [] - return strategyApplicationResult( [ insertionCommand, - ...clickToInsertCommands, + ...nukeAllAbsolutePositioningPropsCommands(insertedElementPath), // do not use absolute positioning in grid cells ...setGridPropsCommands(insertedElementPath, gridTemplate, { gridRowStart: { numericalPosition: gridCellCoordinates.row }, gridColumnStart: { numericalPosition: gridCellCoordinates.column },