Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bkrmendy committed Oct 10, 2024
1 parent 2873981 commit c17162f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
renderTestEditorWithCode,
} from '../../ui-jsx.test-utils'

// describe.only('grid reparent strategies', () => {
describe('grid reparent strategies', () => {
describe('reparent into a grid', () => {
it('from the storyboard', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { TailwindConfigPath } from '../../../../core/tailwind/tailwind-config'

const DivTestId = 'mydiv'

// describe.only('Flex gap strategy', () => {
describe('Flex gap strategy', () => {
it('gap controls are not present when element has no children', async () => {
const editor = await renderTestEditorWithCode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export const setFlexGapStrategy: CanvasStrategyFactory = (

if (shouldTearOffGap) {
return strategyApplicationResult(
[deleteProperties('always', selectedElement, [StyleGapProp])],
[deleteProperties('always', selectedElement, [StyleGapProp], 'note-unset-properties')],
selectedElements,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ export interface DeleteProperties extends BaseCommand {
type: 'DELETE_PROPERTIES'
element: ElementPath
properties: Array<PropertyPath>
propertiesToUnsetBehaviour: 'note-unset-properties' | 'remove-properties'
}

export function deleteProperties(
whenToRun: WhenToRun,
element: ElementPath,
properties: Array<PropertyPath>,
propertiesToUnsetBehaviour: 'note-unset-properties' | 'remove-properties' = 'remove-properties',
): DeleteProperties {
return {
type: 'DELETE_PROPERTIES',
whenToRun: whenToRun,
element: element,
properties: properties,
propertiesToUnsetBehaviour: propertiesToUnsetBehaviour,
}
}

Expand Down Expand Up @@ -71,7 +74,10 @@ function getPropertiesToUnsetPatches(
editorState: EditorState,
command: DeleteProperties,
): EditorStatePatch[] {
if (command.whenToRun === 'on-complete') {
if (
command.whenToRun === 'on-complete' ||
command.propertiesToUnsetBehaviour === 'remove-properties'
) {
return []
}

Expand Down
5 changes: 1 addition & 4 deletions editor/src/components/canvas/gap-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ import type { ElementPath } from '../../core/shared/project-file-types'
import { assertNever } from '../../core/shared/utils'
import type { StyleInfo } from './canvas-types'
import { CSSCursor } from './canvas-types'
import {
cssNumberWithRenderedValue,
type CSSNumberWithRenderedValue,
} from './controls/select-mode/controls-common'
import type { CSSNumberWithRenderedValue } from './controls/select-mode/controls-common'
import type { CSSNumber, FlexDirection } from '../inspector/common/css-utils'
import type { Sides } from 'utopia-api/core'
import { sides } from 'utopia-api/core'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const InlineStylePlugin: StylePlugin = {
}
},
normalizeFromInlineStyle: (editor, elementsToNormalize) => {
return editor
return foldAndApplyCommandsSimple(
editor,
elementsToNormalize.map((element) =>
Expand Down

0 comments on commit c17162f

Please sign in to comment.