@innovastudio/contentbuilder 1.3.13 → 1.3.15
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
CHANGED
|
@@ -828,7 +828,7 @@ Here is an example of a snippet definition in the snippet file:
|
|
|
828
828
|
'thumbnail': 'preview/basic-01.png',
|
|
829
829
|
'category': '120',
|
|
830
830
|
'html':
|
|
831
|
-
'<div class="row
|
|
831
|
+
'<div class="row">' +
|
|
832
832
|
'<div class="column full">' +
|
|
833
833
|
'<h1>My Heading Text</h1>' +
|
|
834
834
|
'</div>' +
|
|
@@ -869,7 +869,7 @@ The HTML content for the snippets needs to be formatted in a simple grid. Here a
|
|
|
869
869
|
Single column:
|
|
870
870
|
|
|
871
871
|
```html
|
|
872
|
-
<div class="row
|
|
872
|
+
<div class="row">
|
|
873
873
|
<div class="column full">
|
|
874
874
|
...
|
|
875
875
|
</div>
|
|
@@ -879,7 +879,7 @@ Single column:
|
|
|
879
879
|
Two columns:
|
|
880
880
|
|
|
881
881
|
```html
|
|
882
|
-
<div class="row
|
|
882
|
+
<div class="row">
|
|
883
883
|
<div class="column half">
|
|
884
884
|
...
|
|
885
885
|
</div>
|
|
@@ -892,7 +892,7 @@ Two columns:
|
|
|
892
892
|
Three columns:
|
|
893
893
|
|
|
894
894
|
```html
|
|
895
|
-
<div class="row
|
|
895
|
+
<div class="row">
|
|
896
896
|
<div class="column third">
|
|
897
897
|
...
|
|
898
898
|
</div>
|
|
@@ -908,7 +908,7 @@ Three columns:
|
|
|
908
908
|
Four columns:
|
|
909
909
|
|
|
910
910
|
```html
|
|
911
|
-
<div class="row
|
|
911
|
+
<div class="row">
|
|
912
912
|
<div class="fourth third">
|
|
913
913
|
...
|
|
914
914
|
</div>
|
|
@@ -927,7 +927,7 @@ Four columns:
|
|
|
927
927
|
Five columns:
|
|
928
928
|
|
|
929
929
|
```html
|
|
930
|
-
<div class="row
|
|
930
|
+
<div class="row">
|
|
931
931
|
<div class="column fifth">
|
|
932
932
|
...
|
|
933
933
|
</div>
|
|
@@ -949,7 +949,7 @@ Five columns:
|
|
|
949
949
|
Six columns:
|
|
950
950
|
|
|
951
951
|
```html
|
|
952
|
-
<div class="row
|
|
952
|
+
<div class="row">
|
|
953
953
|
<div class="column sixth">
|
|
954
954
|
...
|
|
955
955
|
</div>
|
|
@@ -985,7 +985,7 @@ const builder = new ContentBuilder({
|
|
|
985
985
|
Other layouts you can use to create your own your snippets:
|
|
986
986
|
|
|
987
987
|
```html
|
|
988
|
-
<div class="row
|
|
988
|
+
<div class="row">
|
|
989
989
|
<div class="column two-third">
|
|
990
990
|
...
|
|
991
991
|
</div>
|
|
@@ -1000,7 +1000,7 @@ Result:
|
|
|
1000
1000
|

|
|
1001
1001
|
|
|
1002
1002
|
```html
|
|
1003
|
-
<div class="row
|
|
1003
|
+
<div class="row">
|
|
1004
1004
|
<div class="column two-fourth">
|
|
1005
1005
|
...
|
|
1006
1006
|
</div>
|
|
@@ -1015,7 +1015,7 @@ Result:
|
|
|
1015
1015
|

|
|
1016
1016
|
|
|
1017
1017
|
```html
|
|
1018
|
-
<div class="row
|
|
1018
|
+
<div class="row">
|
|
1019
1019
|
<div class="column two-fifth">
|
|
1020
1020
|
...
|
|
1021
1021
|
</div>
|
|
@@ -1030,7 +1030,7 @@ Result:
|
|
|
1030
1030
|

|
|
1031
1031
|
|
|
1032
1032
|
```html
|
|
1033
|
-
<div class="row
|
|
1033
|
+
<div class="row">
|
|
1034
1034
|
<div class="column two-sixth">
|
|
1035
1035
|
...
|
|
1036
1036
|
</div>
|
|
@@ -1053,7 +1053,7 @@ You can also add some behavior in your HTML snippets:
|
|
|
1053
1053
|
|
|
1054
1054
|
- To make a column not editable, add the **data-noedit** attribute to the column, for example:
|
|
1055
1055
|
```html
|
|
1056
|
-
<div class="row
|
|
1056
|
+
<div class="row">
|
|
1057
1057
|
<div class="column full" data-noedit>
|
|
1058
1058
|
...
|
|
1059
1059
|
</div>
|
|
@@ -1062,7 +1062,7 @@ You can also add some behavior in your HTML snippets:
|
|
|
1062
1062
|
|
|
1063
1063
|
- To make a column not editable and cannot be deleted, moved or duplicated, add the **data-protected** attribute to the column, for example:
|
|
1064
1064
|
```html
|
|
1065
|
-
<div class="row
|
|
1065
|
+
<div class="row">
|
|
1066
1066
|
<div class="column full" data-protected>
|
|
1067
1067
|
...
|
|
1068
1068
|
</div>
|
|
@@ -1870,6 +1870,20 @@ builder.pasteHtmlAtCaret(html);
|
|
|
1870
1870
|
```
|
|
1871
1871
|
You will need to place the cursor on the content where you want to paste the HTML.
|
|
1872
1872
|
|
|
1873
|
+
## Insert Custom HTML Snippet Programmatically
|
|
1874
|
+
|
|
1875
|
+
To insert custom HTML snippet programmatically, you can pass your HTML snippet in the **addSnippet()** method:
|
|
1876
|
+
|
|
1877
|
+
```javascript
|
|
1878
|
+
builder.addSnippet(`
|
|
1879
|
+
<div class="row">
|
|
1880
|
+
<div class="column">
|
|
1881
|
+
<h3>Hello World!</h3>
|
|
1882
|
+
</div>
|
|
1883
|
+
</div>
|
|
1884
|
+
`);
|
|
1885
|
+
```
|
|
1886
|
+
|
|
1873
1887
|
## Element Selection
|
|
1874
1888
|
|
|
1875
1889
|
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).
|
|
@@ -2090,6 +2104,23 @@ const builder = new ContentBuilder({
|
|
|
2090
2104
|
});
|
|
2091
2105
|
```
|
|
2092
2106
|
|
|
2107
|
+
## Text Settings
|
|
2108
|
+
|
|
2109
|
+
With Text Settings on the toolbar, you can adjust font size, font weight, line spacing (line height) and letter spacing.
|
|
2110
|
+
|
|
2111
|
+

|
|
2112
|
+
|
|
2113
|
+
If the Bold button on the toolbar is sufficient for you, you can hide the font weight settings by setting the **simpleTextSettings** parameter to true.
|
|
2114
|
+
|
|
2115
|
+
```javascript
|
|
2116
|
+
const builder = new ContentBuilder({
|
|
2117
|
+
container: '.container',
|
|
2118
|
+
simpleTextSettings: true,
|
|
2119
|
+
});
|
|
2120
|
+
```
|
|
2121
|
+
|
|
2122
|
+

|
|
2123
|
+
|
|
2093
2124
|
## Undo & Redo
|
|
2094
2125
|
|
|
2095
2126
|
You can programmatically perform an undo or redo action.
|
package/package.json
CHANGED
|
@@ -14522,7 +14522,25 @@ class HtmlUtil {
|
|
|
14522
14522
|
range.setStart(area, 0);
|
|
14523
14523
|
area.appendChild(range.createContextualFragment(html));
|
|
14524
14524
|
let builderActive = this.builder.doc.querySelector('.builder-active');
|
|
14525
|
-
if (builderActive) this.builder.applyBehaviorOn(builderActive);
|
|
14525
|
+
if (builderActive) this.builder.applyBehaviorOn(builderActive);
|
|
14526
|
+
/*else {
|
|
14527
|
+
const builders = this.builder.doc.querySelectorAll(this.builder.opts.container);
|
|
14528
|
+
if(builders.length > 1) {
|
|
14529
|
+
const cell = util.cellSelected();
|
|
14530
|
+
if(!cell) {
|
|
14531
|
+
// Return first instance
|
|
14532
|
+
area = builders[0];
|
|
14533
|
+
} else {
|
|
14534
|
+
// Return active instance
|
|
14535
|
+
area = cell.parentNode.parentNode;
|
|
14536
|
+
}
|
|
14537
|
+
} else {
|
|
14538
|
+
// Single instance
|
|
14539
|
+
area = builders[0];
|
|
14540
|
+
}
|
|
14541
|
+
this.builder.applyBehaviorOn(area);
|
|
14542
|
+
}*/
|
|
14543
|
+
//Trigger Change event
|
|
14526
14544
|
|
|
14527
14545
|
this.builder.opts.onChange(); //Trigger Render event
|
|
14528
14546
|
|
|
@@ -14750,9 +14768,9 @@ class HtmlUtil {
|
|
|
14750
14768
|
|
|
14751
14769
|
|
|
14752
14770
|
let columnMore = builderStuff.querySelector('.is-pop.columnmore');
|
|
14753
|
-
columnMore.style.display = '';
|
|
14771
|
+
if (columnMore) columnMore.style.display = '';
|
|
14754
14772
|
let rowMore = builderStuff.querySelector('.is-pop.rowmore');
|
|
14755
|
-
rowMore.style.display = '';
|
|
14773
|
+
if (rowMore) rowMore.style.display = '';
|
|
14756
14774
|
this.builder.codeEditorMode = mode;
|
|
14757
14775
|
this.builder.codeEditorArea = area;
|
|
14758
14776
|
let codeEditor = viewhtml.querySelector('.input-code-editor');
|
|
@@ -50038,6 +50056,8 @@ class Image$1 {
|
|
|
50038
50056
|
}
|
|
50039
50057
|
|
|
50040
50058
|
newname = basename + '-edit' + this.util.makeId();
|
|
50059
|
+
newname = newname.replaceAll('%20', '-'); // fix 404 error after file upload
|
|
50060
|
+
|
|
50041
50061
|
img.setAttribute('data-filename', newname + '.' + extension);
|
|
50042
50062
|
}
|
|
50043
50063
|
|
|
@@ -50098,7 +50118,9 @@ class Image$1 {
|
|
|
50098
50118
|
this.imageTool.style.display = '';
|
|
50099
50119
|
}, 1000);
|
|
50100
50120
|
} else {
|
|
50101
|
-
|
|
50121
|
+
elm.onload = () => {
|
|
50122
|
+
this.refresh();
|
|
50123
|
+
};
|
|
50102
50124
|
}
|
|
50103
50125
|
}
|
|
50104
50126
|
|
|
@@ -50173,7 +50195,9 @@ class Image$1 {
|
|
|
50173
50195
|
this.builder.moveable.updateRect();
|
|
50174
50196
|
document.querySelector('.moveable-control-box').style.display = 'none';
|
|
50175
50197
|
}
|
|
50176
|
-
|
|
50198
|
+
|
|
50199
|
+
this.util.repositionColumnTool();
|
|
50200
|
+
}, 0); // refesh() is called after img onload, so no need to have a delay.
|
|
50177
50201
|
}
|
|
50178
50202
|
}
|
|
50179
50203
|
|
|
@@ -65755,7 +65779,7 @@ class Rte {
|
|
|
65755
65779
|
}
|
|
65756
65780
|
|
|
65757
65781
|
if (this.builder.opts.toolbarAddSnippetButton && html_elementrte.indexOf('rte-addsnippet') === -1 && html_elementrtemore.indexOf('rte-addsnippet') === -1) {
|
|
65758
|
-
html_elementrte = `<button tabindex="-1" title="${util.out('Add Snippet')}" class="rte-addsnippet"><svg class="is-icon-flex" style="width:18px;height:18px;margin-top:-1px;"><use xlink:href="#ion-ios-plus-empty"></use></svg></button>` + html_rte;
|
|
65782
|
+
html_elementrte = `<button tabindex="-1" title="${util.out('Add Snippet')}" class="rte-addsnippet"><svg class="is-icon-flex" style="width:18px;height:18px;margin-top:-1px;"><use xlink:href="#ion-ios-plus-empty"></use></svg></button>` + html_elementrte; //html_rte;
|
|
65759
65783
|
}
|
|
65760
65784
|
|
|
65761
65785
|
if (html_elementrtemore !== '' && html_elementrte.indexOf('rte-more') === -1) {
|
|
@@ -65786,7 +65810,7 @@ class Rte {
|
|
|
65786
65810
|
}
|
|
65787
65811
|
|
|
65788
65812
|
if (this.builder.opts.toolbarAddSnippetButton && html_iconrte.indexOf('rte-addsnippet') === -1 && html_iconrtemore.indexOf('rte-addsnippet') === -1) {
|
|
65789
|
-
html_iconrte = `<button tabindex="-1" title="${util.out('Add Snippet')}" class="rte-addsnippet"><svg class="is-icon-flex" style="width:18px;height:18px;margin-top:-1px;"><use xlink:href="#ion-ios-plus-empty"></use></svg></button>` + html_rte;
|
|
65813
|
+
html_iconrte = `<button tabindex="-1" title="${util.out('Add Snippet')}" class="rte-addsnippet"><svg class="is-icon-flex" style="width:18px;height:18px;margin-top:-1px;"><use xlink:href="#ion-ios-plus-empty"></use></svg></button>` + html_iconrte; //html_rte;
|
|
65790
65814
|
}
|
|
65791
65815
|
|
|
65792
65816
|
if (html_iconrtemore !== '' && html_iconrte.indexOf('rte-more') === -1) {
|
|
@@ -73972,7 +73996,7 @@ class ContentBuilder {
|
|
|
73972
73996
|
useCssClasses: true,
|
|
73973
73997
|
useButtonPlugin: false,
|
|
73974
73998
|
enableDragResize: true,
|
|
73975
|
-
simpleTextSettings:
|
|
73999
|
+
simpleTextSettings: false
|
|
73976
74000
|
}; // obj.preserveSelection = true; (can be set programmatically) to prevent click that clears selection on external custom modal.
|
|
73977
74001
|
|
|
73978
74002
|
this.opts = Object.assign(this, defaults, opts);
|