@innovastudio/contentbuilder 1.0.32 → 1.0.36
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 +1913 -0
- package/license.txt +80 -0
- package/package.json +40 -19
- package/public/contentbuilder/config.js +8 -0
- package/public/contentbuilder/contentbuilder.css +4284 -0
- package/public/contentbuilder/contentbuilder.esm.js +59529 -0
- package/public/contentbuilder/contentbuilder.min.js +122 -0
- package/public/contentbuilder/lang/en.js +299 -0
- package/public/contentbuilder/lang/fr.js +299 -0
- package/public/contentbuilder/plugins/buttoneditor/images/a.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/b.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/c.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/d.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/e.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/f.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/g.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/h.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/plugin.js +1566 -0
- package/public/contentbuilder/plugins/buttoneditor/readme.txt +7 -0
- package/public/contentbuilder/plugins/helloworld/plugin.js +15 -0
- package/public/contentbuilder/plugins/helloworld/readme.txt +23 -0
- package/public/contentbuilder/plugins/preview/plugin.js +301 -0
- package/public/contentbuilder/plugins/preview/readme.txt +23 -0
- package/public/contentbuilder/plugins/searchreplace/plugin.js +458 -0
- package/public/contentbuilder/plugins/searchreplace/readme.txt +23 -0
- package/public/contentbuilder/plugins/searchreplace/searchreplace.html +264 -0
- package/public/contentbuilder/plugins/showgrid/plugin.js +73 -0
- package/public/contentbuilder/plugins/showgrid/readme.txt +23 -0
- package/public/contentbuilder/plugins/symbols/plugin.js +2876 -0
- package/public/contentbuilder/plugins/symbols/readme.txt +23 -0
- package/public/contentbuilder/plugins/wordcount/plugin.js +75 -0
- package/public/contentbuilder/plugins/wordcount/readme.txt +23 -0
- package/public/contentbuilder/themes/colored-blue.css +1125 -0
- package/public/contentbuilder/themes/colored-blue2.css +1125 -0
- package/public/contentbuilder/themes/colored-blue3.css +1125 -0
- package/public/contentbuilder/themes/colored-blue4.css +1125 -0
- package/public/contentbuilder/themes/colored-blue5.css +1125 -0
- package/public/contentbuilder/themes/colored-blue6.css +1125 -0
- package/public/contentbuilder/themes/colored-blue7.css +1125 -0
- package/public/contentbuilder/themes/colored-blue8.css +1125 -0
- package/public/contentbuilder/themes/colored-dark.css +1125 -0
- package/public/contentbuilder/themes/colored-darkblue.css +1125 -0
- package/public/contentbuilder/themes/colored-gray.css +1125 -0
- package/public/contentbuilder/themes/colored-green.css +1125 -0
- package/public/contentbuilder/themes/colored-green2.css +1125 -0
- package/public/contentbuilder/themes/colored-green3.css +1125 -0
- package/public/contentbuilder/themes/colored-green4.css +1125 -0
- package/public/contentbuilder/themes/colored-green5.css +1125 -0
- package/public/contentbuilder/themes/colored-magenta.css +1125 -0
- package/public/contentbuilder/themes/colored-orange.css +1125 -0
- package/public/contentbuilder/themes/colored-orange2.css +1125 -0
- package/public/contentbuilder/themes/colored-orange3.css +1125 -0
- package/public/contentbuilder/themes/colored-pink.css +1125 -0
- package/public/contentbuilder/themes/colored-pink2.css +1125 -0
- package/public/contentbuilder/themes/colored-pink3.css +1125 -0
- package/public/contentbuilder/themes/colored-pink4.css +1125 -0
- package/public/contentbuilder/themes/colored-purple.css +1125 -0
- package/public/contentbuilder/themes/colored-purple2.css +1125 -0
- package/public/contentbuilder/themes/colored-red.css +1125 -0
- package/public/contentbuilder/themes/colored-red2.css +1125 -0
- package/public/contentbuilder/themes/colored-red3.css +1125 -0
- package/public/contentbuilder/themes/colored-red4.css +1125 -0
- package/public/contentbuilder/themes/colored-red5.css +1125 -0
- package/public/contentbuilder/themes/colored-yellow.css +1125 -0
- package/public/contentbuilder/themes/colored-yellow2.css +1125 -0
- package/public/contentbuilder/themes/dark-blue.css +1125 -0
- package/public/contentbuilder/themes/dark-blue2.css +1125 -0
- package/public/contentbuilder/themes/dark-blue3.css +1125 -0
- package/public/contentbuilder/themes/dark-gray.css +1125 -0
- package/public/contentbuilder/themes/dark-pink.css +1125 -0
- package/public/contentbuilder/themes/dark-purple.css +1125 -0
- package/public/contentbuilder/themes/dark-red.css +1125 -0
- package/public/contentbuilder/themes/dark.css +1124 -0
- package/public/contentbuilder/themes/light-blue.css +1125 -0
- package/public/contentbuilder/themes/light-blue2.css +1125 -0
- package/public/contentbuilder/themes/light-blue3.css +1125 -0
- package/public/contentbuilder/themes/light-cyan.css +1125 -0
- package/public/contentbuilder/themes/light-gray.css +1125 -0
- package/public/contentbuilder/themes/light-gray2.css +1125 -0
- package/public/contentbuilder/themes/light-green.css +1125 -0
- package/public/contentbuilder/themes/light-pink.css +1125 -0
- package/public/contentbuilder/themes/light-pink2.css +1125 -0
- package/public/contentbuilder/themes/light-purple.css +1125 -0
- package/public/contentbuilder/themes/light-purple2.css +1125 -0
- package/public/contentbuilder/themes/light-red.css +1125 -0
- package/public/contentbuilder/themes/light-yellow.css +1125 -0
- package/public/contentbuilder/themes/light-yellow2.css +1125 -0
- package/readme.txt +23 -0
- package/.eslintrc.json +0 -28
- package/lib/contentbuilder.js +0 -46704
- package/rollup.config.js +0 -23
package/README.md
ADDED
|
@@ -0,0 +1,1913 @@
|
|
|
1
|
+
# ContentBuilder.js
|
|
2
|
+
|
|
3
|
+
ContentBuilder.js is a drag & drop HTML editor javascript library. It is the first editor that allows you to build content layout in almost any css grid framework such as Bootstrap, Foundation and more.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Include the main css file:
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<link href="contentbuilder/contentbuilder.css" rel="stylesheet" type="text/css" />
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
and the css file for snippets:
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<link href="assets/minimalist-blocks/content.css" rel="stylesheet" type="text/css" />
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
#### Install as Web Library
|
|
23
|
+
|
|
24
|
+
Include js file:
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<script src="contentbuilder/contentbuilder.min.js" type="text/javascript"></script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### Or Install with NPM
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
npm install @innovastudio/contentbuilder
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then import into your project:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import ContentBuilder from '@innovastudio/contentbuilder';
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<div class="container">
|
|
46
|
+
</div>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
const builder = new ContentBuilder({
|
|
51
|
+
container: '.container'
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
To get the HTML:
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
let html = builder.html();
|
|
59
|
+
```
|
|
60
|
+
Then you can do anything with the html, for example, posting it to the server for saving, etc.
|
|
61
|
+
|
|
62
|
+
Note that to run ContentBuilder.js, some assets (in assets/ folder) are needed, eg. for snippets, etc.
|
|
63
|
+
|
|
64
|
+
### Examples (HTML, PHP, React, Vue)
|
|
65
|
+
|
|
66
|
+
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.
|
|
67
|
+
|
|
68
|
+
React and Vue project examples are provided in separate downloads in the user area.
|
|
69
|
+
|
|
70
|
+
## Folder Structure
|
|
71
|
+
|
|
72
|
+
- public/
|
|
73
|
+
- assets/
|
|
74
|
+
- contentbuilder/
|
|
75
|
+
- uploads/
|
|
76
|
+
- example1.html (HTML example)
|
|
77
|
+
- example2.php (PHP example)
|
|
78
|
+
- example3.html (Multiple editable area example)
|
|
79
|
+
- ...Other examples
|
|
80
|
+
- src/
|
|
81
|
+
- contentbuilder/ (Only provided in Source Code package)
|
|
82
|
+
- scss/ (Only provided in Source Code package)
|
|
83
|
+
- docs/
|
|
84
|
+
- README.md (Documentation)
|
|
85
|
+
- ...
|
|
86
|
+
|
|
87
|
+
## Snippets
|
|
88
|
+
|
|
89
|
+
Snippets are predesigned blocks that you can add or drag & drop into your content.
|
|
90
|
+
|
|
91
|
+
By default, snippets are enabled. When you add a content, please click the **MORE** button to open the snippets dialog.
|
|
92
|
+
|
|
93
|
+

|
|
94
|
+
|
|
95
|
+
Snippet dialog opened.
|
|
96
|
+
|
|
97
|
+

|
|
98
|
+
|
|
99
|
+
Snippet files are located in the folder:
|
|
100
|
+
|
|
101
|
+
assets/minimalist-blocks/
|
|
102
|
+
|
|
103
|
+
It contains:
|
|
104
|
+
- content.js (snippets file)
|
|
105
|
+
- content.css (snippet style)
|
|
106
|
+
- images
|
|
107
|
+
|
|
108
|
+
You can configure the snippets location by setting the **snippetUrl** and **snippetPath** parameters:
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
const builder = new ContentBuilder({
|
|
112
|
+
container: '.container',
|
|
113
|
+
snippetUrl: 'assets/minimalist-blocks/content.js', // Snippet file
|
|
114
|
+
snippetPath: 'assets/minimalist-blocks/', // Location of snippets' assets
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
In case of a different location, path adjustment may be needed. Here you can use the snippetPathReplace parameter.
|
|
118
|
+
|
|
119
|
+
Example:
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
const builder = new ContentBuilder({
|
|
123
|
+
...
|
|
124
|
+
snippetPathReplace: ['assets/minimalist-blocks/', 'mycustomfolder/assets/minimalist-blocks/'],
|
|
125
|
+
...
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
In this example, the default location is changed to mycustomfolder/assets/minimalist-blocks/
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## Snippet Side Panel
|
|
132
|
+
|
|
133
|
+
Snippets can be displayed on a side panel. This allows you to drag & drop snippets into your content.
|
|
134
|
+
|
|
135
|
+

|
|
136
|
+
|
|
137
|
+
By default, this feature is not enabled.
|
|
138
|
+
|
|
139
|
+
To enable this feature, include the snippet file on the page:
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
<script src="assets/minimalist-blocks/content.js" type="text/javascript"></script>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Or load it programmatically:
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
builder.loadSnippets('assets/minimalist-blocks/content.js');
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Snippet Side Panel Configuration
|
|
152
|
+
|
|
153
|
+
Here are some options to configure the snippet side panel:
|
|
154
|
+
|
|
155
|
+
#### Placement
|
|
156
|
+
|
|
157
|
+
```javascript
|
|
158
|
+
const builder = new ContentBuilder({
|
|
159
|
+
container: '.container',
|
|
160
|
+
sidePanel: 'left'
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
The default placement is 'right'. If set to 'left', the placement will be on the left as seen below.
|
|
164
|
+
|
|
165
|
+

|
|
166
|
+
|
|
167
|
+
#### Automatically open snippet side panel on the first load
|
|
168
|
+
|
|
169
|
+
By default, the snippet side panel is closed. To open it on the first load:
|
|
170
|
+
|
|
171
|
+
```javascript
|
|
172
|
+
const builder = new ContentBuilder({
|
|
173
|
+
container: '.container',
|
|
174
|
+
snippetOpen: true
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### Display mode
|
|
179
|
+
|
|
180
|
+
If the snippet side panel is not used (during editing), it will be automatically closed. To make it always visible:
|
|
181
|
+
|
|
182
|
+
```javascript
|
|
183
|
+
const builder = new ContentBuilder({
|
|
184
|
+
container: '.container',
|
|
185
|
+
snippetDisplay: 'visible' // default: auto
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### Snippet Categories
|
|
190
|
+
|
|
191
|
+
Snippets have multiple categories for different purposes. The built-in categories are defined in the **snippetCategories** parameter:
|
|
192
|
+
|
|
193
|
+
```javascript
|
|
194
|
+
const builder = new ContentBuilder({
|
|
195
|
+
container: '.container',
|
|
196
|
+
snippetCategories: [
|
|
197
|
+
[120,'Basic'],
|
|
198
|
+
[118,'Article'],
|
|
199
|
+
[101,'Headline'],
|
|
200
|
+
[119,'Buttons'],
|
|
201
|
+
[102,'Photos'],
|
|
202
|
+
[103,'Profile'],
|
|
203
|
+
[116,'Contact'],
|
|
204
|
+
[104,'Products'],
|
|
205
|
+
[105,'Features'],
|
|
206
|
+
[106,'Process'],
|
|
207
|
+
[107,'Pricing'],
|
|
208
|
+
[108,'Skills'],
|
|
209
|
+
[109,'Achievements'],
|
|
210
|
+
[110,'Quotes'],
|
|
211
|
+
[111,'Partners'],
|
|
212
|
+
[112,'As Featured On'],
|
|
213
|
+
[113,'Page Not Found'],
|
|
214
|
+
[114,'Coming Soon'],
|
|
215
|
+
[115,'Help, FAQ']
|
|
216
|
+
],
|
|
217
|
+
defaultSnippetCategory: 120, // the default category is 'Basic'
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The **defaultSnippetCategory** specifies the category to open on the first load.
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
## Snippet Button
|
|
225
|
+
|
|
226
|
+
You can enable the Snippet button on the toolbar for quick access to the snippets.
|
|
227
|
+
|
|
228
|
+

|
|
229
|
+
|
|
230
|
+
Now you can open the Snippet dialog from the toolbar by clicking the (+) button.
|
|
231
|
+
|
|
232
|
+
To enable the button:
|
|
233
|
+
|
|
234
|
+
```javascript
|
|
235
|
+
const builder = new ContentBuilder({
|
|
236
|
+
container: '.container',
|
|
237
|
+
toolbarAddSnippetButton: true
|
|
238
|
+
});
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Please see the Toolbar section for more customization on the toolbar.
|
|
242
|
+
|
|
243
|
+
#### Programmatically Open Snippet Dialog
|
|
244
|
+
|
|
245
|
+
If needed, you can open the Snippet dialog programmatically by calling the **viewSnippets()** method:
|
|
246
|
+
|
|
247
|
+
```javascript
|
|
248
|
+
builder.viewSnippets()
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Language File
|
|
252
|
+
|
|
253
|
+
With the Language file, you can translate the ContentBuilder.js interface into another language.
|
|
254
|
+
|
|
255
|
+
The files provided language files:
|
|
256
|
+
|
|
257
|
+
- contentbuilder/lang/en.js
|
|
258
|
+
- contentbuilder/lang/en.js
|
|
259
|
+
|
|
260
|
+
To enable the language file, you need to add the file before including ContentBuilder.js:
|
|
261
|
+
|
|
262
|
+
```javascript
|
|
263
|
+
<script src="contentbuilder/lang/en.js" type="text/javascript"></script>
|
|
264
|
+
```
|
|
265
|
+
or
|
|
266
|
+
```javascript
|
|
267
|
+
<script src="contentbuilder/lang/fr.js" type="text/javascript"></script>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Here is the language file content as seen on en.js:
|
|
271
|
+
```javascript
|
|
272
|
+
var _txt = new Array();
|
|
273
|
+
_txt['Bold'] = 'Bold';
|
|
274
|
+
_txt['Italic'] = 'Italic';
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
You can create your own language file by copying/modifying this file.
|
|
278
|
+
|
|
279
|
+
## Icon Support
|
|
280
|
+
|
|
281
|
+
ContentBuilder.js allows you to insert icons. Some snippets are designed using icons as well.
|
|
282
|
+
Icons are located in the assets folder:
|
|
283
|
+
|
|
284
|
+
assets/ionicons/
|
|
285
|
+
|
|
286
|
+
You can see the icons that are imported in the snippet css file (assets/minimalist-blocks/content.css):
|
|
287
|
+
|
|
288
|
+
```css
|
|
289
|
+
@import url("../ionicons/css/ionicons.min.css");
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
You can modify this if you want to change the location of the icons.
|
|
293
|
+
|
|
294
|
+
Note that icons need to be located inside the assets folder. You can change the assets folder location by setting:
|
|
295
|
+
|
|
296
|
+
```javascript
|
|
297
|
+
const builder = new ContentBuilder({
|
|
298
|
+
container: '.container',
|
|
299
|
+
assetPath: 'assets/',
|
|
300
|
+
});
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Custom File/Image Browser or Asset Manager Support
|
|
304
|
+
|
|
305
|
+
You can specify your own custom file/image browser (or Asset Manager) to work with ContentBuilder.js.
|
|
306
|
+
|
|
307
|
+
As an example, a simple file/image browser is provided with some sample images that you can select and insert into your content.
|
|
308
|
+
|
|
309
|
+
To configure, use the imageSelect and fileSelect parameter:
|
|
310
|
+
|
|
311
|
+
```javascript
|
|
312
|
+
const builder = new ContentBuilder({
|
|
313
|
+
container: '.container',
|
|
314
|
+
imageSelect: 'images.html',
|
|
315
|
+
fileSelect: 'files.html'
|
|
316
|
+
});
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
To try, click the link icon on a selected image to open the image dialog. Here you see a browse button displayed.
|
|
320
|
+
|
|
321
|
+

|
|
322
|
+
|
|
323
|
+
Click the browse button to open the image browser as specified (images.html).
|
|
324
|
+
|
|
325
|
+

|
|
326
|
+
|
|
327
|
+
Then you can select an image.
|
|
328
|
+
|
|
329
|
+
To try the file browser, create or edit a link. From the link dialog, you will see a browse button displayed.
|
|
330
|
+
|
|
331
|
+

|
|
332
|
+
|
|
333
|
+
Click the browse button to open the file browser as specified (files.html).
|
|
334
|
+
|
|
335
|
+

|
|
336
|
+
|
|
337
|
+
Then you can select a file.
|
|
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.
|
|
342
|
+
|
|
343
|
+
#### Using Custom Function
|
|
344
|
+
|
|
345
|
+
You can replace the **imageSelect** and **fileSelect** parameters with the **onImageSelectClick** and **onFileSelectClick** parameters that will run your own custom function.
|
|
346
|
+
|
|
347
|
+
Example:
|
|
348
|
+
|
|
349
|
+
```javascript
|
|
350
|
+
const builder = new ContentBuilder({
|
|
351
|
+
container: '.container',
|
|
352
|
+
onImageSelectClick: function () { ... },
|
|
353
|
+
onFileSelectClick: function () { ... },
|
|
354
|
+
});
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Saving Base64 Images
|
|
358
|
+
|
|
359
|
+
When you insert an image or change an embedded image, you will be able to browse the local image file. The selected image will be embedded as a base64 format in your content, so you will see the result immediately without having to wait for the image upload process.
|
|
360
|
+
|
|
361
|
+

|
|
362
|
+
|
|
363
|
+
The embedded image will be:
|
|
364
|
+
|
|
365
|
+
```html
|
|
366
|
+
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAA....">
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
You can save all embedded base64 images to the server by calling the **saveImages()** method.
|
|
370
|
+
Normally, you'd call the **saveImages()** method on your saving implementation. So before saving the HTML content, all embedded images will be saved first on the server (ex. as jpg, png) and all base64 image sources will be replaced (automatically) with the physical image url. Then the HTML content can be saved. This process is made simple by using the **saveImages()** method.
|
|
371
|
+
|
|
372
|
+
There are 2 ways to use the **saveImages()** method:
|
|
373
|
+
|
|
374
|
+
#### 1. Using Form Method
|
|
375
|
+
|
|
376
|
+
Example (if you're using PHP):
|
|
377
|
+
|
|
378
|
+
```javascript
|
|
379
|
+
builder.saveImages('saveimage.php', function(){
|
|
380
|
+
|
|
381
|
+
// Image saving done. Then you can save the content
|
|
382
|
+
let html = builder.html();
|
|
383
|
+
|
|
384
|
+
// ...
|
|
385
|
+
|
|
386
|
+
});
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Here you can specify a server side handler (saveimage.php) that performs the file saving on the server.
|
|
390
|
+
|
|
391
|
+
File saving on the server is not part of ContentBuilder.js and depends on your server environment.
|
|
392
|
+
As examples, you can use the provided handler:
|
|
393
|
+
|
|
394
|
+
- saveimage.php (for PHP)
|
|
395
|
+
- saveimage.ashx (for ASP.NET)
|
|
396
|
+
|
|
397
|
+
Please add your own security handling on these files.
|
|
398
|
+
|
|
399
|
+
To try a working example, please open example2.php.
|
|
400
|
+
|
|
401
|
+
#### 2. Using AJAX Post Method
|
|
402
|
+
|
|
403
|
+
Example (using axios):
|
|
404
|
+
|
|
405
|
+
```javascript
|
|
406
|
+
builder.saveImages('', ()=>{
|
|
407
|
+
|
|
408
|
+
// Image saving done. Then you can save the content
|
|
409
|
+
let html = builder.html();
|
|
410
|
+
|
|
411
|
+
// ...
|
|
412
|
+
|
|
413
|
+
}, (img, base64, filename)=>{
|
|
414
|
+
|
|
415
|
+
// Upload image process
|
|
416
|
+
axios.post('/upload', { image: base64, filename: filename }).then((response)=>{
|
|
417
|
+
|
|
418
|
+
const uploadedImageUrl = response.data.url; // get saved image url
|
|
419
|
+
|
|
420
|
+
img.setAttribute('src', uploadedImageUrl); // automatically replace base64 src with image url
|
|
421
|
+
|
|
422
|
+
}).catch((err)=>{
|
|
423
|
+
console.log(err)
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
});
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
In this example, each image will be sent to an endpoint: /upload
|
|
430
|
+
|
|
431
|
+
If you're using Node.js, you can implement the endpoint to save the images using:
|
|
432
|
+
|
|
433
|
+
```javascript
|
|
434
|
+
var $path = __dirname + '/public/uploads/'; // Physical path
|
|
435
|
+
var $urlpath = 'uploads/'; // URL path
|
|
436
|
+
|
|
437
|
+
app.post('/upload', (req, res) => {
|
|
438
|
+
const base64Data = req.body.image;
|
|
439
|
+
const filename = req.body.filename;
|
|
440
|
+
require("fs").writeFile($path + filename, base64Data, 'base64', ()=>{
|
|
441
|
+
res.status(200).json({
|
|
442
|
+
success: true,
|
|
443
|
+
url: `${$urlpath}${filename}` // return saved image url
|
|
444
|
+
})
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
Example use of the AJAX post method can be seen on:
|
|
450
|
+
- React Example (react-contentbuilder folder, please see src/components/contentbuilder/buildercontrol.jsx)
|
|
451
|
+
- Vuew Example (vue-contentbuilder folder, please see src/components/Editable.vue)
|
|
452
|
+
|
|
453
|
+
### Image Embed Configuration
|
|
454
|
+
|
|
455
|
+
Here are some options you can set to configure the image embed functionality:
|
|
456
|
+
|
|
457
|
+
#### Image quality.
|
|
458
|
+
|
|
459
|
+
```javascript
|
|
460
|
+
const builder = new ContentBuilder({
|
|
461
|
+
container: '.container',
|
|
462
|
+
imageQuality: 0.92,
|
|
463
|
+
});
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
#### Maximum width of the embedded base64 image.
|
|
467
|
+
|
|
468
|
+
```javascript
|
|
469
|
+
const builder = new ContentBuilder({
|
|
470
|
+
container: '.container',
|
|
471
|
+
maxEmbedImageWidth: 1600,
|
|
472
|
+
});
|
|
473
|
+
```
|
|
474
|
+
If maxEmbedImageWidth is set to -1, then no maximum width will be applied (will use original image width).
|
|
475
|
+
|
|
476
|
+
#### Enable/disable embed image feature.
|
|
477
|
+
|
|
478
|
+
```javascript
|
|
479
|
+
const builder = new ContentBuilder({
|
|
480
|
+
container: '.container',
|
|
481
|
+
imageEmbed: false,
|
|
482
|
+
});
|
|
483
|
+
```
|
|
484
|
+
If imageEmbed is set to false, the browse image button will not be displayed as seen below.
|
|
485
|
+
|
|
486
|
+

|
|
487
|
+
|
|
488
|
+
#### Using custom function on browse image click.
|
|
489
|
+
|
|
490
|
+
```javascript
|
|
491
|
+
const builder = new ContentBuilder({
|
|
492
|
+
container: '.container',
|
|
493
|
+
onImageBrowseClick: function() { ... },
|
|
494
|
+
});
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
The function will be called when the browse image button is clicked.
|
|
498
|
+
|
|
499
|
+

|
|
500
|
+
|
|
501
|
+
#### Using custom function image link/settings click.
|
|
502
|
+
|
|
503
|
+
```javascript
|
|
504
|
+
const builder = new ContentBuilder({
|
|
505
|
+
container: '.container',
|
|
506
|
+
onImageSettingClick: function() { ... },
|
|
507
|
+
});
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
The function will be called when the image settings button is clicked.
|
|
511
|
+
|
|
512
|
+

|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
## Image Upload from the Image Dialog
|
|
516
|
+
|
|
517
|
+
A browse local image button can be enabled on the Image dialog. This can be used to select and upload image to the server.
|
|
518
|
+
|
|
519
|
+

|
|
520
|
+
|
|
521
|
+

|
|
522
|
+
|
|
523
|
+
There are 2 ways to enable the button:
|
|
524
|
+
|
|
525
|
+
#### 1. Using Form Method
|
|
526
|
+
|
|
527
|
+
Use the **largerImageHandler** parameter.
|
|
528
|
+
|
|
529
|
+
Example:
|
|
530
|
+
|
|
531
|
+
```javascript
|
|
532
|
+
const builder = new ContentBuilder({
|
|
533
|
+
container: '.container',
|
|
534
|
+
largerImageHandler: 'saveimage-large.php' // or saveimage-large.ashx if you're using ASP.NET
|
|
535
|
+
});
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
Here you specify a server side handler for uploading files.
|
|
539
|
+
|
|
540
|
+
As examples, you can use the provided handler:
|
|
541
|
+
|
|
542
|
+
- saveimage-large.php (for PHP)
|
|
543
|
+
- saveimage-large.ashx (for ASP.NET)
|
|
544
|
+
|
|
545
|
+
By default, images are saved in the upload/ folder. You can change the upload folder by editing saveimage-large.php or saveimage-large.aspx.
|
|
546
|
+
|
|
547
|
+
#### 2. Using AJAX Post Method
|
|
548
|
+
|
|
549
|
+
Use the **onLargerImageUpload** parameter.
|
|
550
|
+
|
|
551
|
+
Example:
|
|
552
|
+
|
|
553
|
+
```javascript
|
|
554
|
+
const builder = new ContentBuilder({
|
|
555
|
+
container: '.container',
|
|
556
|
+
onLargerImageUpload: (e)=>{
|
|
557
|
+
|
|
558
|
+
const selectedImage = e.target.files[0];
|
|
559
|
+
const filename = selectedImage.name;
|
|
560
|
+
const reader = new FileReader();
|
|
561
|
+
reader.onload = (e) => {
|
|
562
|
+
let base64 = e.target.result;
|
|
563
|
+
base64 = base64.replace(/^data:image\/(png|jpeg);base64,/, '');
|
|
564
|
+
|
|
565
|
+
// Upload image process using axios (https://github.com/axios/axios)
|
|
566
|
+
axios.post(props.largerImageHandler, { image: base64, filename: filename }).then((response)=>{
|
|
567
|
+
|
|
568
|
+
const uploadedImageUrl = response.data.url; // get saved image url
|
|
569
|
+
builder.applyLargerImage(uploadedImageUrl); // set input
|
|
570
|
+
|
|
571
|
+
}).catch((err)=>{
|
|
572
|
+
console.log(err)
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
reader.readAsDataURL(selectedImage);
|
|
576
|
+
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
The example above uses the **applyLargerImage(url)** method to apply the uploaded image url back to the image dialog.
|
|
582
|
+
|
|
583
|
+
Working examples can be seen on the React & Vue examples:
|
|
584
|
+
- React Example (react-contentbuilder folder, please see src/components/contentbuilder/buildercontrol.jsx)
|
|
585
|
+
- Vue Example (vue-contentbuilder folder, please see src/components/Editable.vue)
|
|
586
|
+
|
|
587
|
+
## Plugins
|
|
588
|
+
|
|
589
|
+
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
|
+
|
|
591
|
+

|
|
592
|
+
|
|
593
|
+
Plugin scripts are located in the plugins/ folder inside contentbuilder/.
|
|
594
|
+
|
|
595
|
+
You will see the folder containing some prebuilt plugins:
|
|
596
|
+
- contentbuilder/plugins/buttoneditor
|
|
597
|
+
- contentbuilder/plugins/helloworld
|
|
598
|
+
- contentbuilder/plugins/preview
|
|
599
|
+
- contentbuilder/plugins/searchreplace
|
|
600
|
+
- contentbuilder/plugins/showgrid
|
|
601
|
+
- contentbuilder/plugins/symbols
|
|
602
|
+
- contentbuilder/plugins/wordcount
|
|
603
|
+
|
|
604
|
+
To load the plugins, you can configure:
|
|
605
|
+
|
|
606
|
+
```javascript
|
|
607
|
+
const builder = new ContentBuilder({
|
|
608
|
+
container: '.is-container',
|
|
609
|
+
plugins: [
|
|
610
|
+
{ name: 'preview', showInMainToolbar: true, showInElementToolbar: true },
|
|
611
|
+
{ name: 'wordcount', showInMainToolbar: true, showInElementToolbar: true },
|
|
612
|
+
{ name: 'symbols', showInMainToolbar: true, showInElementToolbar: false },
|
|
613
|
+
{ name: 'buttoneditor', showInMainToolbar: false, showInElementToolbar: false },
|
|
614
|
+
],
|
|
615
|
+
pluginPath: 'contentbuilder/',
|
|
616
|
+
});
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
Here we specify the **plugins** and **pluginPath** parameters.
|
|
620
|
+
|
|
621
|
+
The **plugins** parameter accepts list of plugins with configurations:
|
|
622
|
+
- name: name of the plugin (same as the folder name)
|
|
623
|
+
- showInMainToolbar: the plugin will add a button on the main editing toolbar (when text element is selected).
|
|
624
|
+
- showInElementToolbar: the plugin will add a button on the element editing toolbar (when non-text element is selected).
|
|
625
|
+
|
|
626
|
+
The difference between the main editing toolbar and the element editing toolbar is that the main editing toolbar shows when a text element is selected (cursor is placed on text), whereas the element editing toolbar shows when a non-text element is clicked/selected (such as when selecting an image, spacer, etc).
|
|
627
|
+
|
|
628
|
+
Main editing toolbar (text-based):
|
|
629
|
+
|
|
630
|
+

|
|
631
|
+
|
|
632
|
+
Element editing toolbar (non text):
|
|
633
|
+
|
|
634
|
+

|
|
635
|
+
|
|
636
|
+
As seen in the example configuration above:
|
|
637
|
+
- The 'symbols' plugin should display its button only if a text element is selected/clicked. So the **showInMainToolbar** (main editing toolbar) is set to true and **showInElementToolbar** (element editing toolbar) is set to false. Here the Symbol button is displayed on the main editing toolbar:
|
|
638
|
+

|
|
639
|
+
Here the Symbol button is not displayed on the element editing toolbar:
|
|
640
|
+

|
|
641
|
+
- The 'buttoneditor' plugin doesn't add a button on both the main editing toolbar and the alternate editing toolbar, so the **showInMainToolbar** is set to false, and the **showInElementToolbar** is set to false. This is because the plugin is only activated when the link button is clicked. There is no button on the toolbar. Instead, an edit (pencil) icon shows on top of the button.
|
|
642
|
+

|
|
643
|
+
|
|
644
|
+
An alternative way to load the plugins is by using a configuration file:
|
|
645
|
+
|
|
646
|
+
contentbuilder/config.js
|
|
647
|
+
|
|
648
|
+
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:
|
|
650
|
+
|
|
651
|
+
```javascript
|
|
652
|
+
_cb.settings.plugins = [
|
|
653
|
+
{ name: 'preview', showInMainToolbar: true, showInElementToolbar: true },
|
|
654
|
+
{ name: 'wordcount', showInMainToolbar: true, showInElementToolbar: true },
|
|
655
|
+
{ name: 'symbols', showInMainToolbar: true, showInElementToolbar: false },
|
|
656
|
+
{ name: 'buttoneditor', showInMainToolbar: false, showInElementToolbar: false },
|
|
657
|
+
];
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
To disable loading this file, you can set disableConfig to false:
|
|
661
|
+
|
|
662
|
+
```javascript
|
|
663
|
+
const builder = new ContentBuilder({
|
|
664
|
+
container: '.is-container',
|
|
665
|
+
disableConfig: false
|
|
666
|
+
});
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
Note that using an external configuration file is an approach that comes from the previous version of ContentBuilder.js.
|
|
670
|
+
In the previous version, the plugins parameter is configured like this:
|
|
671
|
+
|
|
672
|
+
```javascript
|
|
673
|
+
['preview','wordcount', 'buttoneditor']
|
|
674
|
+
```
|
|
675
|
+
This still works, however we recommend using the new approach (explained above) for future flexibility.
|
|
676
|
+
|
|
677
|
+
#### Plugin Development
|
|
678
|
+
|
|
679
|
+
If you want to create your own plugin, please see this guide:
|
|
680
|
+
|
|
681
|
+
https://innovastudio.com/content-builder/plugin-development.aspx
|
|
682
|
+
|
|
683
|
+
## Modules
|
|
684
|
+
|
|
685
|
+
With modules, you can extend snippets.
|
|
686
|
+
|
|
687
|
+
Normally, snippets are defined as static HTML. With a module snippet (snippet as a module), you can a create dynamic (non-static) snippets for ContentBuilder.js. You can add custom scripts to control the snippet content, create interactive elements and make it configurable via a custom dialog.
|
|
688
|
+
|
|
689
|
+
To create your own module, please see this guide:
|
|
690
|
+
|
|
691
|
+
https://innovastudio.com/content-builder/module-development.aspx
|
|
692
|
+
|
|
693
|
+
Note that module files are located in:
|
|
694
|
+
|
|
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/
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
## Your Own Snippets
|
|
714
|
+
|
|
715
|
+
You can create or add your own snippets by customizing the snippet file:
|
|
716
|
+
|
|
717
|
+
assets/minimalist-blocks/content.js
|
|
718
|
+
|
|
719
|
+
The snippet file is JSON formatted.
|
|
720
|
+
|
|
721
|
+
Here is an example of a snippet definition in the snippet file:
|
|
722
|
+
|
|
723
|
+
```javascript
|
|
724
|
+
{
|
|
725
|
+
'thumbnail': 'preview/basic-01.png',
|
|
726
|
+
'category': '120',
|
|
727
|
+
'html':
|
|
728
|
+
'<div class="row clearfix">' +
|
|
729
|
+
'<div class="column full">' +
|
|
730
|
+
'<h1>My Heading Text</h1>' +
|
|
731
|
+
'</div>' +
|
|
732
|
+
'</div>'
|
|
733
|
+
}
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
A snippet needs to have a thumbnail, category number and HTML content.
|
|
737
|
+
|
|
738
|
+
Thumbnails are created & stored in the preview/ folder.
|
|
739
|
+
|
|
740
|
+
Snippet categories you can use:
|
|
741
|
+
|
|
742
|
+
- 120: Basic
|
|
743
|
+
- 118: Article
|
|
744
|
+
- 101: Headline
|
|
745
|
+
- 119: Buttons
|
|
746
|
+
- 102: Photos
|
|
747
|
+
- 103: Profile
|
|
748
|
+
- 116: Contact
|
|
749
|
+
- 104: Products
|
|
750
|
+
- 105: Features
|
|
751
|
+
- 106: Process
|
|
752
|
+
- 107: Pricing
|
|
753
|
+
- 108: Skills
|
|
754
|
+
- 109: Achievements
|
|
755
|
+
- 110: Quotes
|
|
756
|
+
- 111: Partners
|
|
757
|
+
- 112: As Featured On
|
|
758
|
+
- 113: Page Not Found
|
|
759
|
+
- 114: Coming Soon
|
|
760
|
+
- 115: Help, FAQ
|
|
761
|
+
|
|
762
|
+
The HTML content for the snippets needs to be formatted in a simple grid. Here are some examples:
|
|
763
|
+
|
|
764
|
+
Single column:
|
|
765
|
+
|
|
766
|
+
```html
|
|
767
|
+
<div class="row clearfix">
|
|
768
|
+
<div class="column full">
|
|
769
|
+
...
|
|
770
|
+
</div>
|
|
771
|
+
</div>
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
Two columns:
|
|
775
|
+
|
|
776
|
+
```html
|
|
777
|
+
<div class="row clearfix">
|
|
778
|
+
<div class="column half">
|
|
779
|
+
...
|
|
780
|
+
</div>
|
|
781
|
+
<div class="column half">
|
|
782
|
+
...
|
|
783
|
+
</div>
|
|
784
|
+
</div>
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
Three columns:
|
|
788
|
+
|
|
789
|
+
```html
|
|
790
|
+
<div class="row clearfix">
|
|
791
|
+
<div class="column third">
|
|
792
|
+
...
|
|
793
|
+
</div>
|
|
794
|
+
<div class="column third">
|
|
795
|
+
...
|
|
796
|
+
</div>
|
|
797
|
+
<div class="column third">
|
|
798
|
+
...
|
|
799
|
+
</div>
|
|
800
|
+
</div>
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
Four columns:
|
|
804
|
+
|
|
805
|
+
```html
|
|
806
|
+
<div class="row clearfix">
|
|
807
|
+
<div class="fourth third">
|
|
808
|
+
...
|
|
809
|
+
</div>
|
|
810
|
+
<div class="fourth third">
|
|
811
|
+
...
|
|
812
|
+
</div>
|
|
813
|
+
<div class="fourth third">
|
|
814
|
+
...
|
|
815
|
+
</div>
|
|
816
|
+
<div class="fourth third">
|
|
817
|
+
...
|
|
818
|
+
</div>
|
|
819
|
+
</div>
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
If you are using a css framework, such as Bootstrap or Foundation, this simple grid will be automatically converted to the framework grid. More details will be explained in css framework support.
|
|
823
|
+
|
|
824
|
+
You can also add some behavior in your HTML snippets:
|
|
825
|
+
|
|
826
|
+
- To make an image not replaceable, add the data-fixed attribute to the <img> element, for example:
|
|
827
|
+
```html
|
|
828
|
+
<img src=".." data-fixed />
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
- To make a column not editable, add the data-noedit attribute to the column, for example:
|
|
832
|
+
```html
|
|
833
|
+
<div class="row clearfix">
|
|
834
|
+
<div class="column full" data-noedit>
|
|
835
|
+
...
|
|
836
|
+
</div>
|
|
837
|
+
</div>
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
- To make a column not editable and cannot be deleted, moved or duplicated, add the data-protected attribute to the column, for example:
|
|
841
|
+
```html
|
|
842
|
+
<div class="row clearfix">
|
|
843
|
+
<div class="column full" data-protected>
|
|
844
|
+
...
|
|
845
|
+
</div>
|
|
846
|
+
</div>
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
## CSS Framework Support
|
|
850
|
+
|
|
851
|
+
ContentBuilder.js can be used with popular css frameworks, such as Bootstrap, Foundation and more.
|
|
852
|
+
There are 2 types of configuration:
|
|
853
|
+
|
|
854
|
+
#### 1. If the framework has 12 columns grid system
|
|
855
|
+
|
|
856
|
+
Specify the framework classes using the **row** & **cols** parameters. For example:
|
|
857
|
+
|
|
858
|
+
Bootstrap Framework:
|
|
859
|
+
|
|
860
|
+
```javascript
|
|
861
|
+
const builder = new ContentBuilder({
|
|
862
|
+
container: '.container',
|
|
863
|
+
row: 'row',
|
|
864
|
+
cols: ['col-md-1', 'col-md-2', 'col-md-3', 'col-md-4', 'col-md-5', 'col-md-6', 'col-md-7', 'col-md-8', 'col-md-9', 'col-md-10', 'col-md-11', 'col-md-12']
|
|
865
|
+
});
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
Foundation Framework:
|
|
869
|
+
|
|
870
|
+
```javascript
|
|
871
|
+
const builder = new ContentBuilder({
|
|
872
|
+
container: '.container',
|
|
873
|
+
row: 'row',
|
|
874
|
+
cols: ['large-1 columns', 'large-2 columns', 'large-3 columns', 'large-4 columns', 'large-5 columns', 'large-6 columns', 'large-7 columns', 'large-8 columns', 'large-9 columns', 'large-10 columns', 'large-11 columns', 'large-12 columns']
|
|
875
|
+
});
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
#### 2. If the framework has grid system in which the column size increment is not constant
|
|
879
|
+
|
|
880
|
+
Specify two additional parameters: **colequal** & **colsizes**
|
|
881
|
+
|
|
882
|
+
- colequal: list of all class combinations that have same width
|
|
883
|
+
- colsizes: list of all class combinations in increment order
|
|
884
|
+
|
|
885
|
+
Example:
|
|
886
|
+
|
|
887
|
+
UIKit Framework:
|
|
888
|
+
|
|
889
|
+
```javascript
|
|
890
|
+
const builder = new ContentBuilder({
|
|
891
|
+
container: '.container',
|
|
892
|
+
row: 'uk-grid',
|
|
893
|
+
cols: ['uk-width-1-6@m', 'uk-width-1-5@m', 'uk-width-1-4@m', 'uk-width-1-3@m', 'uk-width-2-5@m', 'uk-width-1-2@m', 'uk-width-3-5@m', 'uk-width-2-3@m', 'uk-width-3-4@m', 'uk-width-4-5@m', 'uk-width-5-6@m', 'uk-width-1-1@m'],
|
|
894
|
+
|
|
895
|
+
//the following parameters are needed for grid system in which the column size increment is not constant.
|
|
896
|
+
colequal: [
|
|
897
|
+
['uk-width-1-4@m', 'uk-width-1-4@m', 'uk-width-1-4@m', 'uk-width-1-4@m'],
|
|
898
|
+
['uk-width-1-3@m', 'uk-width-1-3@m', 'uk-width-1-3@m'],
|
|
899
|
+
['uk-width-1-2@m', 'uk-width-1-2@m']
|
|
900
|
+
],
|
|
901
|
+
colsizes: [
|
|
902
|
+
[ //increment for 3 columns
|
|
903
|
+
['uk-width-1-5@m', 'uk-width-2-5@m', 'uk-width-2-5@m'],
|
|
904
|
+
['uk-width-1-3@m', 'uk-width-1-3@m', 'uk-width-1-3@m'],
|
|
905
|
+
['uk-width-2-5@m', 'uk-width-2-5@m', 'uk-width-1-5@m'],
|
|
906
|
+
['uk-width-1-2@m', 'uk-width-1-4@m', 'uk-width-1-4@m'],
|
|
907
|
+
['uk-width-3-5@m', 'uk-width-1-5@m', 'uk-width-1-5@m']
|
|
908
|
+
],
|
|
909
|
+
[ //increment for 2 columns
|
|
910
|
+
['uk-width-1-6@m', 'uk-width-5-6@m'],
|
|
911
|
+
['uk-width-1-5@m', 'uk-width-4-5@m'],
|
|
912
|
+
['uk-width-1-4@m', 'uk-width-3-4@m'],
|
|
913
|
+
['uk-width-1-3@m', 'uk-width-2-3@m'],
|
|
914
|
+
['uk-width-2-5@m', 'uk-width-3-5@m'],
|
|
915
|
+
['uk-width-1-2@m', 'uk-width-1-2@m'],
|
|
916
|
+
['uk-width-3-5@m', 'uk-width-2-5@m'],
|
|
917
|
+
['uk-width-2-3@m', 'uk-width-1-3@m'],
|
|
918
|
+
['uk-width-3-4@m', 'uk-width-1-4@m'],
|
|
919
|
+
['uk-width-4-5@m', 'uk-width-1-5@m'],
|
|
920
|
+
['uk-width-5-6@m', 'uk-width-1-6@m']
|
|
921
|
+
],
|
|
922
|
+
]
|
|
923
|
+
});
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
Note:
|
|
927
|
+
- With the configuration explained above, all snippets/blocks are automatically converted into the framework's grid system. So there is no modification needed on the snippet file when used in various frameworks.
|
|
928
|
+
- ContentBuilder.js may not always work on certain frameworks.
|
|
929
|
+
- Here are some examples on using various css frameworks:
|
|
930
|
+
- example1.html (without framework / use built in basic css)
|
|
931
|
+
- example1-bootstrap.html (Bootstrap Example)
|
|
932
|
+
- example1-bulma.html (Bulma Example)
|
|
933
|
+
- example1-foundation.html (Foundation Example)
|
|
934
|
+
- example1-foundationxy.html (Foundation XY Grid Example)
|
|
935
|
+
- example1-material.html (Material Design Lite Example)
|
|
936
|
+
- example1-materializecss.html (Materialize Example)
|
|
937
|
+
- example1-milligram.html (Milligram Example)
|
|
938
|
+
- example1-minicss.html (Mini.css Example)
|
|
939
|
+
- example1-mustardui.html (Mustard UI Example)
|
|
940
|
+
- example1-primer.html (Primer Example)
|
|
941
|
+
- example1-purecss.html (Pure Css Example)
|
|
942
|
+
- example1-skeleton.html (Skeleton Example)
|
|
943
|
+
- example1-spectre.html (Spectre.css Example)
|
|
944
|
+
- example1-uikit.html (UIKit Example)
|
|
945
|
+
- example1-w3css.html (W3.CSS Example)
|
|
946
|
+
|
|
947
|
+
## Multiple Editable Area Support
|
|
948
|
+
|
|
949
|
+
To implement multiple editable area, Use the same initialization.
|
|
950
|
+
|
|
951
|
+
Example:
|
|
952
|
+
|
|
953
|
+
```html
|
|
954
|
+
<div class="section">
|
|
955
|
+
<div class="container area1">
|
|
956
|
+
...
|
|
957
|
+
</div>
|
|
958
|
+
</div>
|
|
959
|
+
<div class="section">
|
|
960
|
+
<div class="container area2">
|
|
961
|
+
...
|
|
962
|
+
</div>
|
|
963
|
+
</div>
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
```javascript
|
|
967
|
+
const builder = new ContentBuilder({
|
|
968
|
+
container: '.container'
|
|
969
|
+
});
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
To get the HTML content:
|
|
973
|
+
|
|
974
|
+
```javascript
|
|
975
|
+
let html1 = builder.html(document.querySelector('.area1')); //Get 1st area content
|
|
976
|
+
|
|
977
|
+
let html2 = builder.html(document.querySelector('.area2')); //Get 1st area contentarea
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
Please try: example3.html
|
|
981
|
+
|
|
982
|
+
## Programmatically Add Editable Area
|
|
983
|
+
|
|
984
|
+
If your application dynamically adds an editable area/container, you don't need to re-init the ContentBuilder.js.
|
|
985
|
+
|
|
986
|
+
Just run applyBehavior() method:
|
|
987
|
+
```javascript
|
|
988
|
+
builder.applyBehavior();
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
This will make the new container editable.
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
## Lightbox Support
|
|
995
|
+
|
|
996
|
+
With Lightbox support, you can click a link or column to open an image, video (.mp4) or Youtube in an animated modal window (a lightbox).
|
|
997
|
+
|
|
998
|
+
To enable this feature:
|
|
999
|
+
|
|
1000
|
+
```javascript
|
|
1001
|
+
const builder = new ContentBuilder({
|
|
1002
|
+
container: '.container',
|
|
1003
|
+
useLightbox: true // default: false
|
|
1004
|
+
});
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
If lightbox support is enabled, a checkbox to open the image or video link in a lightbox will be displayed in the Image and link dialog.
|
|
1008
|
+
|
|
1009
|
+

|
|
1010
|
+
|
|
1011
|
+
Also in the Column Settings dialog, the 'On Click' tab will be visible.
|
|
1012
|
+
|
|
1013
|
+

|
|
1014
|
+
|
|
1015
|
+
To try the On-Click action, you will need to lock the column.
|
|
1016
|
+
|
|
1017
|
+

|
|
1018
|
+
|
|
1019
|
+
Then, when you click the link or column, the lightbox will be opened (a locked column will disable the editing).
|
|
1020
|
+
|
|
1021
|
+

|
|
1022
|
+
|
|
1023
|
+
#### In Production
|
|
1024
|
+
|
|
1025
|
+
In production (for viewing content), you will need to include a Lightbox script as follow:
|
|
1026
|
+
|
|
1027
|
+
The css:
|
|
1028
|
+
|
|
1029
|
+
```html
|
|
1030
|
+
<link href="assets/scripts/lightbox/lightbox.css" rel="stylesheet" type="text/css" />
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
And the js:
|
|
1034
|
+
|
|
1035
|
+
```html
|
|
1036
|
+
<script src="assets/scripts/lightbox/lightbox.js"></script>
|
|
1037
|
+
<script>
|
|
1038
|
+
lightbox.init();
|
|
1039
|
+
</script>
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
## Color Picker
|
|
1043
|
+
|
|
1044
|
+
The color picker shows some default color list.
|
|
1045
|
+
|
|
1046
|
+

|
|
1047
|
+
|
|
1048
|
+
To configure the colors:
|
|
1049
|
+
```javascript
|
|
1050
|
+
const builder = new ContentBuilder({
|
|
1051
|
+
container: '.container',
|
|
1052
|
+
colors: ["#ff8f00", "#ef6c00", "#d84315", "#c62828", "#58362f", "#37474f", "#353535",
|
|
1053
|
+
"#f9a825", "#9e9d24", "#558b2f", "#ad1457", "#6a1b9a", "#4527a0", "#616161",
|
|
1054
|
+
"#00b8c9", "#009666", "#2e7d32", "#0277bd", "#1565c0", "#283593", "#9e9e9e"],
|
|
1055
|
+
});
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
## Custom Tags
|
|
1059
|
+
|
|
1060
|
+
Custom tags are commonly used in a CMS for adding dynamic element within the content by replacing the tags in production (not during editing). Here is an example:
|
|
1061
|
+
|
|
1062
|
+

|
|
1063
|
+
|
|
1064
|
+
To configure this feature:
|
|
1065
|
+
|
|
1066
|
+
```javascript
|
|
1067
|
+
const builder = new ContentBuilder({
|
|
1068
|
+
container: '.container',
|
|
1069
|
+
customTags: [["Site Name", "{%SITENAME%}"],
|
|
1070
|
+
["Logo", "{%LOGO%}"],
|
|
1071
|
+
["My Plugin", "{%MY_PLUGIN%}"],
|
|
1072
|
+
});
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
## Modal Animation
|
|
1076
|
+
|
|
1077
|
+
Some modals open with animation. For example, when deleting a row, a confirmation modal shows with zoom animation on the content. To enable or disable this feature:
|
|
1078
|
+
|
|
1079
|
+
```javascript
|
|
1080
|
+
const builder = new ContentBuilder({
|
|
1081
|
+
container: '.container',
|
|
1082
|
+
animateModal: false, // default: true
|
|
1083
|
+
});
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
## Custom Value
|
|
1087
|
+
|
|
1088
|
+
You can pass any custom value to the server. In a CMS application, you can pass, for example, a user id or session id, etc.
|
|
1089
|
+
|
|
1090
|
+
The value will be passed when an image is submitted to the server using the Form method. Note that in the AJAX post method, you may not need this feature as you can post any data during the AJAX post. On the server, the image handler can use this value to decide where to save the image for each user. This is more towards customizing your application.
|
|
1091
|
+
|
|
1092
|
+
To specify a custom value:
|
|
1093
|
+
|
|
1094
|
+
```javascript
|
|
1095
|
+
const builder = new ContentBuilder({
|
|
1096
|
+
container: '.container',
|
|
1097
|
+
customval: 200 // or any value
|
|
1098
|
+
});
|
|
1099
|
+
```
|
|
1100
|
+
|
|
1101
|
+
## Preferences
|
|
1102
|
+
|
|
1103
|
+
The preferences dialog allows you to choose your editing preferences. You can hide unwanted tools, choose the toolbar placement or even make the interface clean to write without distraction.
|
|
1104
|
+
|
|
1105
|
+

|
|
1106
|
+
|
|
1107
|
+
Preference options are explained below.
|
|
1108
|
+
|
|
1109
|
+
### Builder Mode
|
|
1110
|
+
|
|
1111
|
+
You can choose: Default, Minimal or Clean.
|
|
1112
|
+
|
|
1113
|
+
#### Default
|
|
1114
|
+
|
|
1115
|
+
The default mode shows all available buttons on the row & column tool.
|
|
1116
|
+
|
|
1117
|
+

|
|
1118
|
+
|
|
1119
|
+
#### Minimal
|
|
1120
|
+
|
|
1121
|
+
The minimal mode simplifies the row & column tool.
|
|
1122
|
+
|
|
1123
|
+

|
|
1124
|
+
|
|
1125
|
+
As seen in the row tool, a new 'Grid' button is shown. Clicking on the button will show a small grid tool.
|
|
1126
|
+
|
|
1127
|
+

|
|
1128
|
+
|
|
1129
|
+
#### Clean
|
|
1130
|
+
|
|
1131
|
+
This option will further simplify the interface, by showing only the 'Grid' button.
|
|
1132
|
+
|
|
1133
|
+

|
|
1134
|
+
|
|
1135
|
+
#### To set the Builder Mode in code
|
|
1136
|
+
|
|
1137
|
+
```javascript
|
|
1138
|
+
const builder = new ContentBuilder({
|
|
1139
|
+
container: '.container',
|
|
1140
|
+
builderMode: 'clean'
|
|
1141
|
+
});
|
|
1142
|
+
```
|
|
1143
|
+
Values:
|
|
1144
|
+
- not set or empty (default)
|
|
1145
|
+
- minimal
|
|
1146
|
+
- clean
|
|
1147
|
+
|
|
1148
|
+
### Outline Mode
|
|
1149
|
+
|
|
1150
|
+
You can choose: Row & Column, Row Only
|
|
1151
|
+
|
|
1152
|
+
#### Row & Column
|
|
1153
|
+
|
|
1154
|
+
Shows an outline on active row and column.
|
|
1155
|
+
|
|
1156
|
+

|
|
1157
|
+
|
|
1158
|
+
#### Row Only
|
|
1159
|
+
|
|
1160
|
+
Shows an outline on active row only.
|
|
1161
|
+
|
|
1162
|
+

|
|
1163
|
+
|
|
1164
|
+
#### To set the Outline Mode in code
|
|
1165
|
+
|
|
1166
|
+
```javascript
|
|
1167
|
+
const builder = new ContentBuilder({
|
|
1168
|
+
container: '.container',
|
|
1169
|
+
outlineMode: 'row'
|
|
1170
|
+
});
|
|
1171
|
+
```
|
|
1172
|
+
Values:
|
|
1173
|
+
- not set or empty => Row & Column (default)
|
|
1174
|
+
- row => Row Only
|
|
1175
|
+
|
|
1176
|
+
### Outline Style
|
|
1177
|
+
|
|
1178
|
+
You can choose: Colored, Gray
|
|
1179
|
+
|
|
1180
|
+
Here the outline is set to gray.
|
|
1181
|
+
|
|
1182
|
+

|
|
1183
|
+
|
|
1184
|
+
#### To set the Outline Style in code
|
|
1185
|
+
|
|
1186
|
+
```javascript
|
|
1187
|
+
const builder = new ContentBuilder({
|
|
1188
|
+
container: '.container',
|
|
1189
|
+
outlineStyle: 'grayoutline'
|
|
1190
|
+
});
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
Values:
|
|
1194
|
+
- not set or empty => Colored (default)
|
|
1195
|
+
- grayoutline => Gray
|
|
1196
|
+
|
|
1197
|
+
### Hide Outline
|
|
1198
|
+
|
|
1199
|
+
If checked, there will be no outline on active row or column.
|
|
1200
|
+
|
|
1201
|
+

|
|
1202
|
+
|
|
1203
|
+
#### To hide the Outline in code
|
|
1204
|
+
|
|
1205
|
+
```javascript
|
|
1206
|
+
const builder = new ContentBuilder({
|
|
1207
|
+
container: '.container',
|
|
1208
|
+
rowcolOutline: false // outline will be hidden
|
|
1209
|
+
});
|
|
1210
|
+
```
|
|
1211
|
+
Values:
|
|
1212
|
+
- true => Visible (default)
|
|
1213
|
+
- false => Hidden
|
|
1214
|
+
|
|
1215
|
+
### Hide Column Tool
|
|
1216
|
+
|
|
1217
|
+
If checked, column tool will not be visible on active column.
|
|
1218
|
+
|
|
1219
|
+

|
|
1220
|
+
|
|
1221
|
+
#### To hide the Column Tool in code
|
|
1222
|
+
|
|
1223
|
+
```javascript
|
|
1224
|
+
const builder = new ContentBuilder({
|
|
1225
|
+
container: '.container',
|
|
1226
|
+
columnTool: false // column tool will be hidden
|
|
1227
|
+
});
|
|
1228
|
+
```
|
|
1229
|
+
Values:
|
|
1230
|
+
- true => Visible (default)
|
|
1231
|
+
- false => Hidden
|
|
1232
|
+
|
|
1233
|
+
### Row Tool Position
|
|
1234
|
+
|
|
1235
|
+
You can choose: Left, Right.
|
|
1236
|
+
|
|
1237
|
+
Here the position is set Left.
|
|
1238
|
+
|
|
1239
|
+

|
|
1240
|
+
|
|
1241
|
+
#### To set the Row Tool Position in code
|
|
1242
|
+
|
|
1243
|
+
```javascript
|
|
1244
|
+
const builder = new ContentBuilder({
|
|
1245
|
+
container: '.container',
|
|
1246
|
+
rowTool: 'left' // positioned on left
|
|
1247
|
+
});
|
|
1248
|
+
```
|
|
1249
|
+
Values:
|
|
1250
|
+
- right (default)
|
|
1251
|
+
- left
|
|
1252
|
+
|
|
1253
|
+
### Tool Style
|
|
1254
|
+
|
|
1255
|
+
You can choose: Colored, Mono.
|
|
1256
|
+
|
|
1257
|
+
Here the tool style is set to Mono.
|
|
1258
|
+
|
|
1259
|
+

|
|
1260
|
+
|
|
1261
|
+
#### To set the Tool Style in code
|
|
1262
|
+
|
|
1263
|
+
```javascript
|
|
1264
|
+
const builder = new ContentBuilder({
|
|
1265
|
+
container: '.container',
|
|
1266
|
+
toolStyle: 'gray' // = Gray or Mono
|
|
1267
|
+
});
|
|
1268
|
+
```
|
|
1269
|
+
Values:
|
|
1270
|
+
- not set or empty => Colored (default)
|
|
1271
|
+
- gray => Gray or Mono
|
|
1272
|
+
|
|
1273
|
+
### Hide Snippet (+) Tool
|
|
1274
|
+
|
|
1275
|
+
If checked, the Add (+) Snippet button will be hidden.
|
|
1276
|
+
|
|
1277
|
+
Here the Add (+) Snippet button is visible.
|
|
1278
|
+
|
|
1279
|
+

|
|
1280
|
+
|
|
1281
|
+
And here the Add (+) Snippet button is hidden.
|
|
1282
|
+
|
|
1283
|
+

|
|
1284
|
+
|
|
1285
|
+
#### To hide the Snippet (+) Tool in code
|
|
1286
|
+
|
|
1287
|
+
```javascript
|
|
1288
|
+
const builder = new ContentBuilder({
|
|
1289
|
+
container: '.container',
|
|
1290
|
+
snippetAddTool: false // Snippet (+) tool will be hidden
|
|
1291
|
+
});
|
|
1292
|
+
```
|
|
1293
|
+
Values:
|
|
1294
|
+
- true => Visible (default)
|
|
1295
|
+
- false => Hidden
|
|
1296
|
+
|
|
1297
|
+
### Hide Element Tool
|
|
1298
|
+
|
|
1299
|
+
If checked, the element tool will be hidden.
|
|
1300
|
+
|
|
1301
|
+
Here the element tool is visible.
|
|
1302
|
+
|
|
1303
|
+

|
|
1304
|
+
|
|
1305
|
+
And here the element tool is hidden.
|
|
1306
|
+
|
|
1307
|
+

|
|
1308
|
+
|
|
1309
|
+
#### To hide the Element Tool in code
|
|
1310
|
+
|
|
1311
|
+
```javascript
|
|
1312
|
+
const builder = new ContentBuilder({
|
|
1313
|
+
container: '.container',
|
|
1314
|
+
elementTool: false // Element tool will be hidden
|
|
1315
|
+
});
|
|
1316
|
+
```
|
|
1317
|
+
Values:
|
|
1318
|
+
- true => Visible (default)
|
|
1319
|
+
- false => Hidden
|
|
1320
|
+
|
|
1321
|
+
### Hide Element Highlight
|
|
1322
|
+
|
|
1323
|
+
If checked, there will be no active element highlight.
|
|
1324
|
+
|
|
1325
|
+
Here the element highlight is visible.
|
|
1326
|
+
|
|
1327
|
+

|
|
1328
|
+
|
|
1329
|
+
And here the element highlight is not visible.
|
|
1330
|
+
|
|
1331
|
+

|
|
1332
|
+
|
|
1333
|
+
#### To hide the Element Highlight in code
|
|
1334
|
+
|
|
1335
|
+
```javascript
|
|
1336
|
+
const builder = new ContentBuilder({
|
|
1337
|
+
container: '.container',
|
|
1338
|
+
elementHighlight: false // Element highlight will be hidden
|
|
1339
|
+
});
|
|
1340
|
+
```
|
|
1341
|
+
Values:
|
|
1342
|
+
- true => Visible (default)
|
|
1343
|
+
- false => Hidden
|
|
1344
|
+
|
|
1345
|
+
### Snippet Sidebar Visibility
|
|
1346
|
+
|
|
1347
|
+
You can choose: Auto, Always Visible.
|
|
1348
|
+
|
|
1349
|
+
Normally, the snippet sidebar will be automatically closed during editing. If set to 'Always Visible', the snippet sidebar will stay visible.
|
|
1350
|
+
|
|
1351
|
+
#### To set the Snippet Sidebar Visibility in code
|
|
1352
|
+
|
|
1353
|
+
```javascript
|
|
1354
|
+
const builder = new ContentBuilder({
|
|
1355
|
+
container: '.container',
|
|
1356
|
+
snippetDisplay: 'visible' // stay visible
|
|
1357
|
+
});
|
|
1358
|
+
```
|
|
1359
|
+
|
|
1360
|
+
Values:
|
|
1361
|
+
- auto => Auto close (default)
|
|
1362
|
+
- visible => Stay visible
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
### Paste Result
|
|
1366
|
+
|
|
1367
|
+
You can choose:
|
|
1368
|
+
- Text Only
|
|
1369
|
+
- HTML (Without Style)
|
|
1370
|
+
- HTML (With Style)
|
|
1371
|
+
|
|
1372
|
+
This is a behavior you can choose when you paste copied content from another source, for example, from a Word document.
|
|
1373
|
+
|
|
1374
|
+
#### To set the Paste Result in code
|
|
1375
|
+
|
|
1376
|
+
```javascript
|
|
1377
|
+
const builder = new ContentBuilder({
|
|
1378
|
+
container: '.container',
|
|
1379
|
+
paste: 'text'
|
|
1380
|
+
});
|
|
1381
|
+
```
|
|
1382
|
+
Values:
|
|
1383
|
+
- text (default)
|
|
1384
|
+
- html
|
|
1385
|
+
- html-without-styles
|
|
1386
|
+
|
|
1387
|
+
### Toolbar Position
|
|
1388
|
+
|
|
1389
|
+
You can choose: Top, Left, or Right
|
|
1390
|
+
|
|
1391
|
+
Normally the toolbar is positioned on top.
|
|
1392
|
+
|
|
1393
|
+
If the position is set to Left, the toolbar will be shown on the left.
|
|
1394
|
+
|
|
1395
|
+

|
|
1396
|
+
|
|
1397
|
+
If the position is set to Right, the toolbar will be shown on the right.
|
|
1398
|
+
|
|
1399
|
+

|
|
1400
|
+
|
|
1401
|
+
#### To set the Toolbar Position in code
|
|
1402
|
+
|
|
1403
|
+
```javascript
|
|
1404
|
+
const builder = new ContentBuilder({
|
|
1405
|
+
container: '.container',
|
|
1406
|
+
toolbar: 'left'
|
|
1407
|
+
});
|
|
1408
|
+
```
|
|
1409
|
+
Values:
|
|
1410
|
+
- top (default)
|
|
1411
|
+
- left
|
|
1412
|
+
- right
|
|
1413
|
+
|
|
1414
|
+
### Programmatically Open Preference Dialog
|
|
1415
|
+
|
|
1416
|
+
```javascript
|
|
1417
|
+
builder.viewConfig()
|
|
1418
|
+
```
|
|
1419
|
+
### Clear Saved Preferences
|
|
1420
|
+
|
|
1421
|
+
Normaly, when you click Ok on the Preferences dialog, your chosen settings will be automatically saved (on browser local storage). So the next time you open the builder, you can still work with your chosen preferences.
|
|
1422
|
+
|
|
1423
|
+
To force the builder to not use the saved preferences, you can use:
|
|
1424
|
+
|
|
1425
|
+
```javascript
|
|
1426
|
+
const builder = new ContentBuilder({
|
|
1427
|
+
container: '.container',
|
|
1428
|
+
clearPreferences: true,
|
|
1429
|
+
});
|
|
1430
|
+
```
|
|
1431
|
+
|
|
1432
|
+
### Example: Making the builder interface clean
|
|
1433
|
+
|
|
1434
|
+
As an example, here are the settings you can choose to make the builder clean.
|
|
1435
|
+
|
|
1436
|
+

|
|
1437
|
+
|
|
1438
|
+
In this example, the **Builder Mode** is set to 'Clean' and the **Hide Outline** is checked.
|
|
1439
|
+
|
|
1440
|
+
Here is the result.
|
|
1441
|
+
|
|
1442
|
+

|
|
1443
|
+
|
|
1444
|
+
## Themes
|
|
1445
|
+
|
|
1446
|
+
To enable theme selection:
|
|
1447
|
+
|
|
1448
|
+
```javascript
|
|
1449
|
+
const builder = new ContentBuilder({
|
|
1450
|
+
container: '.container',
|
|
1451
|
+
themes: [
|
|
1452
|
+
['#ffffff','',''],
|
|
1453
|
+
['#282828','dark','contentbuilder/themes/dark.css'],
|
|
1454
|
+
['#0088dc','colored','contentbuilder/themes/colored-blue.css'],
|
|
1455
|
+
['#006add','colored','contentbuilder/themes/colored-blue6.css'],
|
|
1456
|
+
['#0a4d92','colored','contentbuilder/themes/colored-darkblue.css'],
|
|
1457
|
+
['#96af16','colored','contentbuilder/themes/colored-green.css'],
|
|
1458
|
+
['#f3522b','colored','contentbuilder/themes/colored-orange.css'],
|
|
1459
|
+
|
|
1460
|
+
['#b92ea6','colored','contentbuilder/themes/colored-magenta.css'],
|
|
1461
|
+
['#e73171','colored','contentbuilder/themes/colored-pink.css'],
|
|
1462
|
+
['#782ec5','colored','contentbuilder/themes/colored-purple.css'],
|
|
1463
|
+
['#ed2828','colored','contentbuilder/themes/colored-red.css'],
|
|
1464
|
+
['#f9930f','colored','contentbuilder/themes/colored-yellow.css'],
|
|
1465
|
+
['#13b34b','colored','contentbuilder/themes/colored-green4.css'],
|
|
1466
|
+
['#333333','colored-dark','contentbuilder/themes/colored-dark.css'],
|
|
1467
|
+
|
|
1468
|
+
['#dbe5f5','light','contentbuilder/themes/light-blue.css'],
|
|
1469
|
+
['#fbe6f2','light','contentbuilder/themes/light-pink.css'],
|
|
1470
|
+
['#dcdaf3','light','contentbuilder/themes/light-purple.css'],
|
|
1471
|
+
['#ffe9e0','light','contentbuilder/themes/light-red.css'],
|
|
1472
|
+
['#fffae5','light','contentbuilder/themes/light-yellow.css'],
|
|
1473
|
+
['#ddf3dc','light','contentbuilder/themes/light-green.css'],
|
|
1474
|
+
['#d7f7f1','light','contentbuilder/themes/light-cyan.css'],
|
|
1475
|
+
|
|
1476
|
+
['#c7ebfd','light','contentbuilder/themes/light-blue2.css'],
|
|
1477
|
+
['#ffd5f2','light','contentbuilder/themes/light-pink2.css'],
|
|
1478
|
+
['#eadafb','light','contentbuilder/themes/light-purple2.css'],
|
|
1479
|
+
['#c5d4ff','light','contentbuilder/themes/light-blue3.css'],
|
|
1480
|
+
['#ffefb1','light','contentbuilder/themes/light-yellow2.css'],
|
|
1481
|
+
['#e5e5e5','light','contentbuilder/themes/light-gray2.css'],
|
|
1482
|
+
['#dadada','light','contentbuilder/themes/light-gray.css'],
|
|
1483
|
+
|
|
1484
|
+
['#3f4ec9','colored','contentbuilder/themes/colored-blue2.css'],
|
|
1485
|
+
['#6779d9','colored','contentbuilder/themes/colored-blue4.css'],
|
|
1486
|
+
['#10b9d7','colored','contentbuilder/themes/colored-blue3.css'],
|
|
1487
|
+
['#006add','colored','contentbuilder/themes/colored-blue5.css'],
|
|
1488
|
+
['#e92f94','colored','contentbuilder/themes/colored-pink3.css'],
|
|
1489
|
+
['#a761d9','colored','contentbuilder/themes/colored-purple2.css'],
|
|
1490
|
+
['#f9930f','colored','contentbuilder/themes/colored-yellow2.css'],
|
|
1491
|
+
|
|
1492
|
+
['#f3522b','colored','contentbuilder/themes/colored-red3.css'],
|
|
1493
|
+
['#36b741','colored','contentbuilder/themes/colored-green2.css'],
|
|
1494
|
+
['#00c17c','colored','contentbuilder/themes/colored-green3.css'],
|
|
1495
|
+
['#fb3279','colored','contentbuilder/themes/colored-pink2.css'],
|
|
1496
|
+
['#ff6d13','colored','contentbuilder/themes/colored-orange2.css'],
|
|
1497
|
+
['#f13535','colored','contentbuilder/themes/colored-red2.css'],
|
|
1498
|
+
['#646464','colored','contentbuilder/themes/colored-gray.css'],
|
|
1499
|
+
|
|
1500
|
+
['#3f4ec9','dark','contentbuilder/themes/dark-blue.css'],
|
|
1501
|
+
['#0b4d92','dark','contentbuilder/themes/dark-blue2.css'],
|
|
1502
|
+
['#006add','dark','contentbuilder/themes/dark-blue3.css'],
|
|
1503
|
+
['#5f3ebf','dark','contentbuilder/themes/dark-purple.css'],
|
|
1504
|
+
['#e92f69','dark','contentbuilder/themes/dark-pink.css'],
|
|
1505
|
+
['#4c4c4c','dark','contentbuilder/themes/dark-gray.css'],
|
|
1506
|
+
['#ed2828','dark','contentbuilder/themes/dark-red.css'],
|
|
1507
|
+
|
|
1508
|
+
['#006add','colored','contentbuilder/themes/colored-blue8.css'],
|
|
1509
|
+
['#ff7723','colored','contentbuilder/themes/colored-orange3.css'],
|
|
1510
|
+
['#ff5722','colored','contentbuilder/themes/colored-red5.css'],
|
|
1511
|
+
['#f13535','colored','contentbuilder/themes/colored-red4.css'],
|
|
1512
|
+
['#00bd79','colored','contentbuilder/themes/colored-green5.css'],
|
|
1513
|
+
['#557ae9','colored','contentbuilder/themes/colored-blue7.css'],
|
|
1514
|
+
['#fb3279','colored','contentbuilder/themes/colored-pink4.css'],
|
|
1515
|
+
],
|
|
1516
|
+
});
|
|
1517
|
+
```
|
|
1518
|
+
|
|
1519
|
+
Each theme definition consists of:
|
|
1520
|
+
- color preview (for the selection)
|
|
1521
|
+
- class name (needed by the css)
|
|
1522
|
+
- css file
|
|
1523
|
+
|
|
1524
|
+
When enabled, the theme selection will be visible on the Preferences dialog.
|
|
1525
|
+
|
|
1526
|
+

|
|
1527
|
+
|
|
1528
|
+
Example themes:
|
|
1529
|
+
|
|
1530
|
+

|
|
1531
|
+
|
|
1532
|
+

|
|
1533
|
+
|
|
1534
|
+
To load a specific theme programmatically, you can use:
|
|
1535
|
+
|
|
1536
|
+
```javascript
|
|
1537
|
+
builder.setUIColor('colored','contentbuilder/contentbuilder-red.css');
|
|
1538
|
+
```
|
|
1539
|
+
For light theme:
|
|
1540
|
+
|
|
1541
|
+
```javascript
|
|
1542
|
+
builder.setUIColor('');
|
|
1543
|
+
```
|
|
1544
|
+
For dark theme:
|
|
1545
|
+
|
|
1546
|
+
```javascript
|
|
1547
|
+
builder.setUIColor('dark','/dist/contentbuilder-dark.css');
|
|
1548
|
+
```
|
|
1549
|
+
|
|
1550
|
+
## HTML Code Editing Support
|
|
1551
|
+
|
|
1552
|
+
You can edit the HTML code of your content with or without syntax highlighting.
|
|
1553
|
+
|
|
1554
|
+
To configure:
|
|
1555
|
+
|
|
1556
|
+
```javascript
|
|
1557
|
+
const builder = new ContentBuilder({
|
|
1558
|
+
container: '.container',
|
|
1559
|
+
htmlSyntaxHighlighting: true,
|
|
1560
|
+
});
|
|
1561
|
+
```
|
|
1562
|
+
|
|
1563
|
+
With syntax highlighting:
|
|
1564
|
+
|
|
1565
|
+

|
|
1566
|
+
|
|
1567
|
+
Without syntax highlighting:
|
|
1568
|
+
|
|
1569
|
+

|
|
1570
|
+
|
|
1571
|
+
#### Programmatically open HTML code editor
|
|
1572
|
+
|
|
1573
|
+
To open HTML code editor programmatically:
|
|
1574
|
+
|
|
1575
|
+
```javascript
|
|
1576
|
+
builder.viewHtml();
|
|
1577
|
+
```
|
|
1578
|
+
|
|
1579
|
+
#### Disable Column HTML code editor
|
|
1580
|
+
|
|
1581
|
+
The column HTML editor button is shown on the column tool popup. If disabled, the button will not be visible.
|
|
1582
|
+
|
|
1583
|
+

|
|
1584
|
+
|
|
1585
|
+
To disable:
|
|
1586
|
+
|
|
1587
|
+
```javascript
|
|
1588
|
+
const builder = new ContentBuilder({
|
|
1589
|
+
container: '.container',
|
|
1590
|
+
columnHtmlEditor: false,
|
|
1591
|
+
});
|
|
1592
|
+
```
|
|
1593
|
+
|
|
1594
|
+
#### Disable Row HTML code editor
|
|
1595
|
+
|
|
1596
|
+
The row HTML editor button is shown on the row tool popup. If disabled, the button will not be visible.
|
|
1597
|
+
|
|
1598
|
+

|
|
1599
|
+
|
|
1600
|
+
To disable:
|
|
1601
|
+
|
|
1602
|
+
```javascript
|
|
1603
|
+
const builder = new ContentBuilder({
|
|
1604
|
+
container: '.container',
|
|
1605
|
+
rowHtmlEditor: false,
|
|
1606
|
+
});
|
|
1607
|
+
```
|
|
1608
|
+
|
|
1609
|
+
## Loading HTML Content Programmatically
|
|
1610
|
+
|
|
1611
|
+
To load HTML content programmatically, you can pass your HTML content in the **loadHtml()** method:
|
|
1612
|
+
|
|
1613
|
+
```javascript
|
|
1614
|
+
builder.loadHtml(html);
|
|
1615
|
+
```
|
|
1616
|
+
|
|
1617
|
+
## Paste HTML Content Programmatically
|
|
1618
|
+
|
|
1619
|
+
To paste HTML content programmatically, you can pass your HTML content in the **pasteHtmlAtCaret()** method:
|
|
1620
|
+
|
|
1621
|
+
```javascript
|
|
1622
|
+
builder.pasteHtmlAtCaret(html);
|
|
1623
|
+
```
|
|
1624
|
+
You will need to place the cursor on the content where you want to paste the HTML.
|
|
1625
|
+
|
|
1626
|
+
## Element Selection
|
|
1627
|
+
|
|
1628
|
+
By default, when you press CMD-A or CTRL-A, you will select the current element where cursor is placed (not selecting all elements on the entire column).
|
|
1629
|
+
This behavior is defined by the **elementSelection** parameter:
|
|
1630
|
+
|
|
1631
|
+
```javascript
|
|
1632
|
+
const builder = new ContentBuilder({
|
|
1633
|
+
container: '.container',
|
|
1634
|
+
elementSelection: true,
|
|
1635
|
+
});
|
|
1636
|
+
```
|
|
1637
|
+
If **elementSelection** is set to false, then the selection will go to the entire column.
|
|
1638
|
+
|
|
1639
|
+
## Style Panel
|
|
1640
|
+
|
|
1641
|
+
ContentBuilder.js provides you with a style panel to format the selected element. Click the **Settings** button on the element tool popup to open the Style panel.
|
|
1642
|
+
|
|
1643
|
+

|
|
1644
|
+
|
|
1645
|
+
To disable the Style panel button:
|
|
1646
|
+
|
|
1647
|
+
```javascript
|
|
1648
|
+
const builder = new ContentBuilder({
|
|
1649
|
+
container: '.container',
|
|
1650
|
+
elementEditor: false,
|
|
1651
|
+
});
|
|
1652
|
+
```
|
|
1653
|
+
|
|
1654
|
+
## Zoom Support
|
|
1655
|
+
|
|
1656
|
+
You can change the editable area zoom by clicking the zoom icon on the toolbar and use the zoom slider.
|
|
1657
|
+
|
|
1658
|
+

|
|
1659
|
+
|
|
1660
|
+
To specify the default zoom, use:
|
|
1661
|
+
|
|
1662
|
+
```javascript
|
|
1663
|
+
const builder = new ContentBuilder({
|
|
1664
|
+
container: '.container',
|
|
1665
|
+
zoom: 0.8, // value: 0.5 to 1
|
|
1666
|
+
});
|
|
1667
|
+
```
|
|
1668
|
+
|
|
1669
|
+
When you change the zoom size, the value is saved automatically (on browser's local storage). So next time you open the builder, the previously chosen zoom will be used (not the default zoom value).
|
|
1670
|
+
|
|
1671
|
+
Some event callbacks you can use when the zoom is changed.
|
|
1672
|
+
|
|
1673
|
+
```javascript
|
|
1674
|
+
const builder = new ContentBuilder({
|
|
1675
|
+
container: '.container',
|
|
1676
|
+
onZoomStart: function() { ... },
|
|
1677
|
+
onZoom: function(scale) { ... },
|
|
1678
|
+
onZoomEnd: function(scale) { ... },
|
|
1679
|
+
});
|
|
1680
|
+
```
|
|
1681
|
+
|
|
1682
|
+
## Toolbar
|
|
1683
|
+
|
|
1684
|
+
#### Main Toolbar
|
|
1685
|
+
|
|
1686
|
+
The default main toolbar shows the buttons as seen below:
|
|
1687
|
+
|
|
1688
|
+

|
|
1689
|
+
|
|
1690
|
+
The second toolbar is displayed when you click the ... (more) button:
|
|
1691
|
+
|
|
1692
|
+

|
|
1693
|
+
|
|
1694
|
+
To configure the main toolbar, use the **buttons** parameter, and to configure the second toolbar, use the **buttonsMore** parameter:
|
|
1695
|
+
|
|
1696
|
+
```javascript
|
|
1697
|
+
const builder = new ContentBuilder({
|
|
1698
|
+
container: '.container',
|
|
1699
|
+
buttons: ['bold', 'italic', 'underline', 'formatting', 'color', 'align', 'textsettings', 'createlink', 'tags', '|', 'undo', 'redo', 'zoom', 'more'],
|
|
1700
|
+
buttonsMore: ['icon', 'image', '|', 'list', 'font', 'formatpara', '|', 'html', 'preferences'],
|
|
1701
|
+
});
|
|
1702
|
+
```
|
|
1703
|
+
|
|
1704
|
+
Note: Use '|' for separator.
|
|
1705
|
+
|
|
1706
|
+
**Allowed buttons for the main toolbar**:
|
|
1707
|
+
addsnippet, bold, italic, underline, formatting, color, removeformat, align, textsettings, createlink, tags, undo, redo, zoom, icon, image, list, font, formatpara, gridtool, html, preferences, more, and plugin buttons (such as: preview, wordcount, searchreplace, symbols).
|
|
1708
|
+
|
|
1709
|
+
Note: 'more' buttons cannot be used in the second row toolbar.
|
|
1710
|
+
|
|
1711
|
+
|
|
1712
|
+
#### Element Toolbar
|
|
1713
|
+
|
|
1714
|
+
Element toolbar is displayed when a non-text element is selected, for example, when you select an image.
|
|
1715
|
+
|
|
1716
|
+
The default element toolbar shows the buttons as seen below:
|
|
1717
|
+
|
|
1718
|
+

|
|
1719
|
+
|
|
1720
|
+
The second toolbar is displayed when you click the ... (more) button:
|
|
1721
|
+
|
|
1722
|
+

|
|
1723
|
+
|
|
1724
|
+
To configure the element toolbar, use the **elementButtons** parameter, and to configure the second element toolbar, use the **elementButtonsMore** parameter:
|
|
1725
|
+
|
|
1726
|
+
```javascript
|
|
1727
|
+
const builder = new ContentBuilder({
|
|
1728
|
+
container: '.container',
|
|
1729
|
+
elementButtons: ['left', 'center', 'right', 'full' , 'undo', 'redo', 'zoom', 'more'],
|
|
1730
|
+
elementButtonsMore: ['|', 'html', 'preferences'],
|
|
1731
|
+
});
|
|
1732
|
+
```
|
|
1733
|
+
|
|
1734
|
+
**Allowed buttons for elementButtons**:
|
|
1735
|
+
left, center, right, full, gridtool, html, preferences, addsnippet, undo, redo, zoom, more, and plugin buttons (such as: preview, wordcount, searchreplace, symbols).
|
|
1736
|
+
|
|
1737
|
+
Note: 'more' buttons cannot be used in the second row toolbar.
|
|
1738
|
+
|
|
1739
|
+
#### Plugin Buttons
|
|
1740
|
+
|
|
1741
|
+
As you can see on both the main toolbar and the element toolbar, there are some additional buttons that come from installed plugins (on the left side of the second toolbar).
|
|
1742
|
+
|
|
1743
|
+

|
|
1744
|
+
|
|
1745
|
+

|
|
1746
|
+
|
|
1747
|
+
The default installed plugins are:
|
|
1748
|
+
- preview (adds the **Preview** button to preview the content in various screen sizes)
|
|
1749
|
+
- wordcount (adds the **Word Count** button to show word count info)
|
|
1750
|
+
- symbols (adds the **Symbols** button to insert symbols)
|
|
1751
|
+
- buttoneditor (this plugin doesn't add a button on the toolbar)
|
|
1752
|
+
|
|
1753
|
+
If plugin buttons are defined in the toolbar (the plugin name found in **buttons**, **buttonsMore**, **elementButtons** or **elementButtonsMore**), then the plugin buttons will not be automatically added on the left side of the second toolbar.
|
|
1754
|
+
|
|
1755
|
+
Please see Plugins section for more info on plugins.
|
|
1756
|
+
|
|
1757
|
+
#### Example: if you don't want to use the "More" button
|
|
1758
|
+
|
|
1759
|
+
```javascript
|
|
1760
|
+
const builder = new ContentBuilder({
|
|
1761
|
+
container: '.container',
|
|
1762
|
+
buttons: ['bold', 'italic', 'undo', 'redo', 'zoom', 'preview'],
|
|
1763
|
+
buttonsMore: [],
|
|
1764
|
+
elementButtons: ['undo', 'redo', 'zoom', 'preview'],
|
|
1765
|
+
elementButtonsMore: [],
|
|
1766
|
+
plugins: [
|
|
1767
|
+
{ name: 'preview', showInMainToolbar: true, showInElementToolbar: true },
|
|
1768
|
+
],
|
|
1769
|
+
pluginPath: 'contentbuilder/',
|
|
1770
|
+
});
|
|
1771
|
+
```
|
|
1772
|
+
As seen on the code, we install only the 'preview' plugin. You will need to define all installed plugin buttons on the toolbar.
|
|
1773
|
+
Then you set the second toolbars to empty:
|
|
1774
|
+
- buttonsMore: []
|
|
1775
|
+
- elementButtonsMore: []
|
|
1776
|
+
|
|
1777
|
+
Here is the result.
|
|
1778
|
+
|
|
1779
|
+

|
|
1780
|
+
|
|
1781
|
+
Or, if you are not using any plugins, use:
|
|
1782
|
+
|
|
1783
|
+
```javascript
|
|
1784
|
+
const builder = new ContentBuilder({
|
|
1785
|
+
container: '.container',
|
|
1786
|
+
buttons: ['bold', 'italic', 'undo', 'redo', 'zoom'],
|
|
1787
|
+
buttonsMore: [],
|
|
1788
|
+
elementButtons: ['undo', 'redo', 'zoom'],
|
|
1789
|
+
elementButtonsMore: [],
|
|
1790
|
+
disableConfig: true
|
|
1791
|
+
});
|
|
1792
|
+
```
|
|
1793
|
+
Here is the result.
|
|
1794
|
+
|
|
1795
|
+

|
|
1796
|
+
|
|
1797
|
+
|
|
1798
|
+
## Undo & Redo
|
|
1799
|
+
|
|
1800
|
+
You can programmatically perform an undo or redo action.
|
|
1801
|
+
|
|
1802
|
+
To undo:
|
|
1803
|
+
|
|
1804
|
+
```javascript
|
|
1805
|
+
builder.undo();
|
|
1806
|
+
```
|
|
1807
|
+
|
|
1808
|
+
To redo:
|
|
1809
|
+
|
|
1810
|
+
```javascript
|
|
1811
|
+
builder.redo();
|
|
1812
|
+
```
|
|
1813
|
+
|
|
1814
|
+
## Events
|
|
1815
|
+
|
|
1816
|
+
Some useful parameters to define an event callback function:
|
|
1817
|
+
|
|
1818
|
+
#### onRender
|
|
1819
|
+
Triggered when content structure is changed, for example, when a new snippet is added.
|
|
1820
|
+
If you monitor your content to apply a certain process or add a certain behavior, you can re-run your process here.
|
|
1821
|
+
|
|
1822
|
+
```javascript
|
|
1823
|
+
const builder = new ContentBuilder({
|
|
1824
|
+
container: '.container',
|
|
1825
|
+
onRender: function() { ... }
|
|
1826
|
+
});
|
|
1827
|
+
```
|
|
1828
|
+
|
|
1829
|
+
#### onChange
|
|
1830
|
+
Triggered when content is changed.
|
|
1831
|
+
|
|
1832
|
+
```javascript
|
|
1833
|
+
const builder = new ContentBuilder({
|
|
1834
|
+
container: '.container',
|
|
1835
|
+
onChange: function() { ... }
|
|
1836
|
+
});
|
|
1837
|
+
```
|
|
1838
|
+
|
|
1839
|
+
#### onContentClick(event)
|
|
1840
|
+
Triggered when content is clicked.
|
|
1841
|
+
|
|
1842
|
+
```javascript
|
|
1843
|
+
const builder = new ContentBuilder({
|
|
1844
|
+
container: '.container',
|
|
1845
|
+
onContentClick: function(event) { ... }
|
|
1846
|
+
});
|
|
1847
|
+
```
|
|
1848
|
+
|
|
1849
|
+
## Destroy
|
|
1850
|
+
|
|
1851
|
+
To destroy the builder plugin:
|
|
1852
|
+
|
|
1853
|
+
```javascript
|
|
1854
|
+
builder.destroy();
|
|
1855
|
+
```
|
|
1856
|
+
|
|
1857
|
+
## Flexible Path
|
|
1858
|
+
|
|
1859
|
+
ContentBuilder.js requires some assets located in the assets/ folder. For example, there are icons, optional scripts for module, etc.
|
|
1860
|
+
|
|
1861
|
+
If you want to change the location of the assets/ folder, you can change the **assetPath** value:
|
|
1862
|
+
|
|
1863
|
+
```javascript
|
|
1864
|
+
const builder = new ContentBuilder({
|
|
1865
|
+
container: '.container',
|
|
1866
|
+
assetPath: 'assets/'
|
|
1867
|
+
});
|
|
1868
|
+
```
|
|
1869
|
+
The **assetPath** value is required by the icons and optional scripts for module.
|
|
1870
|
+
|
|
1871
|
+
There are some folders inside the assets/ folder:
|
|
1872
|
+
|
|
1873
|
+
#### assets/fonts/
|
|
1874
|
+
This folder contains thumbnails for the font selection. You can change the location of this folder by changing the value of the **fontAssetPath** parameter:
|
|
1875
|
+
```javascript
|
|
1876
|
+
const builder = new ContentBuilder({
|
|
1877
|
+
container: '.container',
|
|
1878
|
+
fontAssetPath: 'assets/fonts/'
|
|
1879
|
+
});
|
|
1880
|
+
```
|
|
1881
|
+
|
|
1882
|
+
#### assets/minimalist-blocks/
|
|
1883
|
+
This is the location of the snippet file and its assets. To change the location:
|
|
1884
|
+
```javascript
|
|
1885
|
+
const builder = new ContentBuilder({
|
|
1886
|
+
container: '.container',
|
|
1887
|
+
snippetUrl: 'assets/minimalist-blocks/content.js', // Snippet file
|
|
1888
|
+
snippetPath: 'assets/minimalist-blocks/', // Location of snippets' assets
|
|
1889
|
+
});
|
|
1890
|
+
```
|
|
1891
|
+
You may also need to use the **snippetPathReplace** parameter. Please see the usage in the Snippets section in this documentation.
|
|
1892
|
+
|
|
1893
|
+
#### assets/modules/
|
|
1894
|
+
This is the location of the modules. To change the location:
|
|
1895
|
+
```javascript
|
|
1896
|
+
const builder = new ContentBuilder({
|
|
1897
|
+
container: '.container',
|
|
1898
|
+
modulePath: 'assets/modules/'
|
|
1899
|
+
});
|
|
1900
|
+
```
|
|
1901
|
+
|
|
1902
|
+
Another location you may want to change is the plugins/ folder location, which contains plugin-related files.
|
|
1903
|
+
|
|
1904
|
+
#### contentbuilder/plugins/
|
|
1905
|
+
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.
|
|
1906
|
+
To change the location:
|
|
1907
|
+
```javascript
|
|
1908
|
+
const builder = new ContentBuilder({
|
|
1909
|
+
container: '.container',
|
|
1910
|
+
pluginPath: 'contentbuilder/',
|
|
1911
|
+
});
|
|
1912
|
+
```
|
|
1913
|
+
|