Update builder.html
Browse files- builder.html +35 -10
builder.html
CHANGED
@@ -28,24 +28,49 @@
|
|
28 |
|
29 |
const domc = editor.DomComponents;
|
30 |
|
31 |
-
domc.addType('
|
32 |
model: {
|
33 |
defaults: {
|
34 |
-
attributes: { class: 'cmp-css' },
|
35 |
-
components:
|
36 |
-
<span>Component with styles<span>
|
37 |
-
<div class="cmp-css-a">Component A</div>
|
38 |
-
<div class="cmp-css-b">Component B</div>
|
39 |
-
`,
|
40 |
styles: `
|
41 |
-
.cmp-css { color: red }
|
42 |
.cmp-css-a { color: green }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
.cmp-css-b { color: blue }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
@media (max-width: 992px) {
|
46 |
.cmp-css{ color: darkred; }
|
47 |
-
.cmp-css-a { color: darkgreen }
|
48 |
-
.cmp-css-b { color: darkblue }
|
49 |
}
|
50 |
`,
|
51 |
},
|
|
|
28 |
|
29 |
const domc = editor.DomComponents;
|
30 |
|
31 |
+
domc.addType('cmp-a', {
|
32 |
model: {
|
33 |
defaults: {
|
34 |
+
attributes: { class: 'cmp-css-a' },
|
35 |
+
components: 'Component A',
|
|
|
|
|
|
|
|
|
36 |
styles: `
|
|
|
37 |
.cmp-css-a { color: green }
|
38 |
+
@media (max-width: 992px) {
|
39 |
+
.cmp-css-a { color: darkgreen }
|
40 |
+
}
|
41 |
+
`,
|
42 |
+
}
|
43 |
+
},
|
44 |
+
});
|
45 |
+
|
46 |
+
domc.addType('cmp-b', {
|
47 |
+
model: {
|
48 |
+
defaults: {
|
49 |
+
attributes: { class: 'cmp-css-b' },
|
50 |
+
components: 'Component B',
|
51 |
+
styles: `
|
52 |
.cmp-css-b { color: blue }
|
53 |
+
@media (max-width: 992px) {
|
54 |
+
.cmp-css-b { color: darkblue }
|
55 |
+
}
|
56 |
+
`,
|
57 |
+
}
|
58 |
+
},
|
59 |
+
});
|
60 |
|
61 |
+
domc.addType('component-css', {
|
62 |
+
model: {
|
63 |
+
defaults: {
|
64 |
+
attributes: { class: 'cmp-css' },
|
65 |
+
components: [
|
66 |
+
'<span>Component with styles<span>',
|
67 |
+
{ type: 'cmp-a' },
|
68 |
+
{ type: 'cmp-b' },
|
69 |
+
],
|
70 |
+
styles: `
|
71 |
+
.cmp-css { color: red }
|
72 |
@media (max-width: 992px) {
|
73 |
.cmp-css{ color: darkred; }
|
|
|
|
|
74 |
}
|
75 |
`,
|
76 |
},
|