@innovastudio/contentbox 1.4.1 → 1.4.2

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
- "version": "1.4.1",
4
3
  "type": "module",
4
+ "version": "1.4.2",
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.2",
49
+ "@innovastudio/contentbuilder": "^1.3.4",
50
50
  "js-beautify": "^1.14.0"
51
51
  }
52
52
  }
@@ -77537,7 +77537,8 @@ class Rte {
77537
77537
  } else if (this.builder.opts.toolbar === 'right') {
77538
77538
  pop.style.top = top - h / 2 + 20 + 'px';
77539
77539
  pop.style.left = 'auto';
77540
- const viewportWidth = window.innerWidth;
77540
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77541
+
77541
77542
  pop.style.right = viewportWidth - left + 9 + 'px';
77542
77543
  } else {
77543
77544
  pop.style.top = top + 54 - 6 + 'px';
@@ -77573,7 +77574,8 @@ class Rte {
77573
77574
  } else if (this.builder.opts.toolbar === 'right') {
77574
77575
  pop.style.top = top - h / 2 + 20 + 'px';
77575
77576
  pop.style.left = 'auto';
77576
- const viewportWidth = window.innerWidth;
77577
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77578
+
77577
77579
  pop.style.right = viewportWidth - left + 9 + 'px';
77578
77580
  } else {
77579
77581
  pop.style.top = top + 54 - 6 + 'px';
@@ -77608,7 +77610,8 @@ class Rte {
77608
77610
  } else if (this.builder.opts.toolbar === 'right') {
77609
77611
  pop.style.top = top - h / 2 + 20 + 'px';
77610
77612
  pop.style.left = 'auto';
77611
- const viewportWidth = window.innerWidth;
77613
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77614
+
77612
77615
  pop.style.right = viewportWidth - left + 9 + 'px';
77613
77616
  } else {
77614
77617
  pop.style.top = top + 54 - 6 + 'px';
@@ -77693,7 +77696,8 @@ class Rte {
77693
77696
  } else if (this.builder.opts.toolbar === 'right') {
77694
77697
  pop.style.top = top - h / 2 + 20 + 'px';
77695
77698
  pop.style.left = 'auto';
77696
- const viewportWidth = window.innerWidth;
77699
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77700
+
77697
77701
  pop.style.right = viewportWidth - left + 9 + 'px';
77698
77702
  } else {
77699
77703
  pop.style.top = top + 54 - 6 + 'px';
@@ -77710,7 +77714,8 @@ class Rte {
77710
77714
  } else if (this.builder.opts.toolbar === 'right') {
77711
77715
  pop.style.top = parseInt(this.rteMoreOptions.style.top) + this.rteMoreOptions.offsetHeight - h + 'px';
77712
77716
  pop.style.left = 'auto';
77713
- const viewportWidth = window.innerWidth;
77717
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77718
+
77714
77719
  pop.style.right = viewportWidth - left + 9 + 'px';
77715
77720
  } else {
77716
77721
  pop.style.top = top + 54 - 6 + 'px';
@@ -77819,7 +77824,8 @@ class Rte {
77819
77824
  } else if (this.builder.opts.toolbar === 'right') {
77820
77825
  pop.style.top = top - h / 2 + 20 + 'px';
77821
77826
  pop.style.left = 'auto';
77822
- const viewportWidth = window.innerWidth;
77827
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77828
+
77823
77829
  pop.style.right = viewportWidth - left + 9 + 'px';
77824
77830
  } else {
77825
77831
  pop.style.top = top + 54 - 6 + 'px';
@@ -77836,7 +77842,8 @@ class Rte {
77836
77842
  } else if (this.builder.opts.toolbar === 'right') {
77837
77843
  pop.style.top = parseInt(this.rteMoreOptions.style.top) + this.rteMoreOptions.offsetHeight - h + 'px';
77838
77844
  pop.style.left = 'auto';
77839
- const viewportWidth = window.innerWidth;
77845
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77846
+
77840
77847
  pop.style.right = viewportWidth - left + 9 + 'px';
77841
77848
  } else {
77842
77849
  pop.style.top = top + 54 - 6 + 'px';
@@ -77895,7 +77902,8 @@ class Rte {
77895
77902
  } else if (this.builder.opts.toolbar === 'right') {
77896
77903
  pop.style.top = top - h / 2 + 20 + 'px';
77897
77904
  pop.style.left = 'auto';
77898
- const viewportWidth = window.innerWidth;
77905
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77906
+
77899
77907
  pop.style.right = viewportWidth - left + 9 + 'px';
77900
77908
  } else {
77901
77909
  pop.style.top = top + 54 - 6 + 'px';
@@ -77912,7 +77920,8 @@ class Rte {
77912
77920
  } else if (this.builder.opts.toolbar === 'right') {
77913
77921
  pop.style.top = parseInt(this.rteMoreOptions.style.top) + this.rteMoreOptions.offsetHeight - h + 'px';
77914
77922
  pop.style.left = 'auto';
77915
- const viewportWidth = window.innerWidth;
77923
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77924
+
77916
77925
  pop.style.right = viewportWidth - left + 9 + 'px';
77917
77926
  } else {
77918
77927
  pop.style.top = top + 54 - 6 + 'px';
@@ -77974,7 +77983,8 @@ class Rte {
77974
77983
  pop.style.top = this.rteTool.style.top; //(top - (h/2) + 20) + 'px';
77975
77984
 
77976
77985
  pop.style.left = 'auto';
77977
- const viewportWidth = window.innerWidth;
77986
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
77987
+
77978
77988
  pop.style.right = viewportWidth - left + 9 + 'px';
77979
77989
  } else {
77980
77990
  pop.style.top = top + 54 - 6 + 'px';
@@ -78202,7 +78212,8 @@ class Rte {
78202
78212
  } else if (this.builder.opts.toolbar === 'right') {
78203
78213
  pop.style.top = top - h / 2 + 20 + 'px';
78204
78214
  pop.style.left = 'auto';
78205
- const viewportWidth = window.innerWidth;
78215
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
78216
+
78206
78217
  pop.style.right = viewportWidth - left + 9 + 'px';
78207
78218
  } else {
78208
78219
  pop.style.top = top + 54 - 6 + 'px';
@@ -78228,7 +78239,8 @@ class Rte {
78228
78239
  } else if (this.builder.opts.toolbar === 'right') {
78229
78240
  pop.style.top = parseInt(this.rteMoreOptions.style.top) + this.rteMoreOptions.offsetHeight - h + 'px';
78230
78241
  pop.style.left = 'auto';
78231
- const viewportWidth = window.innerWidth;
78242
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
78243
+
78232
78244
  pop.style.right = viewportWidth - left + 9 + 'px';
78233
78245
  } else {
78234
78246
  pop.style.top = top + 54 - 6 + 'px'; // pop.style.left = (left -(w/2)+23) + 'px';
@@ -78245,7 +78257,8 @@ class Rte {
78245
78257
  } else if (this.builder.opts.toolbar === 'right') {
78246
78258
  pop.style.top = top - h / 2 + 20 + 'px';
78247
78259
  pop.style.left = 'auto';
78248
- const viewportWidth = window.innerWidth;
78260
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
78261
+
78249
78262
  pop.style.right = viewportWidth - left + 9 + 'px';
78250
78263
  } else {
78251
78264
  pop.style.top = top + 54 - 6 + 'px';
@@ -78270,7 +78283,8 @@ class Rte {
78270
78283
  } else if (this.builder.opts.toolbar === 'right') {
78271
78284
  pop.style.top = parseInt(this.elementRteMoreOptions.style.top) + this.elementRteMoreOptions.offsetHeight - h + 'px';
78272
78285
  pop.style.left = 'auto';
78273
- const viewportWidth = window.innerWidth;
78286
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
78287
+
78274
78288
  pop.style.right = viewportWidth - left + 9 + 'px';
78275
78289
  } else {
78276
78290
  pop.style.top = top + 54 - 6 + 'px'; // pop.style.left = (left -(w/2)+23) + 'px';
@@ -78467,6 +78481,82 @@ class Rte {
78467
78481
  const h = pop.offsetHeight;
78468
78482
 
78469
78483
  if (!dom.hasClass(pop, 'active')) {
78484
+ // Get realtime status
78485
+ const elm = this.builder.activeElement;
78486
+ let btns = pop.querySelectorAll('.rte-fontsize-options button');
78487
+ Array.prototype.forEach.call(btns, btn => {
78488
+ btn.classList.remove('on'); // clear selection
78489
+ });
78490
+ const arrSizes = this.builder.opts.fontSizeClassValues;
78491
+
78492
+ for (var i = 0; i <= arrSizes.length - 1; i++) {
78493
+ if (dom.hasClass(elm, 'size-' + arrSizes[i])) {
78494
+ // Get current class
78495
+ const btns = pop.querySelectorAll('.rte-fontsize-options button');
78496
+ Array.prototype.forEach.call(btns, btn => {
78497
+ let num = btn.getAttribute('data-value');
78498
+
78499
+ if (parseInt(num) === arrSizes[i]) {
78500
+ btn.classList.add('on');
78501
+ }
78502
+ });
78503
+ }
78504
+ }
78505
+
78506
+ btns = pop.querySelectorAll('.rte-lineheight-options button');
78507
+ Array.prototype.forEach.call(btns, btn => {
78508
+ btn.classList.remove('on'); // clear selection
78509
+ });
78510
+ let classes = this.builder.cssClasses.leading;
78511
+
78512
+ for (let i = 0; i < Object.keys(classes).length; i++) {
78513
+ let className = Object.values(classes)[i];
78514
+
78515
+ if (dom.hasClass(elm, className)) {
78516
+ const btns = pop.querySelectorAll('.rte-lineheight-options button');
78517
+ Array.prototype.forEach.call(btns, btn => {
78518
+ let num = btn.getAttribute('data-value');
78519
+ let val;
78520
+ if (className === classes.leading_10) val = '1';
78521
+ if (className === classes.leading_12) val = '1.2';
78522
+ if (className === classes.leading_14) val = '1.4';
78523
+ if (className === classes.leading_16) val = '1.6';
78524
+ if (className === classes.leading_18) val = '1.8';
78525
+ if (className === classes.leading_20) val = '2';
78526
+ if (className === classes.leading_22) val = '2.2';
78527
+
78528
+ if (num === val) {
78529
+ btn.classList.add('on');
78530
+ }
78531
+ });
78532
+ }
78533
+ }
78534
+
78535
+ btns = pop.querySelectorAll('.rte-letterspacing-options button');
78536
+ Array.prototype.forEach.call(btns, btn => {
78537
+ btn.classList.remove('on'); // clear selection
78538
+ });
78539
+ classes = this.builder.cssClasses.tracking;
78540
+
78541
+ for (let i = 0; i < Object.keys(classes).length; i++) {
78542
+ let className = Object.values(classes)[i];
78543
+
78544
+ if (dom.hasClass(elm, className)) {
78545
+ const btns = pop.querySelectorAll('.rte-letterspacing-options button');
78546
+ Array.prototype.forEach.call(btns, btn => {
78547
+ let num = btn.getAttribute('data-value');
78548
+ let val;
78549
+ if (className === classes.tracking_025) val = '1';
78550
+ if (className === classes.tracking_050) val = '2';
78551
+
78552
+ if (num === val) {
78553
+ btn.classList.add('on');
78554
+ }
78555
+ });
78556
+ }
78557
+ } // /Get realtime status
78558
+
78559
+
78470
78560
  this.util.showRtePop(pop, () => {
78471
78561
  if (this.builder.opts.toolbar === 'left') {
78472
78562
  pop.style.top = top - h / 2 + 20 + 'px';
@@ -78475,7 +78565,8 @@ class Rte {
78475
78565
  } else if (this.builder.opts.toolbar === 'right') {
78476
78566
  pop.style.top = top - h / 2 + 20 + 'px';
78477
78567
  pop.style.left = 'auto';
78478
- const viewportWidth = window.innerWidth;
78568
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
78569
+
78479
78570
  pop.style.right = viewportWidth - left + 9 + 'px';
78480
78571
  } else {
78481
78572
  pop.style.top = top + 54 - 6 + 'px';
@@ -78492,7 +78583,8 @@ class Rte {
78492
78583
  } else if (this.builder.opts.toolbar === 'right') {
78493
78584
  pop.style.top = parseInt(this.rteMoreOptions.style.top) + this.rteMoreOptions.offsetHeight - h + 'px';
78494
78585
  pop.style.left = 'auto';
78495
- const viewportWidth = window.innerWidth;
78586
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
78587
+
78496
78588
  pop.style.right = viewportWidth - left + 9 + 'px';
78497
78589
  } else {
78498
78590
  pop.style.top = top + 54 - 6 + 'px';
@@ -79233,6 +79325,10 @@ class Rte {
79233
79325
  currentFontSize = Number(window.getComputedStyle(container).getPropertyValue('font-size').match(/\d+/)[0]);
79234
79326
  }
79235
79327
 
79328
+ const btns = rteTextSettingOptions.querySelectorAll('.rte-fontsize-options button');
79329
+ Array.prototype.forEach.call(btns, btn => {
79330
+ btn.classList.remove('on'); // clear selection
79331
+ });
79236
79332
  dom.execCommand('font-size', currentFontSize + 1 + 'px', (ok, container) => {
79237
79333
  // 1px is dummy so that it won't be cleaned in util.js (checkStyleIfSameAsParent) because of same size
79238
79334
  if (!ok) {
@@ -79278,6 +79374,10 @@ class Rte {
79278
79374
  util.restoreSelection(); //a must
79279
79375
 
79280
79376
  this.builder.uo.saveForUndo();
79377
+ const btns = rteTextSettingOptions.querySelectorAll('.rte-lineheight-options button');
79378
+ Array.prototype.forEach.call(btns, btn => {
79379
+ btn.classList.remove('on'); // clear selection
79380
+ });
79281
79381
 
79282
79382
  if (this.builder.useCssClasses) {
79283
79383
  const selection = dom.getSelection();
@@ -79459,6 +79559,10 @@ class Rte {
79459
79559
  util.restoreSelection(); //a must
79460
79560
 
79461
79561
  this.builder.uo.saveForUndo();
79562
+ const btns = rteTextSettingOptions.querySelectorAll('.rte-letterspacing-options button');
79563
+ Array.prototype.forEach.call(btns, btn => {
79564
+ btn.classList.remove('on'); // clear selection
79565
+ });
79462
79566
 
79463
79567
  if (this.builder.useCssClasses) {
79464
79568
  const selection = dom.getSelection();
@@ -79689,7 +79793,7 @@ class Rte {
79689
79793
  // } else if(this.builder.opts.toolbar === 'right') {
79690
79794
  // pop.style.top = (parseInt(this.rteTool.style.top) + this.rteTool.offsetHeight - h) + 'px'; //(top - (h/2) + 20) + 'px';
79691
79795
  // pop.style.left = 'auto';
79692
- // const viewportWidth = window.innerWidth;
79796
+ // const viewportWidth = document.body.clientWidth;//window.innerWidth;
79693
79797
  // pop.style.right = (viewportWidth - left + 9) + 'px';
79694
79798
  // } else {
79695
79799
  // pop.style.top = (top + 54 - 6) + 'px';
@@ -79725,7 +79829,8 @@ class Rte {
79725
79829
  } else if (this.builder.opts.toolbar === 'right') {
79726
79830
  pop.style.top = top - h / 2 + 20 + 'px';
79727
79831
  pop.style.left = 'auto';
79728
- const viewportWidth = window.innerWidth;
79832
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
79833
+
79729
79834
  pop.style.right = viewportWidth - left + 9 + 'px';
79730
79835
  } else {
79731
79836
  pop.style.top = top + 54 - 6 + 'px';
@@ -79751,7 +79856,8 @@ class Rte {
79751
79856
  } else if (this.builder.opts.toolbar === 'right') {
79752
79857
  pop.style.top = parseInt(this.rteMoreOptions.style.top) + this.rteMoreOptions.offsetHeight - h + 'px';
79753
79858
  pop.style.left = 'auto';
79754
- const viewportWidth = window.innerWidth;
79859
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
79860
+
79755
79861
  pop.style.right = viewportWidth - left + 9 + 'px';
79756
79862
  } else {
79757
79863
  pop.style.top = top + 54 - 6 + 'px';
@@ -79816,7 +79922,8 @@ class Rte {
79816
79922
  pop.style.top = parseFloat(this.rteTool.style.top) + this.rteTool.offsetHeight - h + 'px'; //(top - (h/2) + 20) + 'px';
79817
79923
 
79818
79924
  pop.style.left = 'auto';
79819
- const viewportWidth = window.innerWidth;
79925
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
79926
+
79820
79927
  pop.style.right = viewportWidth - left + 9 + 'px';
79821
79928
  } else {
79822
79929
  const adj = 0;
@@ -79841,7 +79948,7 @@ class Rte {
79841
79948
  // } else if(this.builder.opts.toolbar === 'right') {
79842
79949
  // pop.style.top = (parseInt(this.elementRteTool.style.top) + this.elementRteTool.offsetHeight - h) + 'px'; //(top - (h/2) + 20) + 'px';
79843
79950
  // pop.style.left = 'auto';
79844
- // const viewportWidth = window.innerWidth;
79951
+ // const viewportWidth = document.body.clientWidth;//window.innerWidth;
79845
79952
  // pop.style.right = (viewportWidth - left + 9) + 'px';
79846
79953
  // } else {
79847
79954
  // pop.style.top = (top + 54 - 6) + 'px';
@@ -79890,7 +79997,8 @@ class Rte {
79890
79997
  pop.style.top = parseFloat(this.elementRteTool.style.top) + this.elementRteTool.offsetHeight - h + 'px'; //(top - (h/2) + 20) + 'px';
79891
79998
 
79892
79999
  pop.style.left = 'auto';
79893
- const viewportWidth = window.innerWidth;
80000
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
80001
+
79894
80002
  pop.style.right = viewportWidth - left + 9 + 'px';
79895
80003
  } else {
79896
80004
  const adj = 0;
@@ -81721,7 +81829,8 @@ class Rte {
81721
81829
  }
81722
81830
 
81723
81831
  positionToolbar() {
81724
- const viewportWidth = window.innerWidth;
81832
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
81833
+
81725
81834
  const viewportHeight = window.innerHeight;
81726
81835
 
81727
81836
  if (this.builder.opts.toolbar === 'left' || this.builder.opts.toolbar === 'right') {
@@ -82208,6 +82317,8 @@ class Lightbox {
82208
82317
  iframe.setAttribute('src', 'about:blank');
82209
82318
  }
82210
82319
 
82320
+ const div = lightbox.querySelector('.lightbox-content');
82321
+ if (lightbox.querySelector('video')) div.innerHTML = '';
82211
82322
  lightbox.style.display = '';
82212
82323
  this.builder.preserveSelection = false;
82213
82324
  if (this.elmFocus) this.elmFocus.focus();
@@ -85098,8 +85209,8 @@ class ContentBuilder {
85098
85209
 
85099
85210
  if (!(b || j || m || n || target.tagName.toLowerCase() === 'img')) {
85100
85211
  let imageTool = document.querySelector('#divImageTool');
85101
- imageTool.style.display = '';
85102
- this.activeImage = null;
85212
+ imageTool.style.display = ''; // this.activeImage = null; // Commented => Additional (to prevent lost focus)
85213
+
85103
85214
  let imageResizer = document.querySelector('#divImageResizer');
85104
85215
  imageResizer.style.display = 'none'; // moveable
85105
85216
 
@@ -85117,8 +85228,11 @@ class ContentBuilder {
85117
85228
  if (!(a || b || c || d || f || g || h || i || j || o || isSpecialElement) || rowClicked && !i || containerClicked) {
85118
85229
  // Click anywhere but is not inside builder area, modal, popup, tool or rte, then clear row/column (cell) selection
85119
85230
  if (!this.dom.getSelected()) {
85120
- util.clearActiveCell();
85121
- util.clearControls();
85231
+ if (!document.querySelector('.is-modal.active')) {
85232
+ // Additional (to prevent lost focus)
85233
+ util.clearActiveCell();
85234
+ util.clearControls();
85235
+ }
85122
85236
  }
85123
85237
  } // Button Modal
85124
85238
 
@@ -85859,7 +85973,8 @@ class ContentBuilder {
85859
85973
  }
85860
85974
 
85861
85975
  selectAsset(s) {
85862
- let extension = s.split('.').pop();
85976
+ let extension = s.split('.').pop().split('?')[0].split('#')[0]; //
85977
+
85863
85978
  extension = extension.toLowerCase();
85864
85979
  let ok = false;
85865
85980
 
@@ -86754,7 +86869,7 @@ class ContentBuilder {
86754
86869
 
86755
86870
  if (elm.getAttribute('data-modal-url')) {
86756
86871
  url = elm.getAttribute('data-modal-url');
86757
- let extension = url.split('.').pop();
86872
+ let extension = url.split('.').pop().split('?')[0].split('#')[0]; //
86758
86873
 
86759
86874
  if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm') {
86760
86875
  this.lightbox.openImage(url, theme, color);
@@ -86871,7 +86986,8 @@ class ContentBuilder {
86871
86986
  return false;
86872
86987
  }
86873
86988
 
86874
- let extension = url.split('.').pop();
86989
+ let extension = url.split('.').pop().split('?')[0].split('#')[0]; //
86990
+
86875
86991
  let theme = link.getAttribute('data-modal-theme');
86876
86992
  if (!theme) theme = 'light';
86877
86993
  const color = elm.getAttribute('data-modal-color');
@@ -89220,6 +89336,7 @@ class ContentBox {
89220
89336
  constructor(settings = {}) {
89221
89337
  const defaults = {
89222
89338
  wrapper: '.is-wrapper',
89339
+ previewURL: 'preview.html',
89223
89340
  sectionHoverOutline: false,
89224
89341
  useSidebar: true,
89225
89342
  disableLoadingStatus: false,