Skip to content

AI-native design editor. Open-source Figma alternative.

Show auto-layout panel for components and instances

Danila Poyarkov2c5c612e0f5d
diff --git a/packages/core/src/editor/text.ts b/packages/core/src/editor/text.ts
index 59fc55c3e..1f90be45d 100644
--- a/packages/core/src/editor/text.ts
+++ b/packages/core/src/editor/text.ts
@@ -1,3 +1,5 @@
+import { copyStyleRuns } from '../scene-graph/copy'
+
import type { SceneNode } from '../scene-graph'
import type { EditorContext } from './types'
@@ -11,7 +13,7 @@ export function createTextActions(ctx: EditorContext) {
const node = ctx.graph.getNode(nodeId)
if (!node) return
textBeforeEdit = node.text
- styleRunsBeforeEdit = structuredClone(node.styleRuns)
+ styleRunsBeforeEdit = copyStyleRuns(node.styleRuns)
ctx.state.editingTextId = nodeId
if (te) {
te.setRenderer(ctx.getRenderer())
@@ -40,7 +42,7 @@ export function createTextActions(ctx: EditorContext) {
const prevRuns = styleRunsBeforeEdit ?? []
const newText = result.text
const node = ctx.graph.getNode(result.nodeId)
- const newRuns = node ? structuredClone(node.styleRuns) : []
+ const newRuns = node ? copyStyleRuns(node.styleRuns) : []
ctx.graph.updateNode(result.nodeId, { text: newText, styleRuns: newRuns })
ctx.state.editingTextId = null
textBeforeEdit = null
diff --git a/src/components/properties/LayoutSection.vue b/src/components/properties/LayoutSection.vue
index 700db286d..005b8a4a3 100644
--- a/src/components/properties/LayoutSection.vue
+++ b/src/components/properties/LayoutSection.vue
@@ -48,7 +48,7 @@ const { panels } = useI18n()
</div>
</div>
- <template v-if="ctx.node.type === 'FRAME'">
+ <template v-if="['FRAME', 'COMPONENT', 'COMPONENT_SET', 'INSTANCE'].includes(ctx.node.type)">
<div :class="sectionWrapper()">
<div class="flex items-center justify-between">
<label class="mb-1.5 block text-[11px] text-muted">{{ panels.autoLayout }}</label>