DmitrMakeev commited on
Commit
404af27
·
verified ·
1 Parent(s): 41591d0

Update builder.html

Browse files
Files changed (1) hide show
  1. builder.html +56 -0
builder.html CHANGED
@@ -27,6 +27,62 @@
27
  });
28
 
29
  const domc = editor.DomComponents;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  domc.addType('cmp-a', {
32
  model: {
 
27
  });
28
 
29
  const domc = editor.DomComponents;
30
+ const bm = editor.BlockManager;
31
+
32
+ // Add blocks for the first example
33
+ bm.add('component-css-block', {
34
+ label: 'Component with CSS',
35
+ content: {
36
+ type: 'component-css',
37
+ },
38
+ });
39
+
40
+ // Add blocks for the second example
41
+ bm.add('cmp-a-block', {
42
+ label: 'Component A',
43
+ content: {
44
+ type: 'cmp-a',
45
+ },
46
+ });
47
+
48
+ bm.add('cmp-b-block', {
49
+ label: 'Component B',
50
+ content: {
51
+ type: 'cmp-b',
52
+ },
53
+ });
54
+
55
+ bm.add('component-css-block-2', {
56
+ label: 'Component with CSS 2',
57
+ content: {
58
+ type: 'component-css',
59
+ },
60
+ });
61
+
62
+ // Define component types
63
+ domc.addType('component-css', {
64
+ model: {
65
+ defaults: {
66
+ attributes: { class: 'cmp-css' },
67
+ components: `
68
+ <span>Component with styles<span>
69
+ <div class="cmp-css-a">Component A</div>
70
+ <div class="cmp-css-b">Component B</div>
71
+ `,
72
+ styles: `
73
+ .cmp-css { color: red }
74
+ .cmp-css-a { color: green }
75
+ .cmp-css-b { color: blue }
76
+
77
+ @media (max-width: 992px) {
78
+ .cmp-css{ color: darkred; }
79
+ .cmp-css-a { color: darkgreen }
80
+ .cmp-css-b { color: darkblue }
81
+ }
82
+ `,
83
+ },
84
+ },
85
+ });
86
 
87
  domc.addType('cmp-a', {
88
  model: {