Update builder.html
Browse files- builder.html +41 -59
builder.html
CHANGED
@@ -24,74 +24,56 @@
|
|
24 |
selectorManager: {
|
25 |
componentFirst: true,
|
26 |
},
|
27 |
-
styleManager: {
|
28 |
-
sectors: [
|
29 |
-
{
|
30 |
-
name: 'Dimensions',
|
31 |
-
properties: [
|
32 |
-
{
|
33 |
-
type: 'integer',
|
34 |
-
name: 'width',
|
35 |
-
units: ['px', '%'],
|
36 |
-
defaults: 'auto',
|
37 |
-
min: 0,
|
38 |
-
},
|
39 |
-
{
|
40 |
-
type: 'integer',
|
41 |
-
name: 'height',
|
42 |
-
units: ['px', '%'],
|
43 |
-
defaults: 'auto',
|
44 |
-
min: 0,
|
45 |
-
},
|
46 |
-
],
|
47 |
-
},
|
48 |
-
{
|
49 |
-
name: 'Typography',
|
50 |
-
properties: [
|
51 |
-
{
|
52 |
-
type: 'select',
|
53 |
-
name: 'font-family',
|
54 |
-
},
|
55 |
-
{
|
56 |
-
type: 'integer',
|
57 |
-
name: 'font-size',
|
58 |
-
units: ['px'],
|
59 |
-
defaults: '14px',
|
60 |
-
},
|
61 |
-
],
|
62 |
-
},
|
63 |
-
// Add more sectors and properties as needed
|
64 |
-
],
|
65 |
-
},
|
66 |
});
|
67 |
|
68 |
-
|
69 |
-
editor.
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
});
|
73 |
|
74 |
-
// Define
|
75 |
-
|
76 |
model: {
|
77 |
defaults: {
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
},
|
85 |
-
{
|
86 |
-
type: 'integer',
|
87 |
-
name: 'height',
|
88 |
-
label: 'Height',
|
89 |
-
changeProp: true,
|
90 |
-
},
|
91 |
-
],
|
92 |
},
|
93 |
},
|
94 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
</script>
|
96 |
</body>
|
97 |
</html>
|
|
|
24 |
selectorManager: {
|
25 |
componentFirst: true,
|
26 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
});
|
28 |
|
29 |
+
const domc = editor.DomComponents;
|
30 |
+
const bm = editor.BlockManager;
|
31 |
+
|
32 |
+
// Add a block with horizontal triple blocks
|
33 |
+
bm.add('horizontal-triple-block', {
|
34 |
+
label: 'Horizontal Triple Block',
|
35 |
+
content: `
|
36 |
+
<div style="display: flex; justify-content: space-between;">
|
37 |
+
<div style="flex: 1; margin: 5px; background-color: #f0f0f0; padding: 10px;">Block 1</div>
|
38 |
+
<div style="flex: 1; margin: 5px; background-color: #f0f0f0; padding: 10px;">Block 2</div>
|
39 |
+
<div style="flex: 1; margin: 5px; background-color: #f0f0f0; padding: 10px;">Block 3</div>
|
40 |
+
</div>
|
41 |
+
`,
|
42 |
});
|
43 |
|
44 |
+
// Define a button to add new blocks
|
45 |
+
domc.addType('add-block-button', {
|
46 |
model: {
|
47 |
defaults: {
|
48 |
+
components: `
|
49 |
+
<button onclick="addNewBlock()">Add New Block</button>
|
50 |
+
`,
|
51 |
+
attributes: {
|
52 |
+
'data-gjs-type': 'add-block-button',
|
53 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
},
|
55 |
},
|
56 |
});
|
57 |
+
|
58 |
+
// Function to add new blocks
|
59 |
+
window.addNewBlock = function() {
|
60 |
+
const newBlock = `
|
61 |
+
<div style="display: flex; justify-content: space-between;">
|
62 |
+
<div style="flex: 1; margin: 5px; background-color: #f0f0f0; padding: 10px;">New Block 1</div>
|
63 |
+
<div style="flex: 1; margin: 5px; background-color: #f0f0f0; padding: 10px;">New Block 2</div>
|
64 |
+
<div style="flex: 1; margin: 5px; background-color: #f0f0f0; padding: 10px;">New Block 3</div>
|
65 |
+
</div>
|
66 |
+
`;
|
67 |
+
editor.addComponents(newBlock);
|
68 |
+
};
|
69 |
+
|
70 |
+
// Add the button block
|
71 |
+
bm.add('add-block-button', {
|
72 |
+
label: 'Add Block Button',
|
73 |
+
content: {
|
74 |
+
type: 'add-block-button',
|
75 |
+
},
|
76 |
+
});
|
77 |
</script>
|
78 |
</body>
|
79 |
</html>
|