Skip to content

Commit

Permalink
Check whether component supports children for wrapping (#4429)
Browse files Browse the repository at this point in the history
* wip

* move todo

* check exported component for children

* update snapshots

* bump utopia-api

* clean up after merge

* revert overabstraction

* more lenient element checking

* revert package json anc package lock

* re-update snapshots

* remove todo

* test

* re-re update snapshots

* remove outdated comment

* Update editor/src/core/third-party/remix-controls.ts

Co-authored-by: RheeseyB <[email protected]>

* move getTopLevelElementByExportsDetail

---------

Co-authored-by: RheeseyB <[email protected]>
  • Loading branch information
bkrmendy and Rheeseyb authored Oct 30, 2023
1 parent 9c75ba6 commit adcecf3
Show file tree
Hide file tree
Showing 23 changed files with 362 additions and 254 deletions.
94 changes: 20 additions & 74 deletions editor/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions editor/src/components/canvas/canvas-globals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const cardComponentDescriptor: ComponentDescriptor = {
label: 'Title',
},
},
supportsChildren: false,
variants: [
{
insertMenuLabel: 'Card Default',
Expand Down Expand Up @@ -77,6 +78,7 @@ const modifiedCardComponentDescriptor: ComponentDescriptor = {
label: 'Border',
},
},
supportsChildren: false,
variants: [
{
insertMenuLabel: 'Card Default',
Expand Down Expand Up @@ -123,6 +125,7 @@ const selectorComponentDescriptor: ComponentDescriptor = {
options: ['True', 'False', 'FileNotFound'],
},
},
supportsChildren: false,
variants: [
{
insertMenuLabel: 'True False Selector',
Expand Down Expand Up @@ -213,6 +216,7 @@ describe('validateControlsToCheck', () => {
"label": "Title",
},
},
"supportsChildren": false,
"variants": Array [
Object {
"elementToInsert": [Function],
Expand Down Expand Up @@ -351,6 +355,7 @@ describe('validateControlsToCheck', () => {
"label": "Title",
},
},
"supportsChildren": false,
"variants": Array [
Object {
"elementToInsert": [Function],
Expand Down Expand Up @@ -406,6 +411,7 @@ describe('validateControlsToCheck', () => {
],
},
},
"supportsChildren": false,
"variants": Array [
Object {
"elementToInsert": [Function],
Expand Down Expand Up @@ -468,6 +474,7 @@ describe('validateControlsToCheck', () => {
"label": "Title",
},
},
"supportsChildren": false,
"variants": Array [
Object {
"elementToInsert": [Function],
Expand Down Expand Up @@ -518,6 +525,7 @@ describe('validateControlsToCheck', () => {
"label": "Title",
},
},
"supportsChildren": false,
"variants": Array [
Object {
"elementToInsert": [Function],
Expand All @@ -544,6 +552,7 @@ describe('validateControlsToCheck', () => {
"label": "Title",
},
},
"supportsChildren": false,
"variants": Array [
Object {
"elementToInsert": [Function],
Expand Down
1 change: 1 addition & 0 deletions editor/src/components/canvas/canvas-globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export async function validateControlsToCheck(
(descriptorWithName) => {
return {
properties: descriptorWithName.properties,
supportsChildren: descriptorWithName.supportsChildren,
variants: descriptorWithName.variants,
}
},
Expand Down
1 change: 1 addition & 0 deletions editor/src/components/canvas/ui/floating-insert-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export const CustomComponentOption = (props: OptionProps<InsertMenuItem, false>)
<div
ref={innerRef}
{...innerProps}
data-testid={`floating-menu-item-${label}`}
style={{
boxSizing: 'border-box',
height: UtopiaTheme.layout.rowHeight.smaller,
Expand Down
Loading

0 comments on commit adcecf3

Please sign in to comment.