File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
apps/builder/app/shared/copy-paste/plugin-webflow Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -58,17 +58,20 @@ const toFragment = (
58
58
}
59
59
} ;
60
60
61
+ const customLabel = wfNode . _label ;
61
62
const addInstance = (
62
63
component : Instance [ "component" ] ,
63
64
children : Instance [ "children" ] = [ ] ,
64
- label ?: string
65
+ defaultLabel ?: string
65
66
) => {
66
67
fragment . instances . push ( {
67
68
id : instanceId ,
68
69
type : "instance" ,
69
70
component,
70
71
children,
71
- ...( label ? { label } : undefined ) ,
72
+ ...( ( customLabel || defaultLabel ) && {
73
+ label : customLabel || defaultLabel ,
74
+ } ) ,
72
75
} ) ;
73
76
} ;
74
77
Original file line number Diff line number Diff line change @@ -33,8 +33,19 @@ const WfNodeData = z.object({
33
33
. optional ( ) ,
34
34
} ) ;
35
35
36
- const WfBaseNode = z . object ( {
36
+ const coreNodeProperties = {
37
37
_id : z . string ( ) ,
38
+ /**
39
+ * A layer name.
40
+ *
41
+ * @note This is never actually set by Webflow, but was added to support a better UX for custom
42
+ * tooling that outputs Webflow data.
43
+ */
44
+ _label : z . string ( ) . optional ( ) ,
45
+ } ;
46
+
47
+ const WfBaseNode = z . object ( {
48
+ ...coreNodeProperties ,
38
49
tag : z . string ( ) ,
39
50
children : z . array ( z . string ( ) ) ,
40
51
classes : z . array ( z . string ( ) ) ,
@@ -43,7 +54,7 @@ const WfBaseNode = z.object({
43
54
} ) ;
44
55
45
56
const WfTextNode = z . object ( {
46
- _id : z . string ( ) ,
57
+ ... coreNodeProperties ,
47
58
v : z . string ( ) ,
48
59
text : z . boolean ( ) ,
49
60
} ) ;
You can’t perform that action at this time.
0 commit comments