DmitrMakeev commited on
Commit
d62783d
·
verified ·
1 Parent(s): d44b4c8

Update builder.html

Browse files
Files changed (1) hide show
  1. builder.html +62 -26
builder.html CHANGED
@@ -24,37 +24,73 @@
24
  selectorManager: {
25
  componentFirst: true,
26
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  });
28
 
29
- // Define a custom script
30
- const script = function() {
31
- alert('Hi');
32
- console.log('the element', this);
33
- };
34
 
35
- // Define a new custom component
36
- editor.Components.addType('comp-with-js', {
37
  model: {
38
  defaults: {
39
- script,
40
- // Add some style, just to make the component visible
41
- style: {
42
- width: '100px',
43
- height: '100px',
44
- background: 'red',
45
- },
46
- components: `
47
- <button onclick="alert('Ещё')" style="margin: 10px;">Ещё</button>
48
- `,
49
- }
50
- }
51
- });
52
-
53
- // Create a block for the component, so we can drop it easily
54
- editor.Blocks.add('test-block', {
55
- label: 'Test block',
56
- attributes: { class: 'fa fa-text' },
57
- content: { type: 'comp-with-js' },
58
  });
59
  </script>
60
  </body>
 
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
+ // Add a block for the button
69
+ editor.Blocks.add('button-block', {
70
+ label: 'Button',
71
+ content: `<button id="i1epvz" data-gjs-type="button" draggable="true" type="button" class="sub-btn" autocomplete="off">Submit</button>`,
72
+ });
73
 
74
+ // Define the button component type
75
+ editor.Components.addType('button', {
76
  model: {
77
  defaults: {
78
+ traits: [
79
+ {
80
+ type: 'integer',
81
+ name: 'width',
82
+ label: 'Width',
83
+ changeProp: true,
84
+ },
85
+ {
86
+ type: 'integer',
87
+ name: 'height',
88
+ label: 'Height',
89
+ changeProp: true,
90
+ },
91
+ ],
92
+ },
93
+ },
 
 
 
94
  });
95
  </script>
96
  </body>