matcha-components 20.183.0 → 20.185.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,980 @@
1
+ <!DOCTYPE html>
2
+ <html lang="">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>GrapesJS</title>
7
+
8
+ <link rel="stylesheet" href="css/grapes.min.css">
9
+ <link rel="stylesheet" href="css/grapick.min.css">
10
+
11
+ <script src="https://unpkg.com/matcha-components/assets/page-builder/js/grapes.min.js"></script>
12
+ <script src="js/grapesjs-blocks-basic.js"></script>
13
+ <script src="js/grapesjs-component-countdown.js"></script>
14
+ <script src="js/grapesjs-custom-code.js"></script>
15
+ <script src="js/grapesjs-parser-postcss.js"></script>
16
+ <script src="js/grapesjs-plugin-export.js"></script>
17
+ <script src="js/grapesjs-plugin-forms.js"></script>
18
+ <script src="js/grapesjs-preset-webpage.js"></script>
19
+ <script src="js/grapesjs-style-bg.js"></script>
20
+ <script src="js/grapesjs-tabs.js"></script>
21
+ <script src="js/grapesjs-tooltip.js"></script>
22
+ <script src="js/grapesjs-touch.js"></script>
23
+ </head>
24
+
25
+ <body>
26
+ <style>
27
+ body,
28
+ html {
29
+ height: 100%;
30
+ margin: 0;
31
+ }
32
+
33
+ .code-panel .codepanel-label {
34
+ color: #a97d44 !important;
35
+ }
36
+
37
+ .gjs-pn-views-layer,
38
+ .gjs-cv-canvas {
39
+ transition: width 0.3s ease-in-out;
40
+ }
41
+
42
+ .gjs-pn-buttons {
43
+ align-items: center;
44
+ display: flex;
45
+
46
+ }
47
+
48
+ .gjs-pn-views-layer {
49
+ box-shadow: initial;
50
+ border-top: 2px solid rgba(0, 0, 0, 0.2);
51
+ top: 40px;
52
+ padding-top: 0;
53
+ height: calc(100% - 40px);
54
+ z-index: 4;
55
+ }
56
+
57
+ .gjs-pn-views-layer {
58
+ left: 0;
59
+ width: 15%;
60
+ overflow: auto;
61
+ box-shadow: 0 0 5px rgba(0, 0, 0, .2);
62
+ }
63
+
64
+ .gjs-pn-views-layers {
65
+ left: 0;
66
+ right: unset;
67
+ }
68
+
69
+ .gjs-pn-devices-c {
70
+ left: 45%;
71
+ }
72
+
73
+ .gjs-pn-opcoes,
74
+ #gjs-breadcrumbs {
75
+ left: 15%;
76
+ }
77
+
78
+ .gjs-pn-opcoes.fechado,
79
+ #gjs-breadcrumbs.fechado {
80
+ left: 0;
81
+ }
82
+
83
+ .gjs-cv-canvas.layer-aberto {
84
+ width: 70%;
85
+ left: 15%;
86
+ }
87
+
88
+ .gjs-cv-canvas.layer-aberto.code-editor-aberto {
89
+ width: 50%;
90
+ }
91
+
92
+ .gjs-cv-canvas.code-editor-aberto {
93
+ width: 65%;
94
+ }
95
+
96
+ .gjs-pn-views-container.code-editor-aberto {
97
+ width: 35%;
98
+ }
99
+
100
+ .gjs-pn-buttons {
101
+ justify-content: start;
102
+ }
103
+
104
+
105
+ .m-loader {
106
+ position: relative;
107
+ }
108
+
109
+ .m-loader.m-loader--brand:before {
110
+ border-top-color: #716aca;
111
+ }
112
+
113
+ .m-loader.m-loader--lg:before {
114
+ width: 2rem;
115
+ height: 2rem;
116
+ margin-top: -1rem;
117
+ margin-left: -1rem;
118
+ border-top-width: 3px;
119
+ border-right-width: 3px;
120
+ }
121
+
122
+ .m-loader:before {
123
+ border-top-color: #dfe2ea;
124
+ }
125
+
126
+ .m-loader:before {
127
+ width: 1.4rem;
128
+ height: 1.4rem;
129
+ margin-top: -0.7rem;
130
+ margin-left: -0.7rem;
131
+ border-top-width: 2px;
132
+ border-right-width: 2px;
133
+ }
134
+
135
+ .m-loader:before {
136
+ content: '';
137
+ -webkit-box-sizing: border-box;
138
+ box-sizing: border-box;
139
+ position: absolute;
140
+ top: 50%;
141
+ left: 50%;
142
+ border-top: 2px solid #07d;
143
+ border-right: 2px solid transparent;
144
+ border-radius: 50%;
145
+ -webkit-animation: m-loader-rotate 0.6s linear infinite;
146
+ animation: m-loader-rotate 0.6s linear infinite;
147
+ }
148
+
149
+ .m-blockui {
150
+ background: #fff;
151
+ -webkit-box-shadow: 0px 1px 15px 1px rgba(69, 65, 78, 0.1);
152
+ box-shadow: 0px 1px 15px 1px rgba(69, 65, 78, 0.1);
153
+ }
154
+
155
+ .m-blockui {
156
+ border-radius: 4px;
157
+ display: table;
158
+ table-layout: fixed;
159
+ }
160
+
161
+ .m-blockui>span {
162
+ color: #6f727d;
163
+ }
164
+
165
+ .m-blockui>span {
166
+ display: table-cell;
167
+ vertical-align: middle;
168
+ padding: 8px 15px;
169
+ font-size: 1rem;
170
+ font-weight: 400;
171
+ }
172
+
173
+ .m-blockui>span>.m-loader,
174
+ .m-blockui>span>.m-spinner {
175
+ margin-right: 10px;
176
+ }
177
+
178
+ .m-loader {
179
+ position: relative;
180
+ }
181
+
182
+ .m-blockui>span>.m-loader,
183
+ .m-blockui>span>.m-spinner {
184
+ margin-right: 10px;
185
+ }
186
+
187
+ .m-loader {
188
+ position: relative;
189
+ }
190
+
191
+ .m-loader.m-loader--info:before {
192
+ border-top-color: #36a3f7;
193
+ }
194
+
195
+ .m-loader.m-loader--lg:before {
196
+ width: 2rem;
197
+ height: 2rem;
198
+ margin-top: -1rem;
199
+ margin-left: -1rem;
200
+ border-top-width: 3px;
201
+ border-right-width: 3px;
202
+ }
203
+
204
+ .m-loader.m-loader--info:before {
205
+ border-top-color: #36a3f7;
206
+ }
207
+
208
+ .m-loader.m-loader--lg:before {
209
+ width: 2rem;
210
+ height: 2rem;
211
+ margin-top: -1rem;
212
+ margin-left: -1rem;
213
+ border-top-width: 3px;
214
+ border-right-width: 3px;
215
+ }
216
+
217
+ .m-loader:before {
218
+ border-top-color: #dfe2ea;
219
+ }
220
+
221
+ .m-loader:before {
222
+ width: 1.4rem;
223
+ height: 1.4rem;
224
+ margin-top: -0.7rem;
225
+ margin-left: -0.7rem;
226
+ border-top-width: 2px;
227
+ border-right-width: 2px;
228
+ }
229
+
230
+ .m-loader:before {
231
+ content: '';
232
+ -webkit-box-sizing: border-box;
233
+ box-sizing: border-box;
234
+ position: absolute;
235
+ top: 50%;
236
+ left: 50%;
237
+ border-top: 2px solid #07d;
238
+ border-right: 2px solid transparent;
239
+ border-radius: 50%;
240
+ -webkit-animation: m-loader-rotate 0.6s linear infinite;
241
+ animation: m-loader-rotate 0.6s linear infinite;
242
+ }
243
+
244
+ *,
245
+ *::before,
246
+ *::after {
247
+ -webkit-box-sizing: border-box;
248
+ box-sizing: border-box;
249
+ }
250
+
251
+ .m-blockui>span {
252
+ color: #6f727d;
253
+ }
254
+
255
+ .m-blockui>span {
256
+ display: table-cell;
257
+ vertical-align: middle;
258
+ padding: 8px 15px;
259
+ font-size: 1rem;
260
+ font-weight: 400;
261
+ }
262
+
263
+ @keyframes m-loader-rotate {
264
+ 0% {
265
+ transform: rotate(0deg);
266
+ }
267
+
268
+ 100% {
269
+ transform: rotate(360deg);
270
+ }
271
+ }
272
+ </style>
273
+
274
+ <div id="gjs"></div>
275
+
276
+
277
+ <script>
278
+ var blocksPage = {
279
+ get: function (query) {
280
+ var el;
281
+
282
+ if (query === document) {
283
+ return document;
284
+ }
285
+
286
+ if (!!(query && query.nodeType === 1)) {
287
+ return query;
288
+ }
289
+
290
+ if (el = document.getElementById(query)) {
291
+ return el;
292
+ } else if (el = document.getElementsByTagName(query)) {
293
+ return el[0];
294
+ } else if (el = document.getElementsByClassName(query)) {
295
+ return el[0];
296
+ } else {
297
+ return null;
298
+ }
299
+ },
300
+ addClass: function (el, className) {
301
+ if (!el || typeof className === 'undefined') {
302
+ return;
303
+ }
304
+
305
+ var classNames = className.split(' ');
306
+
307
+ if (el.classList) {
308
+ for (var i = 0; i < classNames.length; i++) {
309
+ if (classNames[i] && classNames[i].length > 0) {
310
+ el.classList.add(blocksPage.trim(classNames[i]));
311
+ }
312
+ }
313
+ } else if (!blocksPage.hasClass(el, className)) {
314
+ for (var i = 0; i < classNames.length; i++) {
315
+ el.className += ' ' + blocksPage.trim(classNames[i]);
316
+ }
317
+ }
318
+ },
319
+ actualWidth: function (el, cache) {
320
+ return blocksPage.actualCss(el, 'width', cache);
321
+ },
322
+ actualCss: function (el, prop, cache) {
323
+ if (el instanceof HTMLElement === false) {
324
+ return;
325
+ }
326
+
327
+ if (!el.getAttribute('m-hidden-' + prop) || cache === false) {
328
+ var value;
329
+
330
+ // the element is hidden so:
331
+ // making the el block so we can meassure its height but still be hidden
332
+ el.style.cssText = 'position: absolute; visibility: hidden; display: block;';
333
+
334
+ if (prop == 'width') {
335
+ value = el.offsetWidth;
336
+ } else if (prop == 'height') {
337
+ value = el.offsetHeight;
338
+ }
339
+
340
+ el.style.cssText = '';
341
+
342
+ // store it in cache
343
+ el.setAttribute('m-hidden-' + prop, value);
344
+
345
+ return parseFloat(value);
346
+ } else {
347
+ // store it in cache
348
+ return parseFloat(el.getAttribute('m-hidden-' + prop));
349
+ }
350
+ },
351
+ remove: function (el) {
352
+ if (el && el.parentNode) {
353
+ el.parentNode.removeChild(el);
354
+ }
355
+ },
356
+ trim: function (string) {
357
+ return string.trim();
358
+ },
359
+ hasClass: function (el, className) {
360
+ if (!el) {
361
+ return;
362
+ }
363
+
364
+ return el.classList ? el.classList.contains(className) : new RegExp('\\b' + className + '\\b').test(el.className);
365
+ },
366
+ css: function (el, styleProp, value) {
367
+ el = blocksPage.get(el);
368
+
369
+ if (!el) {
370
+ return;
371
+ }
372
+
373
+ if (value !== undefined) {
374
+ el.style[styleProp] = value;
375
+ } else {
376
+ var value, defaultView = (el.ownerDocument || document).defaultView;
377
+ // W3C standard way:
378
+ if (defaultView && defaultView.getComputedStyle) {
379
+ // sanitize property name to css notation
380
+ // (hyphen separated words eg. font-Size)
381
+ styleProp = styleProp.replace(/([A-Z])/g, "-$1").toLowerCase();
382
+ return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
383
+ } else if (el.currentStyle) { // IE
384
+ // sanitize property name to camelCase
385
+ styleProp = styleProp.replace(/\-(\w)/g, function (str, letter) {
386
+ return letter.toUpperCase();
387
+ });
388
+ value = el.currentStyle[styleProp];
389
+ // convert other units to pixels on IE
390
+ if (/^\d+(em|pt|%|ex)?$/i.test(value)) {
391
+ return (function (value) {
392
+ var oldLeft = el.style.left,
393
+ oldRsLeft = el.runtimeStyle.left;
394
+ el.runtimeStyle.left = el.currentStyle.left;
395
+ el.style.left = value || 0;
396
+ value = el.style.pixelLeft + "px";
397
+ el.style.left = oldLeft;
398
+ el.runtimeStyle.left = oldRsLeft;
399
+ return value;
400
+ })(value);
401
+ }
402
+ return value;
403
+ }
404
+ }
405
+ },
406
+ block: function (target, options) {
407
+ var el = $(target);
408
+
409
+ options = $.extend(true, {
410
+ opacity: 0.03,
411
+ overlayColor: '#000000',
412
+ state: 'brand',
413
+ type: 'loader',
414
+ size: 'lg',
415
+ centerX: true,
416
+ centerY: true,
417
+ message: '',
418
+ shadow: true,
419
+ width: 'auto'
420
+ }, options);
421
+
422
+ var skin;
423
+ var state;
424
+ var loading;
425
+ var size;
426
+ var html;
427
+
428
+ if (options.type == 'spinner') {
429
+ skin = options.skin ? 'm-spinner--skin-' + options.skin : '';
430
+ state = options.state ? 'm-spinner--' + options.state : '';
431
+ loading = '<div class="m-spinner ' + skin + ' ' + state + '"></div';
432
+ } else {
433
+ skin = options.skin ? 'm-loader--skin-' + options.skin : '';
434
+ state = options.state ? 'm-loader--' + options.state : '';
435
+ size = options.size ? 'm-loader--' + options.size : '';
436
+ loading = '<div class="m-loader ' + skin + ' ' + state + ' ' + size + '"></div';
437
+ }
438
+
439
+ if (options.message && options.message.length > 0) {
440
+ var classes = 'm-blockui ' + (options.shadow === false ? 'm-blockui-no-shadow' : '');
441
+
442
+ html = '<div class="' + classes + '"><span>' + options.message + '</span><span>' + loading + '</span></div>';
443
+
444
+ var el = document.createElement('div');
445
+ blocksPage.get('body').prepend(el);
446
+ blocksPage.addClass(el, classes);
447
+ el.innerHTML = '<span>' + options.message + '</span><span>' + loading + '</span>';
448
+ options.width = blocksPage.actualWidth(el) + 10;
449
+ blocksPage.remove(el);
450
+
451
+ if (target == 'body') {
452
+ html = '<div class="' + classes + '" style="margin-left:-' + (options.width / 2) + 'px;"><span>' + options.message + '</span><span>' + loading + '</span></div>';
453
+ }
454
+ } else {
455
+ html = loading;
456
+ }
457
+
458
+ var params = {
459
+ message: html,
460
+ centerY: options.centerY,
461
+ centerX: options.centerX,
462
+ css: {
463
+ top: '30%',
464
+ left: '50%',
465
+ border: '0',
466
+ padding: '0',
467
+ backgroundColor: 'none',
468
+ width: options.width
469
+ },
470
+ overlayCSS: {
471
+ backgroundColor: options.overlayColor,
472
+ opacity: options.opacity,
473
+ cursor: 'wait',
474
+ zIndex: '10'
475
+ },
476
+ onUnblock: function () {
477
+ if (el && el[0]) {
478
+ blocksPage.css(el[0], 'position', '');
479
+ blocksPage.css(el[0], 'zoom', '');
480
+ }
481
+ }
482
+ };
483
+
484
+ if (target == 'body') {
485
+ params.css.top = '50%';
486
+ $.blockUI(params);
487
+ } else {
488
+ var el = $(target);
489
+ el.block(params);
490
+ }
491
+ },
492
+
493
+ unblock: function (target) {
494
+ if (target && target != 'body') {
495
+ $(target).unblock();
496
+ } else {
497
+ $.unblockUI();
498
+ }
499
+ },
500
+
501
+ blockPage: function (options) {
502
+ return blocksPage.block('body', options);
503
+ },
504
+
505
+ unblockPage: function () {
506
+ return blocksPage.unblock('body');
507
+ }
508
+ }
509
+
510
+ const block = {
511
+ block: (el) => {
512
+ el = el || '';
513
+ const blockConf = {
514
+ opacity: 0.5,
515
+ overlayColor: '#000000',
516
+ type: 'loader',
517
+ state: 'info',
518
+ message: 'Aguarde...'
519
+ };
520
+
521
+ if (el == '') {
522
+ blocksPage.blockPage(blockConf);
523
+ } else if (typeof el === 'object') {
524
+ blocksPage.block(el, blockConf);
525
+ } else {
526
+ if (String(el).substr(0, 1) != "#") {
527
+ el = "#" + el;
528
+ }
529
+ blocksPage.block(el, blockConf);
530
+ }
531
+ },
532
+ unblock: (el) => {
533
+ el = el || '';
534
+
535
+ if (el == '') {
536
+ blocksPage.unblockPage();
537
+ } else if (typeof el === 'object') {
538
+ blocksPage.unblock(el);
539
+ } else {
540
+ if (String(el).substr(0, 1) != "#") {
541
+ el = "#" + el;
542
+ }
543
+ blocksPage.unblock(el);
544
+ }
545
+ }
546
+ };
547
+
548
+ var editor = grapesjs.init({
549
+ height: '100%',
550
+ container: '#gjs',
551
+ fromElement: true,
552
+ showOffsets: true,
553
+ assetManager: {
554
+ embedAsBase64: true,
555
+ },
556
+ selectorManager: { componentFirst: true },
557
+ styleManager: {
558
+ sectors: [{
559
+ name: 'General',
560
+ properties: [
561
+ {
562
+ extend: 'float',
563
+ type: 'radio',
564
+ default: 'none',
565
+ options: [
566
+ { value: 'none', className: 'fa fa-times' },
567
+ { value: 'left', className: 'fa fa-align-left' },
568
+ { value: 'right', className: 'fa fa-align-right' }
569
+ ],
570
+ },
571
+ 'display',
572
+ { extend: 'position', type: 'select' },
573
+ 'top',
574
+ 'right',
575
+ 'left',
576
+ 'bottom',
577
+ ],
578
+ }, {
579
+ name: 'Dimension',
580
+ open: false,
581
+ properties: [
582
+ 'width',
583
+ {
584
+ id: 'flex-width',
585
+ type: 'integer',
586
+ name: 'Width',
587
+ units: ['px', '%'],
588
+ property: 'flex-basis',
589
+ toRequire: 1,
590
+ },
591
+ 'height',
592
+ 'max-width',
593
+ 'min-height',
594
+ 'margin',
595
+ 'padding'
596
+ ],
597
+ }, {
598
+ name: 'Typography',
599
+ open: false,
600
+ properties: [
601
+ 'font-family',
602
+ 'font-size',
603
+ 'font-weight',
604
+ 'letter-spacing',
605
+ 'color',
606
+ 'line-height',
607
+ {
608
+ extend: 'text-align',
609
+ options: [
610
+ { id: 'left', label: 'Left', className: 'fa fa-align-left' },
611
+ { id: 'center', label: 'Center', className: 'fa fa-align-center' },
612
+ { id: 'right', label: 'Right', className: 'fa fa-align-right' },
613
+ { id: 'justify', label: 'Justify', className: 'fa fa-align-justify' }
614
+ ],
615
+ },
616
+ {
617
+ property: 'text-decoration',
618
+ type: 'radio',
619
+ default: 'none',
620
+ options: [
621
+ { id: 'none', label: 'None', className: 'fa fa-times' },
622
+ { id: 'underline', label: 'underline', className: 'fa fa-underline' },
623
+ { id: 'line-through', label: 'Line-through', className: 'fa fa-strikethrough' }
624
+ ],
625
+ },
626
+ 'text-shadow'
627
+ ],
628
+ }, {
629
+ name: 'Decorations',
630
+ open: false,
631
+ properties: [
632
+ 'opacity',
633
+ 'border-radius',
634
+ 'border',
635
+ 'box-shadow',
636
+ 'background', // { id: 'background-bg', property: 'background', type: 'bg' }
637
+ ],
638
+ }, {
639
+ name: 'Extra',
640
+ open: false,
641
+ buildProps: [
642
+ 'transition',
643
+ 'perspective',
644
+ 'transform'
645
+ ],
646
+ }, {
647
+ name: 'Flex',
648
+ open: false,
649
+ properties: [{
650
+ name: 'Flex Container',
651
+ property: 'display',
652
+ type: 'select',
653
+ defaults: 'block',
654
+ list: [
655
+ { value: 'block', name: 'Disable' },
656
+ { value: 'flex', name: 'Enable' }
657
+ ],
658
+ }, {
659
+ name: 'Flex Parent',
660
+ property: 'label-parent-flex',
661
+ type: 'integer',
662
+ }, {
663
+ name: 'Direction',
664
+ property: 'flex-direction',
665
+ type: 'radio',
666
+ defaults: 'row',
667
+ list: [{
668
+ value: 'row',
669
+ name: 'Row',
670
+ className: 'icons-flex icon-dir-row',
671
+ title: 'Row',
672
+ }, {
673
+ value: 'row-reverse',
674
+ name: 'Row reverse',
675
+ className: 'icons-flex icon-dir-row-rev',
676
+ title: 'Row reverse',
677
+ }, {
678
+ value: 'column',
679
+ name: 'Column',
680
+ title: 'Column',
681
+ className: 'icons-flex icon-dir-col',
682
+ }, {
683
+ value: 'column-reverse',
684
+ name: 'Column reverse',
685
+ title: 'Column reverse',
686
+ className: 'icons-flex icon-dir-col-rev',
687
+ }],
688
+ }, {
689
+ name: 'Justify',
690
+ property: 'justify-content',
691
+ type: 'radio',
692
+ defaults: 'flex-start',
693
+ list: [{
694
+ value: 'flex-start',
695
+ className: 'icons-flex icon-just-start',
696
+ title: 'Start',
697
+ }, {
698
+ value: 'flex-end',
699
+ title: 'End',
700
+ className: 'icons-flex icon-just-end',
701
+ }, {
702
+ value: 'space-between',
703
+ title: 'Space between',
704
+ className: 'icons-flex icon-just-sp-bet',
705
+ }, {
706
+ value: 'space-around',
707
+ title: 'Space around',
708
+ className: 'icons-flex icon-just-sp-ar',
709
+ }, {
710
+ value: 'center',
711
+ title: 'Center',
712
+ className: 'icons-flex icon-just-sp-cent',
713
+ }],
714
+ }, {
715
+ name: 'Align',
716
+ property: 'align-items',
717
+ type: 'radio',
718
+ defaults: 'center',
719
+ list: [{
720
+ value: 'flex-start',
721
+ title: 'Start',
722
+ className: 'icons-flex icon-al-start',
723
+ }, {
724
+ value: 'flex-end',
725
+ title: 'End',
726
+ className: 'icons-flex icon-al-end',
727
+ }, {
728
+ value: 'stretch',
729
+ title: 'Stretch',
730
+ className: 'icons-flex icon-al-str',
731
+ }, {
732
+ value: 'center',
733
+ title: 'Center',
734
+ className: 'icons-flex icon-al-center',
735
+ }],
736
+ }, {
737
+ name: 'Flex Children',
738
+ property: 'label-parent-flex',
739
+ type: 'integer',
740
+ }, {
741
+ name: 'Order',
742
+ property: 'order',
743
+ type: 'integer',
744
+ defaults: 0,
745
+ min: 0
746
+ }, {
747
+ name: 'Flex',
748
+ property: 'flex',
749
+ type: 'composite',
750
+ properties: [{
751
+ name: 'Grow',
752
+ property: 'flex-grow',
753
+ type: 'integer',
754
+ defaults: 0,
755
+ min: 0
756
+ }, {
757
+ name: 'Shrink',
758
+ property: 'flex-shrink',
759
+ type: 'integer',
760
+ defaults: 0,
761
+ min: 0
762
+ }, {
763
+ name: 'Basis',
764
+ property: 'flex-basis',
765
+ type: 'integer',
766
+ units: ['px', '%', ''],
767
+ unit: '',
768
+ defaults: 'auto',
769
+ }],
770
+ }, {
771
+ name: 'Align',
772
+ property: 'align-self',
773
+ type: 'radio',
774
+ defaults: 'auto',
775
+ list: [{
776
+ value: 'auto',
777
+ name: 'Auto',
778
+ }, {
779
+ value: 'flex-start',
780
+ title: 'Start',
781
+ className: 'icons-flex icon-al-start',
782
+ }, {
783
+ value: 'flex-end',
784
+ title: 'End',
785
+ className: 'icons-flex icon-al-end',
786
+ }, {
787
+ value: 'stretch',
788
+ title: 'Stretch',
789
+ className: 'icons-flex icon-al-str',
790
+ }, {
791
+ value: 'center',
792
+ title: 'Center',
793
+ className: 'icons-flex icon-al-center',
794
+ }],
795
+ }]
796
+ }
797
+ ],
798
+ },
799
+ plugins: [
800
+ 'gjs-blocks-basic',
801
+ 'grapesjs-plugin-forms',
802
+ 'grapesjs-component-countdown',
803
+ 'grapesjs-plugin-export',
804
+ 'grapesjs-tabs',
805
+ 'grapesjs-custom-code',
806
+ 'grapesjs-touch',
807
+ 'grapesjs-parser-postcss',
808
+ 'grapesjs-tooltip',
809
+ 'grapesjs-tui-image-editor',
810
+ 'grapesjs-typed',
811
+ 'grapesjs-style-bg',
812
+ 'grapesjs-preset-webpage',
813
+ 'grapesjs-code-editor',
814
+ ],
815
+ pluginsOpts: {
816
+ 'gjs-blocks-basic': { flexGrid: true },
817
+ 'grapesjs-tui-image-editor': {
818
+ script: [
819
+ // 'https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.6.7/fabric.min.js',
820
+ 'https://uicdn.toast.com/tui.code-snippet/v1.5.2/tui-code-snippet.min.js',
821
+ 'https://uicdn.toast.com/tui-color-picker/v2.2.7/tui-color-picker.min.js',
822
+ 'https://uicdn.toast.com/tui-image-editor/v3.15.2/tui-image-editor.min.js'
823
+ ],
824
+ style: [
825
+ 'https://uicdn.toast.com/tui-color-picker/v2.2.7/tui-color-picker.min.css',
826
+ 'https://uicdn.toast.com/tui-image-editor/v3.15.2/tui-image-editor.min.css',
827
+ ],
828
+ },
829
+ 'grapesjs-tabs': {
830
+ tabsBlock: { category: 'Extra' }
831
+ },
832
+ 'grapesjs-typed': {
833
+ block: {
834
+ category: 'Extra',
835
+ content: {
836
+ type: 'typed',
837
+ 'type-speed': 40,
838
+ strings: [
839
+ 'Text row one',
840
+ 'Text row two',
841
+ 'Text row three',
842
+ ],
843
+ }
844
+ }
845
+ },
846
+ 'grapesjs-preset-webpage': {
847
+ showStylesOnChange: 0,
848
+ modalImportTitle: 'Import Template',
849
+ modalImportLabel: '<div style="margin-bottom: 10px; font-size: 13px;">Paste here your HTML/CSS and click Import</div>',
850
+ modalImportContent: function (editor) {
851
+ return editor.getHtml() + '<style>' + editor.getCss() + '</style>'
852
+ },
853
+ },
854
+ 'grapesjs-code-editor': {
855
+ blockPage: block
856
+ }
857
+ },
858
+ });
859
+
860
+ editor.I18n.addMessages({
861
+ en: {
862
+ styleManager: {
863
+ properties: {
864
+ 'background-repeat': 'Repeat',
865
+ 'background-position': 'Position',
866
+ 'background-attachment': 'Attachment',
867
+ 'background-size': 'Size',
868
+ }
869
+ },
870
+ }
871
+ });
872
+
873
+ var pn = editor.Panels;
874
+ var modal = editor.Modal;
875
+ var cmdm = editor.Commands;
876
+
877
+ // Update canvas-clear command
878
+ cmdm.add('canvas-clear', function () {
879
+ if (confirm('Are you sure to clean the canvas?')) {
880
+ editor.runCommand('core:canvas-clear')
881
+ setTimeout(function () { localStorage.clear() }, 0)
882
+ }
883
+ });
884
+
885
+ // Add info command
886
+ var mdlClass = 'gjs-mdl-dialog-sm';
887
+ var infoContainer = document.getElementById('info-panel');
888
+
889
+ cmdm.add('open-info', function () {
890
+ var mdlDialog = document.querySelector('.gjs-mdl-dialog');
891
+ mdlDialog.className += ' ' + mdlClass;
892
+ infoContainer.style.display = 'block';
893
+ modal.setTitle('About this demo');
894
+ modal.setContent(infoContainer);
895
+ modal.open();
896
+ modal.getModel().once('change:open', function () {
897
+ mdlDialog.className = mdlDialog.className.replace(mdlClass, '');
898
+ })
899
+ });
900
+
901
+ pn.addButton('options', {
902
+ id: 'open-info',
903
+ className: 'fa fa-question-circle',
904
+ command: function () { editor.runCommand('open-info') },
905
+ attributes: {
906
+ 'title': 'About',
907
+ 'data-tooltip-pos': 'bottom',
908
+ },
909
+ });
910
+
911
+
912
+
913
+ // Add and beautify tooltips
914
+ [['sw-visibility', 'Show Borders'], ['preview', 'Preview'], ['fullscreen', 'Fullscreen'],
915
+ ['export-template', 'Export'], ['undo', 'Undo'], ['redo', 'Redo'],
916
+ ['gjs-open-import-webpage', 'Import'], ['canvas-clear', 'Clear canvas']]
917
+ .forEach(function (item) {
918
+ pn.getButton('options', item[0]).set('attributes', { title: item[1], 'data-tooltip-pos': 'bottom' });
919
+ });
920
+ [['open-sm', 'Style Manager'], ['open-layers', 'Layers'], ['open-blocks', 'Blocks']]
921
+ .forEach(function (item) {
922
+ pn.getButton('views', item[0]).set('attributes', { title: item[1], 'data-tooltip-pos': 'bottom' });
923
+ });
924
+
925
+
926
+
927
+
928
+
929
+ // Do stuff on load
930
+ editor.on('load', function () {
931
+ var $ = grapesjs.$;
932
+
933
+ // Show borders by default
934
+ pn.getButton('options', 'sw-visibility').set('active', 1);
935
+
936
+ // Show logo with the version
937
+
938
+ // Load and show settings and style manager
939
+ var openTmBtn = pn.getButton('views', 'open-tm');
940
+ openTmBtn && openTmBtn.set('active', 1);
941
+ var openSm = pn.getButton('views', 'open-sm');
942
+ openSm && openSm.set('active', 1);
943
+
944
+ // Remove trait view
945
+ pn.removeButton('views', 'open-tm');
946
+
947
+ // Add Settings Sector
948
+ var traitsSector = $('<div class="gjs-sm-sector no-select">' +
949
+ '<div class="gjs-sm-sector-title"><span class="icon-settings fa fa-cog"></span> <span class="gjs-sm-sector-label">Settings</span></div>' +
950
+ '<div class="gjs-sm-properties" style="display: none;"></div></div>');
951
+ var traitsProps = traitsSector.find('.gjs-sm-properties');
952
+ traitsProps.append($('.gjs-trt-traits'));
953
+ $('.gjs-sm-sectors').before(traitsSector);
954
+ traitsSector.find('.gjs-sm-sector-title').on('click', function () {
955
+ var traitStyle = traitsProps.get(0).style;
956
+ var hidden = traitStyle.display == 'none';
957
+ if (hidden) {
958
+ traitStyle.display = 'block';
959
+ } else {
960
+ traitStyle.display = 'none';
961
+ }
962
+ });
963
+
964
+ // Open block manager
965
+ var openBlocksBtn = editor.Panels.getButton('views', 'open-blocks');
966
+ openBlocksBtn && openBlocksBtn.set('active', 1);
967
+
968
+ editor.on('component:selected', (a) => {
969
+ const btnOpenCode = editor.Panels.getButton('views', 'code-editor');
970
+ if (!btnOpenCode.active) {
971
+ const openSmBtn = editor.Panels.getButton('views', 'open-sm');
972
+ openSmBtn.set('active', true);
973
+ }
974
+ });
975
+
976
+ });
977
+ </script>
978
+ </body>
979
+
980
+ </html>