Skip to content

Commit 8e8bdca

Browse files
authored
DEVREL-2672: Create elements by tag name (#19)
1 parent 12cfc11 commit 8e8bdca

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/designer-extension-typings/elements-generated.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
type InsertOrMoveElement = <
44
el extends AnyElement,
5-
target extends el | ElementPreset<el> | Component | BuilderElement,
5+
target extends el | ElementPreset<el> | Component | BuilderElement | string,
66
>(
77
this: {id: FullElementId},
88
that: target

src/examples/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export const Components = {
151151

152152
if (root.children) {
153153
// Append DIV block to Root element
154-
await root?.append(webflow.elementPresets.DivBlock)
154+
await root?.append('div')
155155
}
156156
},
157157

src/examples/elements.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ export const Elements = {
307307
if (selectedElement) {
308308
// Insert DIV before selected Element
309309
const newDiv = await selectedElement.before(
310-
webflow.elementPresets.DivBlock,
310+
'div',
311311
)
312312

313313
// Print element details
@@ -322,7 +322,7 @@ export const Elements = {
322322
if (selectedElement) {
323323
// Insert DIV after selected Element
324324
const newDiv = await selectedElement.after(
325-
webflow.elementPresets.DivBlock,
325+
'div',
326326
)
327327

328328
// Print element details
@@ -337,7 +337,7 @@ export const Elements = {
337337
// Check if element supports child elements
338338
if (el?.children) {
339339
// Append newElement as a child to of the selected element
340-
const newElement = await el?.append(webflow.elementPresets.DivBlock)
340+
const newElement = await el?.append('div')
341341

342342
// Print element Details
343343
console.log(JSON.stringify(newElement))
@@ -351,7 +351,7 @@ export const Elements = {
351351
// Check if element supports child elements
352352
if (el?.children) {
353353
// Prepend newElement as a child to of the selected element
354-
const newElement = await el?.prepend(webflow.elementPresets.DivBlock)
354+
const newElement = await el?.prepend('div')
355355

356356
// Print element Details
357357
console.log(JSON.stringify(newElement))

0 commit comments

Comments
 (0)