@innovastudio/contentbuilder 1.0.49 → 1.0.53
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.
- package/README.md +326 -92
- package/package.json +1 -1
- package/public/contentbuilder/contentbuilder.css +1 -0
- package/public/contentbuilder/contentbuilder.esm.js +82 -49
- package/public/contentbuilder/contentbuilder.min.js +2 -2
- package/public/contentbuilder/plugins/buttoneditor/plugin.js +2 -0
- package/public/contentbuilder/plugins/helloworld/plugin.js +1 -0
- package/public/contentbuilder/plugins/preview/plugin.js +40 -13
- package/public/contentbuilder/plugins/searchreplace/plugin.js +2 -0
- package/public/contentbuilder/plugins/showgrid/plugin.js +1 -0
- package/public/contentbuilder/plugins/symbols/plugin.js +1 -0
- package/public/contentbuilder/plugins/wordcount/plugin.js +1 -0
- package/readme.txt +5 -1
package/README.md
CHANGED
|
@@ -59,8 +59,6 @@ let html = builder.html();
|
|
|
59
59
|
```
|
|
60
60
|
Then you can do anything with the html, for example, posting it to the server for saving, etc.
|
|
61
61
|
|
|
62
|
-
Note that to run ContentBuilder.js, some assets (in assets/ folder) are needed, eg. for snippets, etc.
|
|
63
|
-
|
|
64
62
|
### Examples (HTML, PHP, React, Vue)
|
|
65
63
|
|
|
66
64
|
ContentBuilder.js is written in pure Javascript (ES6) so you can use it in most situations. Sample use in simple HTML, PHP, React and Vue projects are included.
|
|
@@ -98,7 +96,7 @@ Snippet dialog opened.
|
|
|
98
96
|
|
|
99
97
|
Snippet files are located in the folder:
|
|
100
98
|
|
|
101
|
-
assets/minimalist-blocks
|
|
99
|
+
**assets/minimalist-blocks/**
|
|
102
100
|
|
|
103
101
|
It contains:
|
|
104
102
|
- content.js (snippets file)
|
|
@@ -114,7 +112,7 @@ const builder = new ContentBuilder({
|
|
|
114
112
|
snippetPath: 'assets/minimalist-blocks/', // Location of snippets' assets
|
|
115
113
|
});
|
|
116
114
|
```
|
|
117
|
-
In case of a different location, path adjustment may be needed. Here you can use the snippetPathReplace parameter.
|
|
115
|
+
In case of a different location, path adjustment may be needed. Here you can use the **snippetPathReplace** parameter.
|
|
118
116
|
|
|
119
117
|
Example:
|
|
120
118
|
|
|
@@ -125,8 +123,8 @@ const builder = new ContentBuilder({
|
|
|
125
123
|
...
|
|
126
124
|
});
|
|
127
125
|
```
|
|
128
|
-
In this example, the default location is changed to mycustomfolder/assets/minimalist-blocks/
|
|
129
126
|
|
|
127
|
+
In this example, the default location is changed to **mycustomfolder/assets/minimalist-blocks/**
|
|
130
128
|
|
|
131
129
|
## Snippet Side Panel
|
|
132
130
|
|
|
@@ -148,7 +146,7 @@ Or load it programmatically:
|
|
|
148
146
|
builder.loadSnippets('assets/minimalist-blocks/content.js');
|
|
149
147
|
```
|
|
150
148
|
|
|
151
|
-
###
|
|
149
|
+
### Configuration
|
|
152
150
|
|
|
153
151
|
Here are some options to configure the snippet side panel:
|
|
154
152
|
|
|
@@ -164,7 +162,7 @@ The default placement is 'right'. If set to 'left', the placement will be on the
|
|
|
164
162
|
|
|
165
163
|

|
|
166
164
|
|
|
167
|
-
####
|
|
165
|
+
#### Open on the first load
|
|
168
166
|
|
|
169
167
|
By default, the snippet side panel is closed. To open it on the first load:
|
|
170
168
|
|
|
@@ -227,7 +225,7 @@ You can enable the Snippet button on the toolbar for quick access to the snippet
|
|
|
227
225
|
|
|
228
226
|

|
|
229
227
|
|
|
230
|
-
|
|
228
|
+
Here you can open the Snippet dialog from the toolbar by clicking the (+) button.
|
|
231
229
|
|
|
232
230
|
To enable the button:
|
|
233
231
|
|
|
@@ -252,7 +250,7 @@ builder.viewSnippets()
|
|
|
252
250
|
|
|
253
251
|
With the Language file, you can translate the ContentBuilder.js interface into another language.
|
|
254
252
|
|
|
255
|
-
The
|
|
253
|
+
The provided language files:
|
|
256
254
|
|
|
257
255
|
- contentbuilder/lang/en.js
|
|
258
256
|
- contentbuilder/lang/en.js
|
|
@@ -281,7 +279,7 @@ You can create your own language file by copying/modifying this file.
|
|
|
281
279
|
ContentBuilder.js allows you to insert icons. Some snippets are designed using icons as well.
|
|
282
280
|
Icons are located in the assets folder:
|
|
283
281
|
|
|
284
|
-
assets/ionicons
|
|
282
|
+
**assets/ionicons/**
|
|
285
283
|
|
|
286
284
|
You can see the icons that are imported in the snippet css file (assets/minimalist-blocks/content.css):
|
|
287
285
|
|
|
@@ -300,49 +298,46 @@ const builder = new ContentBuilder({
|
|
|
300
298
|
});
|
|
301
299
|
```
|
|
302
300
|
|
|
303
|
-
## Custom File/
|
|
301
|
+
## Custom File/Media Browser or Asset Manager Support
|
|
304
302
|
|
|
305
|
-
You can specify your own custom file/
|
|
303
|
+
You can specify your own custom file/media browser (or Asset Manager) to work with ContentBuilder.js.
|
|
306
304
|
|
|
307
|
-
As an example, a simple file/
|
|
305
|
+
As an example, a simple file/media browser is provided with some sample images or videos that you can select and insert into your content.
|
|
308
306
|
|
|
309
|
-
To configure
|
|
307
|
+
To configure:
|
|
310
308
|
|
|
311
309
|
```javascript
|
|
312
310
|
const builder = new ContentBuilder({
|
|
313
311
|
container: '.container',
|
|
314
|
-
imageSelect: '
|
|
315
|
-
fileSelect: '
|
|
312
|
+
imageSelect: 'assets.html',
|
|
313
|
+
fileSelect: 'assets.html',
|
|
314
|
+
videoSelect: 'assets.html'
|
|
316
315
|
});
|
|
317
316
|
```
|
|
318
317
|
|
|
319
|
-
To try, click the link icon on a selected image to open the image dialog.
|
|
318
|
+
To try, click the link icon (1) on a selected image to open the image dialog. On the image dialog, you see a browse button displayed (2).
|
|
320
319
|
|
|
321
320
|

|
|
322
321
|
|
|
323
|
-
Click the browse button to open the
|
|
322
|
+
Click the browse button to open the file/media browser as specified (assets.html).
|
|
324
323
|
|
|
325
324
|

|
|
326
325
|
|
|
327
326
|
Then you can select an image.
|
|
328
327
|
|
|
329
|
-
|
|
328
|
+
The file/media browser can also be opened from the link dialog and video settings dialog.
|
|
330
329
|
|
|
331
330
|

|
|
332
331
|
|
|
333
|
-
Click the browse button to open the file browser as specified (
|
|
332
|
+
Click the browse button to open the file/media browser as specified (the assets.html).
|
|
334
333
|
|
|
335
334
|

|
|
336
335
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
Please see images.html and files.html if you want to create your own file/image browser.
|
|
340
|
-
Use the **selectImage()** or **selectFile()** function as shown in images.html and files.html to work with ContentBuilder.js.
|
|
341
|
-
So when you select a file or image, the url will be returned to ContentBuilder.js.
|
|
336
|
+
Please see assets.html if you want to create your own file/image browser. Use the **selectAsset()** function as shown in assets.html to work with ContentBuilder.js. So when you select a file or image, the url will be returned to ContentBuilder.js.
|
|
342
337
|
|
|
343
338
|
#### Using Custom Function
|
|
344
339
|
|
|
345
|
-
You can replace the **imageSelect** and **
|
|
340
|
+
You can replace the **imageSelect**, **fileSelect** and **videoSelect** parameters with the **onImageSelectClick**, **onFileSelectClick** and **onVideoSelectClick** parameters that will run your own custom function.
|
|
346
341
|
|
|
347
342
|
Example:
|
|
348
343
|
|
|
@@ -351,6 +346,7 @@ const builder = new ContentBuilder({
|
|
|
351
346
|
container: '.container',
|
|
352
347
|
onImageSelectClick: function () { ... },
|
|
353
348
|
onFileSelectClick: function () { ... },
|
|
349
|
+
onVideoSelectClick: function () { ... },
|
|
354
350
|
});
|
|
355
351
|
```
|
|
356
352
|
|
|
@@ -386,7 +382,7 @@ builder.saveImages('saveimage.php', function(){
|
|
|
386
382
|
});
|
|
387
383
|
```
|
|
388
384
|
|
|
389
|
-
Here you
|
|
385
|
+
Here you specify a server side handler (**saveimage.php**) that performs the file saving on the server.
|
|
390
386
|
|
|
391
387
|
File saving on the server is not part of ContentBuilder.js and depends on your server environment.
|
|
392
388
|
As examples, you can use the provided handler:
|
|
@@ -448,13 +444,13 @@ app.post('/upload', (req, res) => {
|
|
|
448
444
|
|
|
449
445
|
Example use of the AJAX post method can be seen on:
|
|
450
446
|
- React Example (react-contentbuilder folder, please see src/components/contentbuilder/buildercontrol.jsx)
|
|
451
|
-
-
|
|
447
|
+
- Vue Example (vue-contentbuilder folder, please see src/components/Editable.vue)
|
|
452
448
|
|
|
453
|
-
###
|
|
449
|
+
### Configuration
|
|
454
450
|
|
|
455
451
|
Here are some options you can set to configure the image embed functionality:
|
|
456
452
|
|
|
457
|
-
#### Image
|
|
453
|
+
#### Image Quality
|
|
458
454
|
|
|
459
455
|
```javascript
|
|
460
456
|
const builder = new ContentBuilder({
|
|
@@ -463,7 +459,7 @@ const builder = new ContentBuilder({
|
|
|
463
459
|
});
|
|
464
460
|
```
|
|
465
461
|
|
|
466
|
-
#### Maximum
|
|
462
|
+
#### Maximum Width
|
|
467
463
|
|
|
468
464
|
```javascript
|
|
469
465
|
const builder = new ContentBuilder({
|
|
@@ -473,7 +469,7 @@ const builder = new ContentBuilder({
|
|
|
473
469
|
```
|
|
474
470
|
If maxEmbedImageWidth is set to -1, then no maximum width will be applied (will use original image width).
|
|
475
471
|
|
|
476
|
-
#### Enable/
|
|
472
|
+
#### Enable/Disable Embed Image Feature
|
|
477
473
|
|
|
478
474
|
```javascript
|
|
479
475
|
const builder = new ContentBuilder({
|
|
@@ -485,7 +481,7 @@ If imageEmbed is set to false, the browse image button will not be displayed as
|
|
|
485
481
|
|
|
486
482
|

|
|
487
483
|
|
|
488
|
-
#### Using
|
|
484
|
+
#### Using Custom Function on Browse Image Click
|
|
489
485
|
|
|
490
486
|
```javascript
|
|
491
487
|
const builder = new ContentBuilder({
|
|
@@ -498,7 +494,7 @@ The function will be called when the browse image button is clicked.
|
|
|
498
494
|
|
|
499
495
|

|
|
500
496
|
|
|
501
|
-
#### Using
|
|
497
|
+
#### Using Custom Function on Image Link/Settings Click
|
|
502
498
|
|
|
503
499
|
```javascript
|
|
504
500
|
const builder = new ContentBuilder({
|
|
@@ -524,14 +520,14 @@ There are 2 ways to enable the button:
|
|
|
524
520
|
|
|
525
521
|
#### 1. Using Form Method
|
|
526
522
|
|
|
527
|
-
Use the **largerImageHandler** parameter.
|
|
523
|
+
Use the **mediaHandler** parameter. You can also use the **largerImageHandler** parameter (previous version) which is the same and still works.
|
|
528
524
|
|
|
529
525
|
Example:
|
|
530
526
|
|
|
531
527
|
```javascript
|
|
532
528
|
const builder = new ContentBuilder({
|
|
533
529
|
container: '.container',
|
|
534
|
-
|
|
530
|
+
mediaHandler: 'savemedia.php' // or savemedia.ashx if you're using ASP.NET
|
|
535
531
|
});
|
|
536
532
|
```
|
|
537
533
|
|
|
@@ -539,58 +535,127 @@ Here you specify a server side handler for uploading files.
|
|
|
539
535
|
|
|
540
536
|
As examples, you can use the provided handler:
|
|
541
537
|
|
|
542
|
-
-
|
|
543
|
-
-
|
|
538
|
+
- savemedia.php (for PHP)
|
|
539
|
+
- savemedia.ashx (for ASP.NET)
|
|
544
540
|
|
|
545
|
-
By default, images are saved in the upload
|
|
541
|
+
By default, images are saved in the **upload/** folder. You can change the upload folder by editing **savemedia.php** or **savemedia.aspx**.
|
|
546
542
|
|
|
547
543
|
#### 2. Using AJAX Post Method
|
|
548
544
|
|
|
549
|
-
Use the **onLargerImageUpload** parameter.
|
|
545
|
+
Use the **onMediaUpload** parameter. You can also use the **onLargerImageUpload** parameter (previous version) which is the same and still works.
|
|
550
546
|
|
|
551
547
|
Example:
|
|
552
548
|
|
|
553
549
|
```javascript
|
|
554
550
|
const builder = new ContentBuilder({
|
|
555
551
|
container: '.container',
|
|
556
|
-
|
|
552
|
+
onMediaUpload: (e)=>{
|
|
557
553
|
|
|
558
|
-
const
|
|
559
|
-
const filename =
|
|
554
|
+
const selectedFile = e.target.files[0];
|
|
555
|
+
const filename = selectedFile.name;
|
|
560
556
|
const reader = new FileReader();
|
|
561
557
|
reader.onload = (e) => {
|
|
562
558
|
let base64 = e.target.result;
|
|
563
|
-
base64 = base64.replace(/^data:
|
|
559
|
+
base64 = base64.replace(/^data:(.*?);base64,/, "");
|
|
560
|
+
base64 = base64.replace(/ /g, '+');
|
|
564
561
|
|
|
565
|
-
// Upload
|
|
566
|
-
axios.post(
|
|
562
|
+
// Upload process using axios (https://github.com/axios/axios)
|
|
563
|
+
axios.post('upload/', { image: base64, filename: filename }).then((response)=>{
|
|
567
564
|
|
|
568
|
-
const
|
|
569
|
-
builder.
|
|
565
|
+
const uploadedFileUrl = response.data.url; // get saved file url
|
|
566
|
+
builder.returnUrl(uploadedFileUrl); // return the url
|
|
570
567
|
|
|
571
568
|
}).catch((err)=>{
|
|
572
569
|
console.log(err)
|
|
573
570
|
});
|
|
574
571
|
}
|
|
575
|
-
reader.readAsDataURL(
|
|
572
|
+
reader.readAsDataURL(selectedFile);
|
|
576
573
|
|
|
577
574
|
}
|
|
578
575
|
});
|
|
579
576
|
```
|
|
580
577
|
|
|
581
|
-
The example above uses the **
|
|
578
|
+
The example above uses the **returnUrl(url)** method to apply the uploaded image url back to the image dialog. You can also use the **applyLargerImage** parameter (previous version) which is the same and still works.
|
|
582
579
|
|
|
583
580
|
Working examples can be seen on the React & Vue examples:
|
|
584
581
|
- React Example (react-contentbuilder folder, please see src/components/contentbuilder/buildercontrol.jsx)
|
|
585
582
|
- Vue Example (vue-contentbuilder folder, please see src/components/Editable.vue)
|
|
586
583
|
|
|
584
|
+
## Video Upload from the Video Dialog
|
|
585
|
+
|
|
586
|
+
A browse local video button can be enabled on the video dialog. This can be used to select and upload video (mp4 file) to the server.
|
|
587
|
+
|
|
588
|
+

|
|
589
|
+
|
|
590
|
+

|
|
591
|
+
|
|
592
|
+
There are 2 ways to enable the button:
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
#### 1. Using Form Method
|
|
596
|
+
|
|
597
|
+
Use the **videoHandler** parameter.
|
|
598
|
+
|
|
599
|
+
Example:
|
|
600
|
+
|
|
601
|
+
```javascript
|
|
602
|
+
const builder = new ContentBuilder({
|
|
603
|
+
container: '.container',
|
|
604
|
+
videoHandler: 'savemedia.php' // or savemedia.ashx if you're using ASP.NET
|
|
605
|
+
});
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
Here you specify a server side handler for uploading files.
|
|
609
|
+
|
|
610
|
+
As examples, you can use the provided handler:
|
|
611
|
+
|
|
612
|
+
- savemedia.php (for PHP)
|
|
613
|
+
- savemedia.ashx (for ASP.NET)
|
|
614
|
+
|
|
615
|
+
By default, videos are saved in the **upload/** folder. You can change the upload folder by editing **savemedia.php** or **savemedia.aspx**.
|
|
616
|
+
|
|
617
|
+
#### 2. Using AJAX Post Method
|
|
618
|
+
|
|
619
|
+
Use the **onVideoUpload** parameter.
|
|
620
|
+
|
|
621
|
+
Example:
|
|
622
|
+
|
|
623
|
+
```javascript
|
|
624
|
+
const builder = new ContentBuilder({
|
|
625
|
+
container: '.container',
|
|
626
|
+
onVideoUpload: (e)=>{
|
|
627
|
+
|
|
628
|
+
const selectedFile = e.target.files[0];
|
|
629
|
+
const filename = selectedFile.name;
|
|
630
|
+
const reader = new FileReader();
|
|
631
|
+
reader.onload = (e) => {
|
|
632
|
+
let base64 = e.target.result;
|
|
633
|
+
base64 = base64.replace(/^data:(.*?);base64,/, "");
|
|
634
|
+
base64 = base64.replace(/ /g, '+');
|
|
635
|
+
|
|
636
|
+
// Upload process using axios (https://github.com/axios/axios)
|
|
637
|
+
axios.post('upload/', { image: base64, filename: filename }).then((response)=>{
|
|
638
|
+
|
|
639
|
+
const uploadedFileUrl = response.data.url; // get saved file url
|
|
640
|
+
builder.returnUrl(uploadedFileUrl); // return the url
|
|
641
|
+
|
|
642
|
+
}).catch((err)=>{
|
|
643
|
+
console.log(err)
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
reader.readAsDataURL(selectedFile);
|
|
647
|
+
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
```
|
|
651
|
+
|
|
587
652
|
## Plugins
|
|
588
653
|
|
|
589
654
|
With plugins, you can extend the ContentBuilder.js features. A plugin can add an additional button into the ContentBuilder.js toolbar. For example, a 'wordcount' plugin adds a button in the toolbar and when clicked, a dialog showing the word count info will be diplayed.
|
|
590
655
|
|
|
591
656
|

|
|
592
657
|
|
|
593
|
-
Plugin scripts are located in the plugins
|
|
658
|
+
Plugin scripts are located in the **plugins/** folder inside **contentbuilder/**.
|
|
594
659
|
|
|
595
660
|
You will see the folder containing some prebuilt plugins:
|
|
596
661
|
- contentbuilder/plugins/buttoneditor
|
|
@@ -643,10 +708,10 @@ Here the Symbol button is not displayed on the element editing toolbar:
|
|
|
643
708
|
|
|
644
709
|
An alternative way to load the plugins is by using a configuration file:
|
|
645
710
|
|
|
646
|
-
contentbuilder/config.js
|
|
711
|
+
**contentbuilder/config.js**
|
|
647
712
|
|
|
648
713
|
If the plugins parameter is not set during initialization (as in the above example), ContentBuilder.js will automatically load this configuration file.
|
|
649
|
-
Sample configuration in config.js
|
|
714
|
+
Sample configuration in **config.js**:
|
|
650
715
|
|
|
651
716
|
```javascript
|
|
652
717
|
_cb.settings.plugins = [
|
|
@@ -692,29 +757,15 @@ https://innovastudio.com/content-builder/module-development.aspx
|
|
|
692
757
|
|
|
693
758
|
Note that module files are located in:
|
|
694
759
|
|
|
695
|
-
assets/modules
|
|
696
|
-
|
|
697
|
-
You will see there are some prebuilt modules in the examples/reference folder (please see the above guide for details).
|
|
698
|
-
|
|
699
|
-
If you want to change the location of the module files, please use the **modulePath** parameter:
|
|
700
|
-
|
|
701
|
-
```javascript
|
|
702
|
-
const builder = new ContentBuilder({
|
|
703
|
-
container: '.is-container',
|
|
704
|
-
modulePath: 'assets/modules/',
|
|
705
|
-
});
|
|
706
|
-
```
|
|
707
|
-
|
|
708
|
-
In case your module uses Javascript libraries, you can place them in:
|
|
709
|
-
|
|
710
|
-
assets/scripts/
|
|
760
|
+
**assets/modules/**
|
|
711
761
|
|
|
762
|
+
You will see there are some prebuilt modules in the folder (please see the above guide for details).
|
|
712
763
|
|
|
713
764
|
## Your Own Snippets
|
|
714
765
|
|
|
715
766
|
You can create or add your own snippets by customizing the snippet file:
|
|
716
767
|
|
|
717
|
-
assets/minimalist-blocks/content.js
|
|
768
|
+
**assets/minimalist-blocks/content.js**
|
|
718
769
|
|
|
719
770
|
The snippet file is JSON formatted.
|
|
720
771
|
|
|
@@ -735,7 +786,9 @@ Here is an example of a snippet definition in the snippet file:
|
|
|
735
786
|
|
|
736
787
|
A snippet needs to have a thumbnail, category number and HTML content.
|
|
737
788
|
|
|
738
|
-
Thumbnails are created & stored in the preview
|
|
789
|
+
Thumbnails are created & stored in the **preview/** folder:
|
|
790
|
+
|
|
791
|
+
**assets/minimalist-blocks/preview/**
|
|
739
792
|
|
|
740
793
|
Snippet categories you can use:
|
|
741
794
|
|
|
@@ -819,16 +872,134 @@ Four columns:
|
|
|
819
872
|
</div>
|
|
820
873
|
```
|
|
821
874
|
|
|
822
|
-
|
|
823
|
-
|
|
875
|
+
Five columns:
|
|
876
|
+
|
|
877
|
+
```html
|
|
878
|
+
<div class="row clearfix">
|
|
879
|
+
<div class="column fifth">
|
|
880
|
+
...
|
|
881
|
+
</div>
|
|
882
|
+
<div class="column fifth">
|
|
883
|
+
...
|
|
884
|
+
</div>
|
|
885
|
+
<div class="column fifth">
|
|
886
|
+
...
|
|
887
|
+
</div>
|
|
888
|
+
<div class="column fifth">
|
|
889
|
+
...
|
|
890
|
+
</div>
|
|
891
|
+
<div class="column fifth">
|
|
892
|
+
...
|
|
893
|
+
</div>
|
|
894
|
+
</div>
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
Six columns:
|
|
898
|
+
|
|
899
|
+
```html
|
|
900
|
+
<div class="row clearfix">
|
|
901
|
+
<div class="column sixth">
|
|
902
|
+
...
|
|
903
|
+
</div>
|
|
904
|
+
<div class="column sixth">
|
|
905
|
+
...
|
|
906
|
+
</div>
|
|
907
|
+
<div class="column sixth">
|
|
908
|
+
...
|
|
909
|
+
</div>
|
|
910
|
+
<div class="column sixth">
|
|
911
|
+
...
|
|
912
|
+
</div>
|
|
913
|
+
<div class="column sixth">
|
|
914
|
+
...
|
|
915
|
+
</div>
|
|
916
|
+
<div class="column sixth">
|
|
917
|
+
...
|
|
918
|
+
</div>
|
|
919
|
+
</div>
|
|
920
|
+
```
|
|
921
|
+
|
|
922
|
+
If you are using a css framework, such as Bootstrap or Foundation, this simple grid will be automatically converted to the framework grid you’re using.
|
|
923
|
+
|
|
924
|
+
ContentBuilder.js has default maximum number of columns is set to 4. You can increase this limit by setting:
|
|
925
|
+
|
|
926
|
+
```javascript
|
|
927
|
+
const builder = new ContentBuilder({
|
|
928
|
+
container: '.container',
|
|
929
|
+
maxColumns: 5
|
|
930
|
+
});
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
Other layouts you can use to create your own your snippets:
|
|
934
|
+
|
|
935
|
+
```html
|
|
936
|
+
<div class="row clearfix">
|
|
937
|
+
<div class="column two-third">
|
|
938
|
+
...
|
|
939
|
+
</div>
|
|
940
|
+
<div class="column third">
|
|
941
|
+
...
|
|
942
|
+
</div>
|
|
943
|
+
</div>
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
Result:
|
|
947
|
+
|
|
948
|
+

|
|
949
|
+
|
|
950
|
+
```html
|
|
951
|
+
<div class="row clearfix">
|
|
952
|
+
<div class="column two-fourth">
|
|
953
|
+
...
|
|
954
|
+
</div>
|
|
955
|
+
<div class="column fourth">
|
|
956
|
+
...
|
|
957
|
+
</div>
|
|
958
|
+
</div>
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
Result:
|
|
962
|
+
|
|
963
|
+

|
|
964
|
+
|
|
965
|
+
```html
|
|
966
|
+
<div class="row clearfix">
|
|
967
|
+
<div class="column two-fifth">
|
|
968
|
+
...
|
|
969
|
+
</div>
|
|
970
|
+
<div class="column fifth">
|
|
971
|
+
...
|
|
972
|
+
</div>
|
|
973
|
+
</div>
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
Result:
|
|
977
|
+
|
|
978
|
+

|
|
979
|
+
|
|
980
|
+
```html
|
|
981
|
+
<div class="row clearfix">
|
|
982
|
+
<div class="column two-sixth">
|
|
983
|
+
...
|
|
984
|
+
</div>
|
|
985
|
+
<div class="column sixth">
|
|
986
|
+
...
|
|
987
|
+
</div>
|
|
988
|
+
</div>
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
Result:
|
|
992
|
+
|
|
993
|
+

|
|
994
|
+
|
|
824
995
|
You can also add some behavior in your HTML snippets:
|
|
825
996
|
|
|
826
|
-
- To make an image not replaceable, add the data-fixed attribute to the <img> element, for example:
|
|
997
|
+
- To make an image not replaceable, add the **data-fixed** attribute to the <img> element, for example:
|
|
827
998
|
```html
|
|
828
999
|
<img src=".." data-fixed />
|
|
829
1000
|
```
|
|
830
1001
|
|
|
831
|
-
- To make a column not editable, add the data-noedit attribute to the column, for example:
|
|
1002
|
+
- To make a column not editable, add the **data-noedit** attribute to the column, for example:
|
|
832
1003
|
```html
|
|
833
1004
|
<div class="row clearfix">
|
|
834
1005
|
<div class="column full" data-noedit>
|
|
@@ -837,7 +1008,7 @@ You can also add some behavior in your HTML snippets:
|
|
|
837
1008
|
</div>
|
|
838
1009
|
```
|
|
839
1010
|
|
|
840
|
-
- To make a column not editable and cannot be deleted, moved or duplicated, add the data-protected attribute to the column, for example:
|
|
1011
|
+
- To make a column not editable and cannot be deleted, moved or duplicated, add the **data-protected** attribute to the column, for example:
|
|
841
1012
|
```html
|
|
842
1013
|
<div class="row clearfix">
|
|
843
1014
|
<div class="column full" data-protected>
|
|
@@ -853,7 +1024,9 @@ There are 2 types of configuration:
|
|
|
853
1024
|
|
|
854
1025
|
#### 1. If the framework has 12 columns grid system
|
|
855
1026
|
|
|
856
|
-
Specify the framework classes using the **row** & **cols** parameters.
|
|
1027
|
+
Specify the framework classes using the **row** & **cols** parameters.
|
|
1028
|
+
|
|
1029
|
+
Example:
|
|
857
1030
|
|
|
858
1031
|
Bootstrap Framework:
|
|
859
1032
|
|
|
@@ -879,8 +1052,8 @@ const builder = new ContentBuilder({
|
|
|
879
1052
|
|
|
880
1053
|
Specify two additional parameters: **colequal** & **colsizes**
|
|
881
1054
|
|
|
882
|
-
- colequal
|
|
883
|
-
- colsizes
|
|
1055
|
+
- **colequal**: list of all class combinations that have same width
|
|
1056
|
+
- **colsizes**: list of all class combinations in increment order
|
|
884
1057
|
|
|
885
1058
|
Example:
|
|
886
1059
|
|
|
@@ -1471,13 +1644,13 @@ const builder = new ContentBuilder({
|
|
|
1471
1644
|
['#ffe9e0','light','contentbuilder/themes/light-red.css'],
|
|
1472
1645
|
['#fffae5','light','contentbuilder/themes/light-yellow.css'],
|
|
1473
1646
|
['#ddf3dc','light','contentbuilder/themes/light-green.css'],
|
|
1474
|
-
['#d7f7f1','light','contentbuilder/themes/light-cyan.css'],
|
|
1475
|
-
|
|
1476
1647
|
['#c7ebfd','light','contentbuilder/themes/light-blue2.css'],
|
|
1648
|
+
|
|
1477
1649
|
['#ffd5f2','light','contentbuilder/themes/light-pink2.css'],
|
|
1478
1650
|
['#eadafb','light','contentbuilder/themes/light-purple2.css'],
|
|
1479
1651
|
['#c5d4ff','light','contentbuilder/themes/light-blue3.css'],
|
|
1480
1652
|
['#ffefb1','light','contentbuilder/themes/light-yellow2.css'],
|
|
1653
|
+
['#fefefe','light','contentbuilder/themes/light-gray3.css'],
|
|
1481
1654
|
['#e5e5e5','light','contentbuilder/themes/light-gray2.css'],
|
|
1482
1655
|
['#dadada','light','contentbuilder/themes/light-gray.css'],
|
|
1483
1656
|
|
|
@@ -1704,9 +1877,30 @@ const builder = new ContentBuilder({
|
|
|
1704
1877
|
Note: Use '|' for separator.
|
|
1705
1878
|
|
|
1706
1879
|
**Allowed buttons for the main toolbar**:
|
|
1707
|
-
addsnippet
|
|
1708
|
-
|
|
1709
|
-
|
|
1880
|
+
- addsnippet
|
|
1881
|
+
- bold
|
|
1882
|
+
- italic
|
|
1883
|
+
- underline
|
|
1884
|
+
- formatting
|
|
1885
|
+
- color
|
|
1886
|
+
- removeformat
|
|
1887
|
+
- align
|
|
1888
|
+
- textsettings
|
|
1889
|
+
- createlink
|
|
1890
|
+
- tags
|
|
1891
|
+
- undo
|
|
1892
|
+
- redo
|
|
1893
|
+
- zoom
|
|
1894
|
+
- icon
|
|
1895
|
+
- image
|
|
1896
|
+
- list
|
|
1897
|
+
- font
|
|
1898
|
+
- formatpara
|
|
1899
|
+
- gridtool
|
|
1900
|
+
- html
|
|
1901
|
+
- preferences
|
|
1902
|
+
- more (cannot be used in second row)
|
|
1903
|
+
- plugin buttons (such as: preview, wordcount, searchreplace, symbols)
|
|
1710
1904
|
|
|
1711
1905
|
|
|
1712
1906
|
#### Element Toolbar
|
|
@@ -1717,11 +1911,11 @@ The default element toolbar shows the buttons as seen below:
|
|
|
1717
1911
|
|
|
1718
1912
|

|
|
1719
1913
|
|
|
1720
|
-
|
|
1914
|
+
When you click the … (more) button, a second row of buttons will be displayed:
|
|
1721
1915
|
|
|
1722
1916
|

|
|
1723
1917
|
|
|
1724
|
-
To configure the element toolbar, use the **elementButtons** parameter, and to configure the second
|
|
1918
|
+
To configure the element toolbar, use the **elementButtons** parameter, and to configure the second row buttons, use the **elementButtonsMore** parameter:
|
|
1725
1919
|
|
|
1726
1920
|
```javascript
|
|
1727
1921
|
const builder = new ContentBuilder({
|
|
@@ -1732,9 +1926,19 @@ const builder = new ContentBuilder({
|
|
|
1732
1926
|
```
|
|
1733
1927
|
|
|
1734
1928
|
**Allowed buttons for elementButtons**:
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1929
|
+
- addsnippet
|
|
1930
|
+
- left
|
|
1931
|
+
- center
|
|
1932
|
+
- right
|
|
1933
|
+
- full
|
|
1934
|
+
- gridtool
|
|
1935
|
+
- html
|
|
1936
|
+
- preferences
|
|
1937
|
+
- undo
|
|
1938
|
+
- redo
|
|
1939
|
+
- zoom
|
|
1940
|
+
- more (cannot be used in second row)
|
|
1941
|
+
- plugin buttons (such as: preview, wordcount, searchreplace, symbols)
|
|
1738
1942
|
|
|
1739
1943
|
#### Plugin Buttons
|
|
1740
1944
|
|
|
@@ -1794,6 +1998,23 @@ Here is the result.
|
|
|
1794
1998
|
|
|
1795
1999
|

|
|
1796
2000
|
|
|
2001
|
+
#### Icon Toolbar
|
|
2002
|
+
|
|
2003
|
+
Another toolbar that is used is the icon toolbar which is displayed when an icon is selected.
|
|
2004
|
+
|
|
2005
|
+
The icon toolbar shows the buttons as seen below:
|
|
2006
|
+
|
|
2007
|
+

|
|
2008
|
+
|
|
2009
|
+
To configure the icon toolbar, use the **iconButtons** parameter, and to configure the second row buttons, use the **iconButtonsMore** parameter:
|
|
2010
|
+
|
|
2011
|
+
```javascript
|
|
2012
|
+
const builder = new ContentBuilder({
|
|
2013
|
+
container: '.container',
|
|
2014
|
+
iconButtons: ['icon', 'color','textsettings', 'createLink','|', 'undo', 'redo', 'zoom', 'more'],
|
|
2015
|
+
iconButtonsMore: ['|', 'html', 'preferences'],
|
|
2016
|
+
});
|
|
2017
|
+
```
|
|
1797
2018
|
|
|
1798
2019
|
## Undo & Redo
|
|
1799
2020
|
|
|
@@ -1856,7 +2077,7 @@ builder.destroy();
|
|
|
1856
2077
|
|
|
1857
2078
|
## Flexible Path
|
|
1858
2079
|
|
|
1859
|
-
ContentBuilder.js requires some assets located in the assets
|
|
2080
|
+
ContentBuilder.js requires some assets located in the **assets/** folder. For example, there are icons, optional scripts for module, etc.
|
|
1860
2081
|
|
|
1861
2082
|
If you want to change the location of the assets/ folder, you can change the **assetPath** value:
|
|
1862
2083
|
|
|
@@ -1868,7 +2089,7 @@ const builder = new ContentBuilder({
|
|
|
1868
2089
|
```
|
|
1869
2090
|
The **assetPath** value is required by the icons and optional scripts for module.
|
|
1870
2091
|
|
|
1871
|
-
There are some folders inside the assets
|
|
2092
|
+
There are some folders inside the **assets/** folder:
|
|
1872
2093
|
|
|
1873
2094
|
#### assets/fonts/
|
|
1874
2095
|
This folder contains thumbnails for the font selection. You can change the location of this folder by changing the value of the **fontAssetPath** parameter:
|
|
@@ -1899,7 +2120,7 @@ const builder = new ContentBuilder({
|
|
|
1899
2120
|
});
|
|
1900
2121
|
```
|
|
1901
2122
|
|
|
1902
|
-
Another location you may want to change is the plugins
|
|
2123
|
+
Another location you may want to change is the **plugins/** folder location, which contains plugin-related files.
|
|
1903
2124
|
|
|
1904
2125
|
#### contentbuilder/plugins/
|
|
1905
2126
|
Here you just need to specify the pluginPath parameter with the folder where the plugins/ folder is located. The default value is the contentbuilder/ folder.
|
|
@@ -1911,3 +2132,16 @@ const builder = new ContentBuilder({
|
|
|
1911
2132
|
});
|
|
1912
2133
|
```
|
|
1913
2134
|
|
|
2135
|
+
|
|
2136
|
+
## Credits
|
|
2137
|
+
|
|
2138
|
+
#### Libraries
|
|
2139
|
+
|
|
2140
|
+
- CodeMirror, Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others (MIT license), https://github.com/codemirror/CodeMirror
|
|
2141
|
+
- Cropper.js, Copyright 2015-present Chen Fengyuan (MIT license), https://fengyuanchen.github.io/cropperjs/
|
|
2142
|
+
- Ionicons, Copyright (c) 2015-present Ionic (http://ionic.io/) (MIT license), https://ionic.io/ionicons/v1
|
|
2143
|
+
- js-beautify, Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors (MIT license), https://github.com/beautify-web/js-beautify
|
|
2144
|
+
- Moveable, Copyright (c) 2019 Daybrush (MIT license), https://github.com/daybrush/moveable
|
|
2145
|
+
- Sortable, Copyright (c) 2019 All contributors to Sortable (MIT license), https://github.com/SortableJS/Sortable
|
|
2146
|
+
- Tabler Icons, Copyright (c) 2020 Paweł Kuna (MIT license), https://github.com/tabler/tabler-icons
|
|
2147
|
+
|