@innovastudio/contentbox 1.4.66 → 1.4.67
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/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@innovastudio/contentbox",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.4.
|
4
|
+
"version": "1.4.67",
|
5
5
|
"description": "",
|
6
6
|
"main": "public/contentbox/contentbox.esm.js",
|
7
7
|
"files": [
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"webpack-dev-server": "^4.0.0"
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
|
-
"@innovastudio/contentbuilder": "^1.3.
|
49
|
+
"@innovastudio/contentbuilder": "^1.3.78",
|
50
50
|
"js-beautify": "^1.14.0"
|
51
51
|
}
|
52
52
|
}
|
@@ -19059,15 +19059,18 @@ class Util {
|
|
19059
19059
|
dom.removeClass(elm, 'elm-inspected');
|
19060
19060
|
}); // RTE
|
19061
19061
|
|
19062
|
-
|
19063
|
-
|
19064
|
-
|
19065
|
-
|
19062
|
+
if (this.builder.toolbarDisplay === 'auto') {
|
19063
|
+
let rtetool = builderStuff.querySelector('.is-rte-tool');
|
19064
|
+
if (rtetool) rtetool.style.display = 'none';
|
19065
|
+
let elementRtetool = builderStuff.querySelector('.is-elementrte-tool');
|
19066
|
+
if (elementRtetool) elementRtetool.style.display = 'none'; // Click ok on code view should hide these as well
|
19067
|
+
|
19068
|
+
let rtetoolmore = builderStuff.querySelector('.rte-more-options');
|
19069
|
+
if (rtetoolmore) rtetoolmore.style.display = '';
|
19070
|
+
let elementRtetoolmore = builderStuff.querySelector('.elementrte-more-options');
|
19071
|
+
if (elementRtetoolmore) elementRtetoolmore.style.display = '';
|
19072
|
+
} // Element
|
19066
19073
|
|
19067
|
-
let rtetoolmore = builderStuff.querySelector('.rte-more-options');
|
19068
|
-
if (rtetoolmore) rtetoolmore.style.display = '';
|
19069
|
-
let elementRtetoolmore = builderStuff.querySelector('.elementrte-more-options');
|
19070
|
-
if (elementRtetoolmore) elementRtetoolmore.style.display = ''; // Element
|
19071
19074
|
|
19072
19075
|
elms = this.builder.doc.querySelectorAll('.elm-active');
|
19073
19076
|
Array.prototype.forEach.call(elms, elm => {
|
@@ -79118,6 +79121,7 @@ class Preferences {
|
|
79118
79121
|
<label style="${this.builder.isTouchSupport ? 'display:none;' : 'display:block;'}margin-top:5px;margin-bottom:5px;">
|
79119
79122
|
${util.out('Toolbar position')}:
|
79120
79123
|
<select class="select-editingtoolbar">
|
79124
|
+
<option value="topfull">${util.out('Top (Full Width)')}</option>
|
79121
79125
|
<option value="top">${util.out('Top')}</option>
|
79122
79126
|
<option value="left">${util.out('Left')}</option>
|
79123
79127
|
<option value="right">${util.out('Right')}</option>
|
@@ -79250,8 +79254,8 @@ class Preferences {
|
|
79250
79254
|
// if (localStorage.getItem('_editingtoolbardisplay') !== null) {
|
79251
79255
|
// this.builder.opts.toolbarDisplay = localStorage.getItem('_editingtoolbardisplay');
|
79252
79256
|
// }
|
79253
|
-
|
79254
|
-
|
79257
|
+
// this.builder.opts.toolbarDisplay = 'auto';
|
79258
|
+
// this.setToolbarDisplay(this.builder.opts.toolbarDisplay);
|
79255
79259
|
|
79256
79260
|
if (localStorage.getItem('_snippetssidebardisplay') !== null) {
|
79257
79261
|
this.builder.opts.snippetsSidebarDisplay = localStorage.getItem('_snippetssidebardisplay');
|
@@ -79489,7 +79493,14 @@ class Preferences {
|
|
79489
79493
|
if (this.builder.themes) {
|
79490
79494
|
const n = this.builder.themeIndex;
|
79491
79495
|
if (this.builder.themeIndex) localStorage.setItem('_theme', n);
|
79492
|
-
}
|
79496
|
+
} // clear/hide rte pops
|
79497
|
+
|
79498
|
+
|
79499
|
+
const builderStuff = this.builder.builderStuff;
|
79500
|
+
let rtepops = builderStuff.querySelectorAll('.is-rte-pop');
|
79501
|
+
Array.prototype.forEach.call(rtepops, rtepop => {
|
79502
|
+
rtepop.style.display = '';
|
79503
|
+
});
|
79493
79504
|
}
|
79494
79505
|
|
79495
79506
|
setToolbar(toolbar) {
|
@@ -79497,9 +79508,19 @@ class Preferences {
|
|
79497
79508
|
const builderStuff = this.builder.builderStuff;
|
79498
79509
|
const contentStuff = this.builder.contentStuff;
|
79499
79510
|
|
79500
|
-
if (toolbar === '
|
79511
|
+
if (toolbar === 'topfull') {
|
79512
|
+
builderStuff.setAttribute('toolbarfull', '');
|
79513
|
+
builderStuff.removeAttribute('toolbarleft', '');
|
79514
|
+
builderStuff.removeAttribute('toolbarright', '');
|
79515
|
+
|
79516
|
+
if (this.builder.iframe) {
|
79517
|
+
contentStuff.removeAttribute('toolbarleft', '');
|
79518
|
+
contentStuff.removeAttribute('toolbarright', '');
|
79519
|
+
}
|
79520
|
+
} else if (toolbar === 'top') {
|
79501
79521
|
builderStuff.removeAttribute('toolbarleft', '');
|
79502
79522
|
builderStuff.removeAttribute('toolbarright', '');
|
79523
|
+
builderStuff.removeAttribute('toolbarfull', '');
|
79503
79524
|
|
79504
79525
|
if (this.builder.iframe) {
|
79505
79526
|
contentStuff.removeAttribute('toolbarleft', '');
|
@@ -79508,6 +79529,7 @@ class Preferences {
|
|
79508
79529
|
} else if (toolbar === 'left') {
|
79509
79530
|
builderStuff.setAttribute('toolbarleft', '');
|
79510
79531
|
builderStuff.removeAttribute('toolbarright', '');
|
79532
|
+
builderStuff.removeAttribute('toolbarfull', '');
|
79511
79533
|
|
79512
79534
|
if (this.builder.iframe) {
|
79513
79535
|
contentStuff.setAttribute('toolbarleft', '');
|
@@ -79516,6 +79538,7 @@ class Preferences {
|
|
79516
79538
|
} else if (toolbar === 'right') {
|
79517
79539
|
builderStuff.setAttribute('toolbarright', '');
|
79518
79540
|
builderStuff.removeAttribute('toolbarleft', '');
|
79541
|
+
builderStuff.removeAttribute('toolbarfull', '');
|
79519
79542
|
|
79520
79543
|
if (this.builder.iframe) {
|
79521
79544
|
contentStuff.setAttribute('toolbarright', '');
|
@@ -80083,6 +80106,41 @@ class Rte {
|
|
80083
80106
|
let inpZoomSlider;
|
80084
80107
|
|
80085
80108
|
if (!rteTool) {
|
80109
|
+
if (builder.plugins.length > 0) {
|
80110
|
+
let allButtons = ['|', 'addsnippet', 'bold', 'italic', 'underline', 'formatting', 'color', 'removeformat', 'align', 'textsettings', 'createlink', 'tags', 'undo', 'redo', 'zoom', 'icon', 'image', 'list', 'font', 'formatpara', 'gridtool', 'html', 'preferences', 'more', 'left', 'center', 'right', 'full'];
|
80111
|
+
|
80112
|
+
const filterButtons = myArray => {
|
80113
|
+
let newArray = myArray;
|
80114
|
+
myArray.forEach(item => {
|
80115
|
+
item = item.toLowerCase();
|
80116
|
+
let result = allButtons.filter(btnName => {
|
80117
|
+
return btnName === item;
|
80118
|
+
});
|
80119
|
+
|
80120
|
+
if (result.length === 0) {
|
80121
|
+
// a plugin
|
80122
|
+
result = builder.plugins.filter(plugin => {
|
80123
|
+
// check if plugin registered.
|
80124
|
+
return plugin.name === item;
|
80125
|
+
});
|
80126
|
+
|
80127
|
+
if (result.length === 0) {
|
80128
|
+
// plugin not registered
|
80129
|
+
newArray = newArray.filter(e => e !== item);
|
80130
|
+
}
|
80131
|
+
}
|
80132
|
+
});
|
80133
|
+
return newArray;
|
80134
|
+
};
|
80135
|
+
|
80136
|
+
builder.opts.buttons = filterButtons(builder.opts.buttons);
|
80137
|
+
builder.opts.buttonsMore = filterButtons(builder.opts.buttonsMore);
|
80138
|
+
builder.opts.elementButtons = filterButtons(builder.opts.elementButtons);
|
80139
|
+
builder.opts.elementButtonsMore = filterButtons(builder.opts.elementButtonsMore);
|
80140
|
+
builder.opts.iconButtons = filterButtons(builder.opts.iconButtons);
|
80141
|
+
builder.opts.iconButtonsMore = filterButtons(builder.opts.iconButtonsMore);
|
80142
|
+
}
|
80143
|
+
|
80086
80144
|
let customtag_button = '';
|
80087
80145
|
var customTagsHtml = '';
|
80088
80146
|
|
@@ -82673,7 +82731,48 @@ class Rte {
|
|
82673
82731
|
dom.addClass(this.elementRteMoreOptions, 'deactive');
|
82674
82732
|
}
|
82675
82733
|
}
|
82676
|
-
});
|
82734
|
+
}); // Backward compatible
|
82735
|
+
|
82736
|
+
this.builderStuff.insertAdjacentHTML('afterbegin', `
|
82737
|
+
<style>
|
82738
|
+
#_cbhtml[toolbarfull] .is-rte-tool,
|
82739
|
+
#_cbhtml[toolbarfull] .is-elementrte-tool {
|
82740
|
+
top: 0;
|
82741
|
+
left: 0;
|
82742
|
+
width: 100vw;
|
82743
|
+
align-items: center;
|
82744
|
+
box-shadow: rgba(0, 0, 0, 0.07) -1px 1px 0px 0px;
|
82745
|
+
}
|
82746
|
+
#_cbhtml[toolbarfull] .is-rte-pop {
|
82747
|
+
box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 0px 1px;
|
82748
|
+
}
|
82749
|
+
</style>
|
82750
|
+
`);
|
82751
|
+
/*
|
82752
|
+
if(this.builder.toolbar === 'topfull') {
|
82753
|
+
if(window.getComputedStyle(this.rteTool).getPropertyValue('left') !== '0px') {
|
82754
|
+
this.builderStuff.insertAdjacentHTML('afterbegin', `
|
82755
|
+
<style>
|
82756
|
+
#_cbhtml[toolbarfull] .is-rte-tool,
|
82757
|
+
#_cbhtml[toolbarfull] .is-elementrte-tool {
|
82758
|
+
top: 0;
|
82759
|
+
left: 0;
|
82760
|
+
width: 100vw;
|
82761
|
+
align-items: center;
|
82762
|
+
box-shadow: rgba(0, 0, 0, 0.07) -1px 1px 0px 0px;
|
82763
|
+
}
|
82764
|
+
#_cbhtml[toolbarfull] .is-rte-pop {
|
82765
|
+
box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 0px 1px;
|
82766
|
+
}
|
82767
|
+
</style>
|
82768
|
+
`);
|
82769
|
+
}
|
82770
|
+
}
|
82771
|
+
*/
|
82772
|
+
|
82773
|
+
if (this.builder.toolbarDisplay !== 'auto') {
|
82774
|
+
this.showDefaultToolbar(); // first time
|
82775
|
+
}
|
82677
82776
|
}
|
82678
82777
|
|
82679
82778
|
zoomStart() {
|
@@ -82920,10 +83019,12 @@ class Rte {
|
|
82920
83019
|
let top;
|
82921
83020
|
let left;
|
82922
83021
|
const btnRteMore = this.rteTool.querySelectorAll('button.rte-more');
|
83022
|
+
let btnWidth = 0;
|
82923
83023
|
btnRteMore.forEach(btn => {
|
82924
83024
|
if (btn.getBoundingClientRect().top > 0) {
|
82925
83025
|
top = btn.getBoundingClientRect().top;
|
82926
83026
|
left = btn.getBoundingClientRect().left;
|
83027
|
+
btnWidth = btn.offsetWidth;
|
82927
83028
|
}
|
82928
83029
|
});
|
82929
83030
|
const pop = this.rteMoreOptions;
|
@@ -82950,6 +83051,10 @@ class Rte {
|
|
82950
83051
|
pop.style.left = parseFloat(this.rteTool.style.left) + this.rteTool.offsetWidth - w + adj + 'px'; //(left -(w/2)+23) + 'px';
|
82951
83052
|
|
82952
83053
|
pop.style.right = 'auto';
|
83054
|
+
|
83055
|
+
if (this.builderStuff.hasAttribute('toolbarfull')) {
|
83056
|
+
pop.style.left = left - w + btnWidth + 'px';
|
83057
|
+
}
|
82953
83058
|
}
|
82954
83059
|
} // showElementRteMore() {
|
82955
83060
|
// const btnElementRteMore = this.elementRteTool.querySelector('button.rte-more');
|
@@ -83025,6 +83130,10 @@ class Rte {
|
|
83025
83130
|
pop.style.left = parseFloat(this.elementRteTool.style.left) + this.elementRteTool.offsetWidth - w + adj + 'px'; //(left -(w/2)+23) + 'px';
|
83026
83131
|
|
83027
83132
|
pop.style.right = 'auto';
|
83133
|
+
|
83134
|
+
if (this.builderStuff.hasAttribute('toolbarfull')) {
|
83135
|
+
pop.style.left = left - w + btnElementRteMore.offsetWidth + 'px';
|
83136
|
+
}
|
83028
83137
|
}
|
83029
83138
|
}
|
83030
83139
|
|
@@ -83172,6 +83281,60 @@ class Rte {
|
|
83172
83281
|
dom.cleanClassSize(elm, classname); // dom.cleanUnusedSpan(elm); // will remove empty spans that makes selection changes
|
83173
83282
|
}
|
83174
83283
|
|
83284
|
+
hideAlignButtons() {
|
83285
|
+
let btns = this.elementRteTool.querySelectorAll('button[data-align]');
|
83286
|
+
let separator1;
|
83287
|
+
let separator2;
|
83288
|
+
Array.prototype.forEach.call(btns, btn => {
|
83289
|
+
btn.style.display = 'none';
|
83290
|
+
|
83291
|
+
if (btn.previousElementSibling) {
|
83292
|
+
if (btn.previousElementSibling.classList.contains('rte-separator')) {
|
83293
|
+
separator1 = btn.previousElementSibling;
|
83294
|
+
}
|
83295
|
+
}
|
83296
|
+
|
83297
|
+
if (btn.nextElementSibling) {
|
83298
|
+
if (btn.nextElementSibling.classList.contains('rte-separator')) {
|
83299
|
+
separator2 = btn.nextElementSibling;
|
83300
|
+
}
|
83301
|
+
}
|
83302
|
+
});
|
83303
|
+
|
83304
|
+
if (separator1 && separator2) {
|
83305
|
+
separator2.style.display = 'none';
|
83306
|
+
}
|
83307
|
+
|
83308
|
+
btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
|
83309
|
+
|
83310
|
+
Array.prototype.forEach.call(btns, btn => {
|
83311
|
+
btn.style.display = 'none';
|
83312
|
+
});
|
83313
|
+
}
|
83314
|
+
|
83315
|
+
showAlignButtons() {
|
83316
|
+
let separators = this.elementRteTool.querySelectorAll('.rte-separator');
|
83317
|
+
Array.prototype.forEach.call(separators, separator => {
|
83318
|
+
separator.style.display = '';
|
83319
|
+
});
|
83320
|
+
let btns = this.elementRteTool.querySelectorAll('button[data-align]');
|
83321
|
+
Array.prototype.forEach.call(btns, btn => {
|
83322
|
+
btn.style.display = '';
|
83323
|
+
});
|
83324
|
+
btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
|
83325
|
+
|
83326
|
+
Array.prototype.forEach.call(btns, btn => {
|
83327
|
+
btn.style.display = '';
|
83328
|
+
});
|
83329
|
+
}
|
83330
|
+
|
83331
|
+
showDefaultToolbar() {
|
83332
|
+
this.elementRteTool.style.display = 'flex';
|
83333
|
+
this.rteTool.style.display = 'none';
|
83334
|
+
this.hideAlignButtons();
|
83335
|
+
this.positionToolbar();
|
83336
|
+
}
|
83337
|
+
|
83175
83338
|
click(col) {
|
83176
83339
|
const dom = this.dom;
|
83177
83340
|
let elm = this.builder.inspectedElement;
|
@@ -83213,32 +83376,32 @@ class Rte {
|
|
83213
83376
|
if ((elm.tagName.toLowerCase() === 'img' || dom.hasClass(elm, 'is-social') || dom.hasClass(elm, 'is-rounded-button-medium') || dom.hasClass(elm, 'cell-active')) && !dom.getSelected()) {
|
83214
83377
|
if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
|
83215
83378
|
this.elementRteTool.style.display = 'flex';
|
83216
|
-
this.rteTool.style.display = 'none';
|
83217
|
-
|
83218
|
-
|
83219
|
-
|
83220
|
-
|
83221
|
-
|
83379
|
+
this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
|
83380
|
+
// Array.prototype.forEach.call(btns, (btn) => {
|
83381
|
+
// btn.style.display = '';
|
83382
|
+
// });
|
83383
|
+
// btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
|
83384
|
+
// Array.prototype.forEach.call(btns, (btn) => {
|
83385
|
+
// btn.style.display = '';
|
83386
|
+
// });
|
83222
83387
|
|
83223
|
-
|
83224
|
-
btn.style.display = '';
|
83225
|
-
});
|
83388
|
+
this.showAlignButtons();
|
83226
83389
|
this.positionToolbar();
|
83227
83390
|
}
|
83228
83391
|
} else if (dom.hasClass(elm, 'spacer') || elm.tagName.toLowerCase() === 'video' || dom.hasClass(elm, 'ovl') || col.getAttribute('data-html')) {
|
83229
83392
|
//|| col===elm
|
83230
83393
|
if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
|
83231
83394
|
this.elementRteTool.style.display = 'flex';
|
83232
|
-
this.rteTool.style.display = 'none';
|
83233
|
-
|
83234
|
-
|
83235
|
-
|
83236
|
-
|
83237
|
-
|
83395
|
+
this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
|
83396
|
+
// Array.prototype.forEach.call(btns, (btn) => {
|
83397
|
+
// btn.style.display = 'none';
|
83398
|
+
// });
|
83399
|
+
// btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
|
83400
|
+
// Array.prototype.forEach.call(btns, (btn) => {
|
83401
|
+
// btn.style.display = 'none';
|
83402
|
+
// });
|
83238
83403
|
|
83239
|
-
|
83240
|
-
btn.style.display = 'none';
|
83241
|
-
});
|
83404
|
+
this.hideAlignButtons();
|
83242
83405
|
this.positionToolbar();
|
83243
83406
|
}
|
83244
83407
|
} else if (dom.hasClass(elm, 'icon')) {
|
@@ -83261,16 +83424,16 @@ class Rte {
|
|
83261
83424
|
} else {
|
83262
83425
|
if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
|
83263
83426
|
this.elementRteTool.style.display = 'flex';
|
83264
|
-
this.rteTool.style.display = 'none';
|
83265
|
-
|
83266
|
-
|
83267
|
-
|
83268
|
-
|
83269
|
-
|
83427
|
+
this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
|
83428
|
+
// Array.prototype.forEach.call(btns, (btn) => {
|
83429
|
+
// btn.style.display = '';
|
83430
|
+
// });
|
83431
|
+
// btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
|
83432
|
+
// Array.prototype.forEach.call(btns, (btn) => {
|
83433
|
+
// btn.style.display = '';
|
83434
|
+
// });
|
83270
83435
|
|
83271
|
-
|
83272
|
-
btn.style.display = '';
|
83273
|
-
});
|
83436
|
+
this.showAlignButtons();
|
83274
83437
|
this.positionToolbar();
|
83275
83438
|
}
|
83276
83439
|
}
|
@@ -83278,16 +83441,16 @@ class Rte {
|
|
83278
83441
|
} else {
|
83279
83442
|
if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
|
83280
83443
|
this.elementRteTool.style.display = 'flex';
|
83281
|
-
this.rteTool.style.display = 'none';
|
83282
|
-
|
83283
|
-
|
83284
|
-
|
83285
|
-
|
83286
|
-
|
83444
|
+
this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
|
83445
|
+
// Array.prototype.forEach.call(btns, (btn) => {
|
83446
|
+
// btn.style.display = 'none';
|
83447
|
+
// });
|
83448
|
+
// btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
|
83449
|
+
// Array.prototype.forEach.call(btns, (btn) => {
|
83450
|
+
// btn.style.display = 'none';
|
83451
|
+
// });
|
83287
83452
|
|
83288
|
-
|
83289
|
-
btn.style.display = 'none';
|
83290
|
-
});
|
83453
|
+
this.hideAlignButtons();
|
83291
83454
|
this.positionToolbar();
|
83292
83455
|
}
|
83293
83456
|
}
|
@@ -89318,6 +89481,10 @@ class ContentBuilder {
|
|
89318
89481
|
// Additional (to prevent lost focus)
|
89319
89482
|
util.clearActiveCell();
|
89320
89483
|
util.clearControls();
|
89484
|
+
|
89485
|
+
if (this.toolbarDisplay !== 'auto') {
|
89486
|
+
this.rte.showDefaultToolbar();
|
89487
|
+
}
|
89321
89488
|
}
|
89322
89489
|
}
|
89323
89490
|
|