@innovastudio/contentbox 1.4.1 → 1.4.3

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.
@@ -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';
@@ -78389,22 +78403,20 @@ class Rte {
78389
78403
 
78390
78404
  this.builder.setZoomOnArea(); // hide tools
78391
78405
 
78392
- /*
78393
- let tools = this.builderStuff.querySelectorAll('.is-tool');
78394
- Array.prototype.forEach.call(tools, (tool) => {
78395
- tool.style.display = '';
78406
+ let tools = this.builder.doc.querySelectorAll('.is-tool');
78407
+ Array.prototype.forEach.call(tools, tool => {
78408
+ tool.style.display = '';
78396
78409
  });
78397
- let tool = this.builderStuff.querySelector('.is-column-tool');
78410
+ let tool = this.builder.doc.querySelector('.is-column-tool');
78398
78411
  tool.style.display = 'none';
78399
- tools = this.builder.doc.querySelectorAll('.is-row-tool');
78400
- tools.forEach(tool=>{
78401
- tool.style.display = 'none';
78412
+ tools = this.builder.doc.querySelectorAll('.is-row-tool');
78413
+ tools.forEach(tool => {
78414
+ tool.style.display = 'none';
78402
78415
  });
78403
- tools = this.builder.doc.querySelectorAll('.is-rowadd-tool');
78404
- tools.forEach(tool=>{
78405
- tool.style.opacity = 0;
78416
+ tools = this.builder.doc.querySelectorAll('.is-rowadd-tool');
78417
+ tools.forEach(tool => {
78418
+ tool.style.opacity = 0;
78406
78419
  });
78407
- */
78408
78420
 
78409
78421
  if (this.builder.onZoom) {
78410
78422
  let val = this.inpZoomSlider.value;
@@ -78426,23 +78438,27 @@ class Rte {
78426
78438
  });
78427
78439
  } // show & reposition
78428
78440
 
78429
- /*
78441
+
78430
78442
  this.builder.elmTool.repositionElementTool();
78431
- let col = this.builder.activeCol;
78432
- let tool = this.builderStuff.querySelector('.is-column-tool');
78443
+ let col = this.builder.activeCol;
78444
+ let tool = this.builder.doc.querySelector('.is-column-tool');
78433
78445
  tool.style.display = '';
78434
- tool.style.top = (col.getBoundingClientRect().top - 29 + window.pageYOffset) + 'px';
78435
- tool.style.left = (col.getBoundingClientRect().left - 1) + 'px';
78436
- let tools = this.builder.doc.querySelectorAll('.is-row-tool');
78437
- tools.forEach(tool=>{
78438
- tool.style.display = '';
78446
+ tool.style.top = col.getBoundingClientRect().top - 29 + window.pageYOffset + 'px';
78447
+ tool.style.left = col.getBoundingClientRect().left - 1 + 'px';
78448
+ let tools = this.builder.doc.querySelectorAll('.is-row-tool');
78449
+ tools.forEach(tool => {
78450
+ tool.style.display = '';
78439
78451
  });
78440
- tools = this.builder.doc.querySelectorAll('.is-rowadd-tool');
78441
- tools.forEach(tool=>{
78442
- tool.style.opacity = '';
78452
+ tools = this.builder.doc.querySelectorAll('.is-rowadd-tool');
78453
+ tools.forEach(tool => {
78454
+ tool.style.opacity = '';
78443
78455
  });
78444
- */
78445
78456
 
78457
+ if (this.builder.onZoomEnd) {
78458
+ let val = this.rteZoomSlider.value;
78459
+ let scale = val / 100;
78460
+ this.builder.onZoomEnd(scale);
78461
+ }
78446
78462
 
78447
78463
  if (this.builder.onZoomEnd) {
78448
78464
  let val = this.inpZoomSlider.value;
@@ -78467,6 +78483,82 @@ class Rte {
78467
78483
  const h = pop.offsetHeight;
78468
78484
 
78469
78485
  if (!dom.hasClass(pop, 'active')) {
78486
+ // Get realtime status
78487
+ const elm = this.builder.activeElement;
78488
+ let btns = pop.querySelectorAll('.rte-fontsize-options button');
78489
+ Array.prototype.forEach.call(btns, btn => {
78490
+ btn.classList.remove('on'); // clear selection
78491
+ });
78492
+ const arrSizes = this.builder.opts.fontSizeClassValues;
78493
+
78494
+ for (var i = 0; i <= arrSizes.length - 1; i++) {
78495
+ if (dom.hasClass(elm, 'size-' + arrSizes[i])) {
78496
+ // Get current class
78497
+ const btns = pop.querySelectorAll('.rte-fontsize-options button');
78498
+ Array.prototype.forEach.call(btns, btn => {
78499
+ let num = btn.getAttribute('data-value');
78500
+
78501
+ if (parseInt(num) === arrSizes[i]) {
78502
+ btn.classList.add('on');
78503
+ }
78504
+ });
78505
+ }
78506
+ }
78507
+
78508
+ btns = pop.querySelectorAll('.rte-lineheight-options button');
78509
+ Array.prototype.forEach.call(btns, btn => {
78510
+ btn.classList.remove('on'); // clear selection
78511
+ });
78512
+ let classes = this.builder.cssClasses.leading;
78513
+
78514
+ for (let i = 0; i < Object.keys(classes).length; i++) {
78515
+ let className = Object.values(classes)[i];
78516
+
78517
+ if (dom.hasClass(elm, className)) {
78518
+ const btns = pop.querySelectorAll('.rte-lineheight-options button');
78519
+ Array.prototype.forEach.call(btns, btn => {
78520
+ let num = btn.getAttribute('data-value');
78521
+ let val;
78522
+ if (className === classes.leading_10) val = '1';
78523
+ if (className === classes.leading_12) val = '1.2';
78524
+ if (className === classes.leading_14) val = '1.4';
78525
+ if (className === classes.leading_16) val = '1.6';
78526
+ if (className === classes.leading_18) val = '1.8';
78527
+ if (className === classes.leading_20) val = '2';
78528
+ if (className === classes.leading_22) val = '2.2';
78529
+
78530
+ if (num === val) {
78531
+ btn.classList.add('on');
78532
+ }
78533
+ });
78534
+ }
78535
+ }
78536
+
78537
+ btns = pop.querySelectorAll('.rte-letterspacing-options button');
78538
+ Array.prototype.forEach.call(btns, btn => {
78539
+ btn.classList.remove('on'); // clear selection
78540
+ });
78541
+ classes = this.builder.cssClasses.tracking;
78542
+
78543
+ for (let i = 0; i < Object.keys(classes).length; i++) {
78544
+ let className = Object.values(classes)[i];
78545
+
78546
+ if (dom.hasClass(elm, className)) {
78547
+ const btns = pop.querySelectorAll('.rte-letterspacing-options button');
78548
+ Array.prototype.forEach.call(btns, btn => {
78549
+ let num = btn.getAttribute('data-value');
78550
+ let val;
78551
+ if (className === classes.tracking_025) val = '1';
78552
+ if (className === classes.tracking_050) val = '2';
78553
+
78554
+ if (num === val) {
78555
+ btn.classList.add('on');
78556
+ }
78557
+ });
78558
+ }
78559
+ } // /Get realtime status
78560
+
78561
+
78470
78562
  this.util.showRtePop(pop, () => {
78471
78563
  if (this.builder.opts.toolbar === 'left') {
78472
78564
  pop.style.top = top - h / 2 + 20 + 'px';
@@ -78475,7 +78567,8 @@ class Rte {
78475
78567
  } else if (this.builder.opts.toolbar === 'right') {
78476
78568
  pop.style.top = top - h / 2 + 20 + 'px';
78477
78569
  pop.style.left = 'auto';
78478
- const viewportWidth = window.innerWidth;
78570
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
78571
+
78479
78572
  pop.style.right = viewportWidth - left + 9 + 'px';
78480
78573
  } else {
78481
78574
  pop.style.top = top + 54 - 6 + 'px';
@@ -78492,7 +78585,8 @@ class Rte {
78492
78585
  } else if (this.builder.opts.toolbar === 'right') {
78493
78586
  pop.style.top = parseInt(this.rteMoreOptions.style.top) + this.rteMoreOptions.offsetHeight - h + 'px';
78494
78587
  pop.style.left = 'auto';
78495
- const viewportWidth = window.innerWidth;
78588
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
78589
+
78496
78590
  pop.style.right = viewportWidth - left + 9 + 'px';
78497
78591
  } else {
78498
78592
  pop.style.top = top + 54 - 6 + 'px';
@@ -79233,6 +79327,10 @@ class Rte {
79233
79327
  currentFontSize = Number(window.getComputedStyle(container).getPropertyValue('font-size').match(/\d+/)[0]);
79234
79328
  }
79235
79329
 
79330
+ const btns = rteTextSettingOptions.querySelectorAll('.rte-fontsize-options button');
79331
+ Array.prototype.forEach.call(btns, btn => {
79332
+ btn.classList.remove('on'); // clear selection
79333
+ });
79236
79334
  dom.execCommand('font-size', currentFontSize + 1 + 'px', (ok, container) => {
79237
79335
  // 1px is dummy so that it won't be cleaned in util.js (checkStyleIfSameAsParent) because of same size
79238
79336
  if (!ok) {
@@ -79278,6 +79376,10 @@ class Rte {
79278
79376
  util.restoreSelection(); //a must
79279
79377
 
79280
79378
  this.builder.uo.saveForUndo();
79379
+ const btns = rteTextSettingOptions.querySelectorAll('.rte-lineheight-options button');
79380
+ Array.prototype.forEach.call(btns, btn => {
79381
+ btn.classList.remove('on'); // clear selection
79382
+ });
79281
79383
 
79282
79384
  if (this.builder.useCssClasses) {
79283
79385
  const selection = dom.getSelection();
@@ -79459,6 +79561,10 @@ class Rte {
79459
79561
  util.restoreSelection(); //a must
79460
79562
 
79461
79563
  this.builder.uo.saveForUndo();
79564
+ const btns = rteTextSettingOptions.querySelectorAll('.rte-letterspacing-options button');
79565
+ Array.prototype.forEach.call(btns, btn => {
79566
+ btn.classList.remove('on'); // clear selection
79567
+ });
79462
79568
 
79463
79569
  if (this.builder.useCssClasses) {
79464
79570
  const selection = dom.getSelection();
@@ -79512,6 +79618,7 @@ class Rte {
79512
79618
  }
79513
79619
  }
79514
79620
 
79621
+ if (this.builder.activeElement) this.builder.activeElement.style.letterSpacing = '';
79515
79622
  if (newClassName === classes.tracking_000) newClassName = ''; // clear for normal tracking
79516
79623
 
79517
79624
  dom.execCommandClass(newClassName, classes);
@@ -79689,7 +79796,7 @@ class Rte {
79689
79796
  // } else if(this.builder.opts.toolbar === 'right') {
79690
79797
  // pop.style.top = (parseInt(this.rteTool.style.top) + this.rteTool.offsetHeight - h) + 'px'; //(top - (h/2) + 20) + 'px';
79691
79798
  // pop.style.left = 'auto';
79692
- // const viewportWidth = window.innerWidth;
79799
+ // const viewportWidth = document.body.clientWidth;//window.innerWidth;
79693
79800
  // pop.style.right = (viewportWidth - left + 9) + 'px';
79694
79801
  // } else {
79695
79802
  // pop.style.top = (top + 54 - 6) + 'px';
@@ -79725,7 +79832,8 @@ class Rte {
79725
79832
  } else if (this.builder.opts.toolbar === 'right') {
79726
79833
  pop.style.top = top - h / 2 + 20 + 'px';
79727
79834
  pop.style.left = 'auto';
79728
- const viewportWidth = window.innerWidth;
79835
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
79836
+
79729
79837
  pop.style.right = viewportWidth - left + 9 + 'px';
79730
79838
  } else {
79731
79839
  pop.style.top = top + 54 - 6 + 'px';
@@ -79751,7 +79859,8 @@ class Rte {
79751
79859
  } else if (this.builder.opts.toolbar === 'right') {
79752
79860
  pop.style.top = parseInt(this.rteMoreOptions.style.top) + this.rteMoreOptions.offsetHeight - h + 'px';
79753
79861
  pop.style.left = 'auto';
79754
- const viewportWidth = window.innerWidth;
79862
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
79863
+
79755
79864
  pop.style.right = viewportWidth - left + 9 + 'px';
79756
79865
  } else {
79757
79866
  pop.style.top = top + 54 - 6 + 'px';
@@ -79816,7 +79925,8 @@ class Rte {
79816
79925
  pop.style.top = parseFloat(this.rteTool.style.top) + this.rteTool.offsetHeight - h + 'px'; //(top - (h/2) + 20) + 'px';
79817
79926
 
79818
79927
  pop.style.left = 'auto';
79819
- const viewportWidth = window.innerWidth;
79928
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
79929
+
79820
79930
  pop.style.right = viewportWidth - left + 9 + 'px';
79821
79931
  } else {
79822
79932
  const adj = 0;
@@ -79841,7 +79951,7 @@ class Rte {
79841
79951
  // } else if(this.builder.opts.toolbar === 'right') {
79842
79952
  // pop.style.top = (parseInt(this.elementRteTool.style.top) + this.elementRteTool.offsetHeight - h) + 'px'; //(top - (h/2) + 20) + 'px';
79843
79953
  // pop.style.left = 'auto';
79844
- // const viewportWidth = window.innerWidth;
79954
+ // const viewportWidth = document.body.clientWidth;//window.innerWidth;
79845
79955
  // pop.style.right = (viewportWidth - left + 9) + 'px';
79846
79956
  // } else {
79847
79957
  // pop.style.top = (top + 54 - 6) + 'px';
@@ -79890,7 +80000,8 @@ class Rte {
79890
80000
  pop.style.top = parseFloat(this.elementRteTool.style.top) + this.elementRteTool.offsetHeight - h + 'px'; //(top - (h/2) + 20) + 'px';
79891
80001
 
79892
80002
  pop.style.left = 'auto';
79893
- const viewportWidth = window.innerWidth;
80003
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
80004
+
79894
80005
  pop.style.right = viewportWidth - left + 9 + 'px';
79895
80006
  } else {
79896
80007
  const adj = 0;
@@ -81721,7 +81832,8 @@ class Rte {
81721
81832
  }
81722
81833
 
81723
81834
  positionToolbar() {
81724
- const viewportWidth = window.innerWidth;
81835
+ const viewportWidth = document.body.clientWidth; //window.innerWidth;
81836
+
81725
81837
  const viewportHeight = window.innerHeight;
81726
81838
 
81727
81839
  if (this.builder.opts.toolbar === 'left' || this.builder.opts.toolbar === 'right') {
@@ -82147,6 +82259,7 @@ function isAChildOf(parent, child) {
82147
82259
  class Lightbox {
82148
82260
  constructor(builder) {
82149
82261
  this.builder = builder;
82262
+ this.arrow = this.builder.lightboxArrow;
82150
82263
  const util = this.builder.util;
82151
82264
  const builderStuff = this.builder.builderStuff;
82152
82265
  this.util = util;
@@ -82161,42 +82274,76 @@ class Lightbox {
82161
82274
  // }
82162
82275
  // this.builderStuff = builderStuff;
82163
82276
 
82164
- this.id = this.makeid();
82277
+ this.id = this.makeid(); // let html = `
82278
+ // <div class="is-lightbox lightbox-externalvideo-edit" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82279
+ // <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
82280
+ // <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
82281
+ // </button>
82282
+ // <div class="lightbox-content" style="width:100%;">
82283
+ // <div class="embed-responsive embed-responsive-16by9" style="width:100%;">
82284
+ // <iframe tabindex="0" width="560" height="315" src="about:blank" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
82285
+ // </div>
82286
+ // </div>
82287
+ // </div>
82288
+ // <div class="is-lightbox lightbox-video-edit light" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82289
+ // <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
82290
+ // <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
82291
+ // </button>
82292
+ // <div class="lightbox-content" style="width:100%;"></div>
82293
+ // </div>
82294
+ // <div class="is-lightbox lightbox-image-edit light" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82295
+ // <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
82296
+ // <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
82297
+ // </button>
82298
+ // <div class="lightbox-content" style="width:100%;"></div>
82299
+ // </div>
82300
+ // <svg width="0" height="0" style="position:absolute;display:none;">
82301
+ // <defs>
82302
+ // <symbol viewBox="0 0 24 24" id="_${this.id}svgIconClose" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
82303
+ // <path stroke="none" d="M0 0h24v24H0z" fill="none"></path><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
82304
+ // </symbol>
82305
+ // </defs>
82306
+ // </svg>
82307
+ // `;
82308
+
82165
82309
  let html = `
82166
- <div class="is-lightbox lightbox-externalvideo-edit" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82167
- <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
82168
- <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
82169
- </button>
82170
- <div class="lightbox-content" style="width:100%;">
82171
- <div class="embed-responsive embed-responsive-16by9" style="width:100%;">
82172
- <iframe tabindex="0" width="560" height="315" src="about:blank" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
82310
+
82311
+ <div class="is-lightbox lightbox-edit" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82312
+ <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button">
82313
+ <svg><use xlink:href="#__${this.id}svgLightboxClose"></use></svg>
82314
+ </button>
82315
+
82316
+ <div class="lightbox-content" style="width:100%;">
82173
82317
  </div>
82318
+
82319
+ <button class="cmd-lightbox-prev" title="${util.out('Previous')}" type="button" style="top:50%;left:3px;">
82320
+ <svg><use xlink:href="#__${this.id}svgLightboxLeft"></use></svg>
82321
+ </button>
82322
+ <button class="cmd-lightbox-next" title="${util.out('Next')}" type="button" style="top:50%;left:auto;right:3px">
82323
+ <svg><use xlink:href="#__${this.id}svgLightboxRight"></use></svg>
82324
+ </button>
82174
82325
  </div>
82175
- </div>
82176
- <div class="is-lightbox lightbox-video-edit light" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82177
- <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
82178
- <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
82179
- </button>
82180
- <div class="lightbox-content" style="width:100%;"></div>
82181
- </div>
82182
- <div class="is-lightbox lightbox-image-edit light" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82183
- <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
82184
- <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
82185
- </button>
82186
- <div class="lightbox-content" style="width:100%;"></div>
82187
- </div>
82188
- <svg width="0" height="0" style="position:absolute;display:none;">
82189
- <defs>
82190
- <symbol viewBox="0 0 24 24" id="_${this.id}svgIconClose" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
82191
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
82192
- </symbol>
82193
- </defs>
82194
- </svg>
82195
- `;
82326
+
82327
+ <svg width="0" height="0" style="position:absolute;display:none;">
82328
+ <defs>
82329
+ <symbol viewBox="0 0 24 24" id="__${this.id}svgLightboxClose" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
82330
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
82331
+ </symbol>
82332
+ <symbol viewBox="0 0 24 24" id="__${this.id}svgLightboxLeft" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
82333
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
82334
+ <polyline points="15 6 9 12 15 18"></polyline>
82335
+ </symbol>
82336
+ <symbol viewBox="0 0 24 24" id="__${this.id}svgLightboxRight" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
82337
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
82338
+ <polyline points="9 6 15 12 9 18"></polyline>
82339
+ </symbol>
82340
+ </defs>
82341
+ </svg>
82342
+ `;
82196
82343
  dom.appendHtml(this.builderStuff, html);
82197
82344
 
82198
82345
  const close = () => {
82199
- let lightbox = document.querySelector('.is-lightbox.active');
82346
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit.active');
82200
82347
  dom.removeClass(lightbox, 'active');
82201
82348
  const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82202
82349
  btnClose.style.opacity = 0;
@@ -82208,28 +82355,78 @@ class Lightbox {
82208
82355
  iframe.setAttribute('src', 'about:blank');
82209
82356
  }
82210
82357
 
82358
+ const div = lightbox.querySelector('.lightbox-content');
82359
+ if (lightbox.querySelector('video')) div.innerHTML = '';
82211
82360
  lightbox.style.display = '';
82212
82361
  this.builder.preserveSelection = false;
82213
82362
  if (this.elmFocus) this.elmFocus.focus();
82214
82363
  }, 300);
82215
82364
  };
82216
82365
 
82217
- const handleItemKeyDown = e => {
82218
- e.preventDefault();
82219
- e.stopImmediatePropagation();
82366
+ const prev = () => {
82367
+ const list = this.getList();
82368
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit.active');
82369
+ let url = lightbox.getAttribute('data-url');
82370
+ list.forEach(item => {
82371
+ if (url === item.url) {
82372
+ const currentIndex = list.indexOf(item);
82373
+ let prevIndex;
82374
+ prevIndex = (currentIndex - 1) % list.length;
82375
+
82376
+ if (prevIndex === -1) {
82377
+ prevIndex = list.length - 1;
82378
+ }
82379
+
82380
+ this.openThen(list[prevIndex]);
82381
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
82382
+ btnPrev.focus();
82383
+ }
82384
+ });
82385
+ };
82220
82386
 
82387
+ const next = () => {
82388
+ const list = this.getList();
82389
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit.active');
82390
+ let url = lightbox.getAttribute('data-url');
82391
+ list.forEach(item => {
82392
+ if (url === item.url) {
82393
+ const currentIndex = list.indexOf(item);
82394
+ const nextIndex = (currentIndex + 1) % list.length;
82395
+ this.openThen(list[nextIndex]);
82396
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
82397
+ btnNext.focus();
82398
+ }
82399
+ });
82400
+ };
82401
+
82402
+ const handleItemKeyDown = e => {
82221
82403
  if (e.keyCode === 27) {
82222
82404
  // escape key
82223
82405
  close();
82224
- } else if (e.which === 9 && !e.shiftKey) {
82225
- // tab key pressed
82406
+ e.preventDefault();
82407
+ }
82408
+ /*else if ((e.which === 9 && !e.shiftKey)) { // tab key pressed
82226
82409
  let lightbox = document.querySelector('.is-lightbox.active');
82227
82410
  const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82228
82411
  btnClose.focus();
82412
+ e.preventDefault();
82413
+ }*/
82414
+
82415
+
82416
+ if (this.arrow) {
82417
+ if (e.which === 37 && !e.shiftKey) {
82418
+ // left
82419
+ prev();
82420
+ }
82421
+
82422
+ if (e.which === 39 && !e.shiftKey) {
82423
+ // right
82424
+ next();
82425
+ }
82229
82426
  }
82230
82427
  };
82231
82428
 
82232
- const lightboxes = this.builderStuff.querySelectorAll('.lightbox-externalvideo-edit,.lightbox-video-edit,.lightbox-image-edit');
82429
+ const lightboxes = this.builderStuff.querySelectorAll('div.lightbox-edit');
82233
82430
  lightboxes.forEach(lightbox => {
82234
82431
  lightbox.addEventListener('keydown', handleItemKeyDown);
82235
82432
  const btnClose = lightbox.querySelector('.cmd-lightbox-close');
@@ -82247,6 +82444,32 @@ class Lightbox {
82247
82444
  e.preventDefault();
82248
82445
  e.stopImmediatePropagation();
82249
82446
  });
82447
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
82448
+ if (btnPrev) btnPrev.addEventListener('click', e => {
82449
+ prev();
82450
+ e.preventDefault();
82451
+ e.stopImmediatePropagation();
82452
+ });
82453
+ if (btnPrev) btnPrev.addEventListener('keydown', e => {
82454
+ if (e.keyCode === 13 || e.keyCode === 32) {
82455
+ // enter or spacebar key
82456
+ prev();
82457
+ e.preventDefault();
82458
+ }
82459
+ });
82460
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
82461
+ if (btnNext) btnNext.addEventListener('click', e => {
82462
+ next();
82463
+ e.preventDefault();
82464
+ e.stopImmediatePropagation();
82465
+ });
82466
+ if (btnNext) btnNext.addEventListener('keydown', e => {
82467
+ if (e.keyCode === 13 || e.keyCode === 32) {
82468
+ // enter or spacebar key
82469
+ next();
82470
+ e.preventDefault();
82471
+ }
82472
+ });
82250
82473
  }); // this.init();
82251
82474
  } //constructor
82252
82475
 
@@ -82302,21 +82525,89 @@ class Lightbox {
82302
82525
  */
82303
82526
 
82304
82527
 
82528
+ openThen(item) {
82529
+ if (item.type === 'image') {
82530
+ this.programmatically = true;
82531
+ this.openImage(item.url, item.theme, item.color);
82532
+ }
82533
+
82534
+ if (item.type === 'video') {
82535
+ this.programmatically = true;
82536
+ this.openVideo(item.url, item.theme, item.color);
82537
+ }
82538
+
82539
+ if (item.type === 'externalvideo') {
82540
+ this.programmatically = true;
82541
+ this.openExternalVideo(item.url, item.theme, item.color);
82542
+ }
82543
+ }
82544
+
82305
82545
  openImage(url, theme, color) {
82306
82546
  const dom = this.dom;
82307
- if (document.activeElement) this.elmFocus = document.activeElement;
82547
+
82548
+ if (this.builder.doc.activeElement) {
82549
+ this.elmFocus = this.builder.doc.activeElement;
82550
+
82551
+ if (!this.programmatically) {
82552
+ const parent = this.builder.doc.activeElement.closest('[data-gallery]');
82553
+ this.parent = parent;
82554
+ }
82555
+ }
82556
+
82308
82557
  this.builder.preserveSelection = true;
82309
- let lightbox = this.builderStuff.querySelector('div.is-lightbox.lightbox-image-edit'); // in case opened in an iframe (ex. preview)
82558
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit'); // in case opened in an iframe (ex. preview)
82310
82559
 
82311
82560
  if (window.frameElement && !lightbox) {
82312
- lightbox = parent.document.querySelector('.is-lightbox.lightbox-image-edit');
82561
+ lightbox = parent.document.querySelector('.is-lightbox.lightbox-edit');
82562
+ }
82563
+
82564
+ if (!this.programmatically) {
82565
+ const list = this.getList();
82566
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
82567
+ btnPrev.style.opacity = 0;
82568
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
82569
+ btnNext.style.opacity = 0;
82570
+ btnPrev.style.display = 'none';
82571
+ btnNext.style.display = 'none';
82572
+
82573
+ if (list.length > 1 && this.arrow) {
82574
+ btnPrev.style.display = 'flex';
82575
+ btnNext.style.display = 'flex';
82576
+ setTimeout(() => {
82577
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
82578
+ btnPrev.style.opacity = 1;
82579
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
82580
+ btnNext.style.opacity = 1;
82581
+ }, 500);
82582
+ }
82583
+
82584
+ const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82585
+ btnClose.style.opacity = 0;
82586
+ setTimeout(() => {
82587
+ dom.addClass(lightbox, 'active');
82588
+ setTimeout(() => {
82589
+ btnClose.style.opacity = 1;
82590
+ }, 450);
82591
+ }, 10);
82313
82592
  }
82314
82593
 
82315
- const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82316
- btnClose.style.opacity = 0;
82594
+ lightbox.setAttribute('data-url', url);
82595
+ lightbox.classList.remove('lightbox-video');
82596
+ lightbox.classList.remove('lightbox-externalvideo');
82597
+ lightbox.classList.add('lightbox-image');
82317
82598
  if (color) lightbox.style.backgroundColor = color;
82318
82599
  const div = lightbox.querySelector('.lightbox-content');
82319
- div.innerHTML = `<img src="${url}">`;
82600
+
82601
+ if (!this.programmatically) {
82602
+ div.innerHTML = `<img src="${url}">`;
82603
+ } else {
82604
+ div.style.transition = 'all 200ms ease';
82605
+ div.style.opacity = '0';
82606
+ setTimeout(() => {
82607
+ div.innerHTML = `<img src="${url}">`;
82608
+ div.style.opacity = '1';
82609
+ }, 200);
82610
+ }
82320
82611
 
82321
82612
  if (theme === 'light') {
82322
82613
  dom.addClass(lightbox, 'light');
@@ -82328,34 +82619,82 @@ class Lightbox {
82328
82619
 
82329
82620
  lightbox.style.display = 'flex';
82330
82621
  if (!window.frameElement) document.body.style.overflowY = 'hidden';
82331
- setTimeout(() => {
82332
- dom.addClass(lightbox, 'active');
82333
- setTimeout(() => {
82334
- btnClose.style.opacity = 1;
82335
- }, 450);
82336
- }, 10);
82337
82622
  lightbox.focus({
82338
82623
  preventScroll: true
82339
82624
  });
82625
+ this.programmatically = false;
82340
82626
  }
82341
82627
 
82342
82628
  openVideo(url, theme, color) {
82343
82629
  const dom = this.dom;
82344
- if (document.activeElement) this.elmFocus = document.activeElement;
82630
+
82631
+ if (this.builder.doc.activeElement) {
82632
+ this.elmFocus = this.builder.doc.activeElement;
82633
+
82634
+ if (!this.programmatically) {
82635
+ const parent = this.builder.doc.activeElement.closest('[data-gallery]');
82636
+ this.parent = parent;
82637
+ }
82638
+ }
82639
+
82345
82640
  this.builder.preserveSelection = true;
82346
- let lightbox = document.querySelector('.is-lightbox.lightbox-video-edit'); // in case opened in an iframe (ex. preview)
82641
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit'); // in case opened in an iframe (ex. preview)
82347
82642
 
82348
82643
  if (window.frameElement && !lightbox) {
82349
- lightbox = parent.document.querySelector('.is-lightbox.lightbox-video-edit');
82644
+ lightbox = parent.document.querySelector('.is-lightbox.lightbox-edit');
82645
+ }
82646
+
82647
+ if (!this.programmatically) {
82648
+ const list = this.getList();
82649
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
82650
+ btnPrev.style.opacity = 0;
82651
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
82652
+ btnNext.style.opacity = 0;
82653
+ btnPrev.style.display = 'none';
82654
+ btnNext.style.display = 'none';
82655
+
82656
+ if (list.length > 1 && this.arrow) {
82657
+ btnPrev.style.display = 'flex';
82658
+ btnNext.style.display = 'flex';
82659
+ setTimeout(() => {
82660
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
82661
+ btnPrev.style.opacity = 1;
82662
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
82663
+ btnNext.style.opacity = 1;
82664
+ }, 500);
82665
+ }
82666
+
82667
+ const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82668
+ btnClose.style.opacity = 0;
82669
+ setTimeout(() => {
82670
+ dom.addClass(lightbox, 'active');
82671
+ setTimeout(() => {
82672
+ btnClose.style.opacity = 1;
82673
+ }, 450);
82674
+ }, 10);
82350
82675
  }
82351
82676
 
82352
- const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82353
- btnClose.style.opacity = 0;
82677
+ lightbox.setAttribute('data-url', url);
82678
+ lightbox.classList.add('lightbox-video');
82679
+ lightbox.classList.remove('lightbox-externalvideo');
82680
+ lightbox.classList.remove('lightbox-image');
82354
82681
  if (color) lightbox.style.backgroundColor = color;
82355
82682
  const div = lightbox.querySelector('.lightbox-content');
82356
- div.innerHTML = `<video class="is-video-bg" playsinline controls autoplay width="100%">
82357
- <source src="${url}" type="video/mp4">
82358
- </video>`;
82683
+
82684
+ if (!this.programmatically) {
82685
+ div.innerHTML = `<video playsinline controls autoplay width="100%">
82686
+ <source src="${url}" type="video/mp4">
82687
+ </video>`;
82688
+ } else {
82689
+ div.style.transition = 'all 200ms ease';
82690
+ div.style.opacity = '0';
82691
+ setTimeout(() => {
82692
+ div.innerHTML = `<video playsinline controls autoplay width="100%">
82693
+ <source src="${url}" type="video/mp4">
82694
+ </video>`;
82695
+ div.style.opacity = '1';
82696
+ }, 200);
82697
+ }
82359
82698
 
82360
82699
  if (theme === 'light') {
82361
82700
  dom.addClass(lightbox, 'light');
@@ -82367,29 +82706,65 @@ class Lightbox {
82367
82706
 
82368
82707
  lightbox.style.display = 'flex';
82369
82708
  if (!window.frameElement) document.body.style.overflowY = 'hidden';
82370
- setTimeout(() => {
82371
- dom.addClass(lightbox, 'active');
82372
- setTimeout(() => {
82373
- btnClose.style.opacity = 1;
82374
- }, 450);
82375
- }, 10);
82376
82709
  lightbox.focus({
82377
82710
  preventScroll: true
82378
82711
  });
82712
+ this.programmatically = false;
82379
82713
  }
82380
82714
 
82381
82715
  openExternalVideo(url, theme, color) {
82382
82716
  const dom = this.dom;
82383
- if (document.activeElement) this.elmFocus = document.activeElement;
82717
+
82718
+ if (this.builder.doc.activeElement) {
82719
+ this.elmFocus = this.builder.doc.activeElement;
82720
+
82721
+ if (!this.programmatically) {
82722
+ const parent = this.builder.doc.activeElement.closest('[data-gallery]');
82723
+ this.parent = parent;
82724
+ }
82725
+ }
82726
+
82384
82727
  this.builder.preserveSelection = true;
82385
- let lightbox = document.querySelector('.is-lightbox.lightbox-externalvideo-edit'); // in case opened in an iframe (ex. preview)
82728
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit'); // in case opened in an iframe (ex. preview)
82386
82729
 
82387
82730
  if (window.frameElement && !lightbox) {
82388
- lightbox = parent.document.querySelector('.is-lightbox.lightbox-externalvideo-edit');
82731
+ lightbox = parent.document.querySelector('.is-lightbox.lightbox-edit');
82389
82732
  }
82390
82733
 
82391
- const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82392
- btnClose.style.opacity = 0;
82734
+ if (!this.programmatically) {
82735
+ const list = this.getList();
82736
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
82737
+ btnPrev.style.opacity = 0;
82738
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
82739
+ btnNext.style.opacity = 0;
82740
+ btnPrev.style.display = 'none';
82741
+ btnNext.style.display = 'none';
82742
+
82743
+ if (list.length > 1 && this.arrow) {
82744
+ btnPrev.style.display = 'flex';
82745
+ btnNext.style.display = 'flex';
82746
+ setTimeout(() => {
82747
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
82748
+ btnPrev.style.opacity = 1;
82749
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
82750
+ btnNext.style.opacity = 1;
82751
+ }, 500);
82752
+ }
82753
+
82754
+ const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82755
+ btnClose.style.opacity = 0;
82756
+ setTimeout(() => {
82757
+ dom.addClass(lightbox, 'active');
82758
+ setTimeout(() => {
82759
+ btnClose.style.opacity = 1;
82760
+ }, 450);
82761
+ }, 10);
82762
+ }
82763
+
82764
+ lightbox.setAttribute('data-url', url);
82765
+ lightbox.classList.remove('lightbox-video');
82766
+ lightbox.classList.add('lightbox-externalvideo');
82767
+ lightbox.classList.remove('lightbox-image');
82393
82768
  if (color) lightbox.style.backgroundColor = color;
82394
82769
 
82395
82770
  if (theme === 'light') {
@@ -82400,22 +82775,37 @@ class Lightbox {
82400
82775
  dom.removeClass(lightbox, 'light');
82401
82776
  }
82402
82777
 
82403
- const iframe = lightbox.querySelector('iframe');
82404
- url = this.getIframeVideoUrl(url);
82405
- if (url !== '') iframe.setAttribute('src', url);
82406
- lightbox.style.display = 'flex';
82407
- if (!window.frameElement) document.body.style.overflowY = 'hidden';
82408
82778
  const div = lightbox.querySelector('.lightbox-content');
82409
- div.style.width = div.offsetHeight * 16 / 9 + 'px';
82410
- setTimeout(() => {
82411
- dom.addClass(lightbox, 'active');
82779
+
82780
+ if (!this.programmatically) {
82781
+ div.innerHTML = `<div class="embed-responsive embed-responsive-16by9" style="width:100%;">
82782
+ <iframe width="560" height="315" src="about:blank" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
82783
+ </div>`;
82784
+ const iframe = lightbox.querySelector('iframe');
82785
+ url = this.getIframeVideoUrl(url);
82786
+ if (url !== '') iframe.setAttribute('src', url);
82787
+ } else {
82788
+ div.style.transition = 'all 200ms ease';
82789
+ div.style.opacity = '0';
82412
82790
  setTimeout(() => {
82413
- btnClose.style.opacity = 1;
82414
- }, 450);
82415
- }, 10);
82791
+ div.innerHTML = `<div class="embed-responsive embed-responsive-16by9" style="width:100%;">
82792
+ <iframe width="560" height="315" src="about:blank" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
82793
+ </div>`;
82794
+ div.style.opacity = '1';
82795
+ const iframe = lightbox.querySelector('iframe');
82796
+ url = this.getIframeVideoUrl(url);
82797
+ if (url !== '') iframe.setAttribute('src', url);
82798
+ }, 200);
82799
+ }
82800
+
82801
+ lightbox.style.display = 'flex';
82802
+ if (!window.frameElement) document.body.style.overflowY = 'hidden'; // const div = lightbox.querySelector('.lightbox-content');
82803
+ // div.style.width=((div.offsetHeight*16)/9) + 'px';
82804
+
82416
82805
  lightbox.focus({
82417
82806
  preventScroll: true
82418
82807
  });
82808
+ this.programmatically = false;
82419
82809
  }
82420
82810
 
82421
82811
  getIframeVideoUrl(src) {
@@ -82459,6 +82849,88 @@ class Lightbox {
82459
82849
  return text + text2;
82460
82850
  }
82461
82851
 
82852
+ getList() {
82853
+ const arrGallery = [];
82854
+ let blockClickables = this.builder.doc.querySelectorAll('.block-click,.button-click,.is-lightbox');
82855
+
82856
+ if (this.parent) {
82857
+ blockClickables = this.parent.querySelectorAll('.block-click,.button-click,.is-lightbox');
82858
+ }
82859
+
82860
+ blockClickables.forEach(block => {
82861
+ if (!this.parent) {
82862
+ if (block.closest('[data-gallery')) return;
82863
+ }
82864
+
82865
+ let url;
82866
+ let extension;
82867
+
82868
+ if (block.tagName.toLowerCase() === 'a') {
82869
+ url = block.getAttribute('href');
82870
+ extension = url.split('.').pop().split('?')[0].split('#')[0];
82871
+ } else if (block.getAttribute('data-modal-url')) {
82872
+ url = block.getAttribute('data-modal-url');
82873
+ extension = url.split('.').pop().split('?')[0].split('#')[0];
82874
+ }
82875
+
82876
+ let theme = block.getAttribute('data-modal-theme');
82877
+ if (!theme) theme = 'light';
82878
+ const color = block.getAttribute('data-modal-color');
82879
+
82880
+ if (url) {
82881
+ if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm') {
82882
+ arrGallery.push({
82883
+ type: 'image',
82884
+ url: url,
82885
+ theme: theme,
82886
+ color: color
82887
+ });
82888
+ } else if (extension === 'mp4') {
82889
+ arrGallery.push({
82890
+ type: 'video',
82891
+ url: url,
82892
+ theme: 'dark',
82893
+ color: color
82894
+ });
82895
+ } else if (url.toLowerCase().indexOf('youtube.com') !== -1 || url.toLowerCase().indexOf('vimeo.com') !== -1) {
82896
+ arrGallery.push({
82897
+ type: 'externalvideo',
82898
+ url: url,
82899
+ theme: 'dark',
82900
+ color: color
82901
+ });
82902
+ }
82903
+ }
82904
+
82905
+ if (block.getAttribute('data-modal-image')) {
82906
+ url = block.getAttribute('data-modal-image');
82907
+ arrGallery.push({
82908
+ type: 'image',
82909
+ url: url,
82910
+ theme: theme,
82911
+ color: color
82912
+ });
82913
+ } else if (block.getAttribute('data-modal-video')) {
82914
+ url = block.getAttribute('data-modal-video');
82915
+ arrGallery.push({
82916
+ type: 'video',
82917
+ url: url,
82918
+ theme: 'dark',
82919
+ color: color
82920
+ });
82921
+ } else if (block.getAttribute('data-modal-externalvideo')) {
82922
+ url = block.getAttribute('data-modal-externalvideo');
82923
+ arrGallery.push({
82924
+ type: 'externalvideo',
82925
+ url: url,
82926
+ theme: 'dark',
82927
+ color: color
82928
+ });
82929
+ }
82930
+ });
82931
+ return arrGallery;
82932
+ }
82933
+
82462
82934
  } //Lightbox
82463
82935
 
82464
82936
  class ShortcutInfo {
@@ -83078,6 +83550,13 @@ class Resize {
83078
83550
  pane: col,
83079
83551
  onResize: (width, height) => {
83080
83552
  this.builder.util.hideControls();
83553
+ let numOfCols = 1;
83554
+ Array.from(col.parentNode.children).map(item => {
83555
+ if (item.classList.contains('is-row-tool')) return;
83556
+ if (item.classList.contains('is-rowadd-tool')) return;
83557
+ if (item === col) return;
83558
+ numOfCols++;
83559
+ });
83081
83560
 
83082
83561
  if (width) {
83083
83562
  col.style.flex = 'none';
@@ -83101,16 +83580,29 @@ class Resize {
83101
83580
  // Adjust to max
83102
83581
  // percentage = (max / row.offsetWidth) * 100;
83103
83582
  // Or make others auto
83104
- let numOfCols = 1;
83105
83583
  Array.from(col.parentNode.children).map(item => {
83106
83584
  if (item.classList.contains('is-row-tool')) return;
83107
83585
  if (item.classList.contains('is-rowadd-tool')) return; // if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
83108
83586
 
83109
- if (item === col) return; // item.style.width = '100%';
83587
+ if (item === col) return; // // item.style.width = '100%';
83588
+ // if(!item.getAttribute('data-module')) item.style.width = '100%';
83589
+ // item.style.flex = '';
83110
83590
 
83111
- if (!item.getAttribute('data-module')) item.style.width = '100%';
83112
- item.style.flex = '';
83113
- numOfCols++;
83591
+ if (numOfCols === 2) {
83592
+ if (!item.getAttribute('data-module')) {
83593
+ item.style.width = '100%';
83594
+ item.style.flex = '';
83595
+ }
83596
+ } else {
83597
+ // if(!item.getAttribute('data-module') && !item.style.width) {
83598
+ // item.style.width = '100%';
83599
+ // item.style.flex = '';
83600
+ // }
83601
+ if (!item.getAttribute('data-module') && item === col.nextElementSibling) {
83602
+ item.style.width = '100%';
83603
+ item.style.flex = '';
83604
+ }
83605
+ }
83114
83606
  });
83115
83607
 
83116
83608
  if (numOfCols === 1) {
@@ -83140,6 +83632,14 @@ class Resize {
83140
83632
  }
83141
83633
  },
83142
83634
  resizeEnd: () => {
83635
+ let numOfCols = 1;
83636
+ Array.from(col.parentNode.children).map(item => {
83637
+ if (item.classList.contains('is-row-tool')) return;
83638
+ if (item.classList.contains('is-rowadd-tool')) return;
83639
+ if (item === col) return;
83640
+ numOfCols++;
83641
+ });
83642
+
83143
83643
  if (col.style.width) {
83144
83644
  col.style.width = col.offsetWidth + 'px'; // change from % to px
83145
83645
 
@@ -83168,10 +83668,25 @@ class Resize {
83168
83668
  if (item.classList.contains('is-row-tool')) return;
83169
83669
  if (item.classList.contains('is-rowadd-tool')) return; // if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
83170
83670
 
83171
- if (item === col) return; // item.style.width = '100%';
83671
+ if (item === col) return; // // item.style.width = '100%';
83672
+ // if(!item.getAttribute('data-module')) item.style.width = '100%';
83673
+ // item.style.flex = '';
83172
83674
 
83173
- if (!item.getAttribute('data-module')) item.style.width = '100%';
83174
- item.style.flex = '';
83675
+ if (numOfCols === 2) {
83676
+ if (!item.getAttribute('data-module')) {
83677
+ item.style.width = '100%';
83678
+ item.style.flex = '';
83679
+ }
83680
+ } else {
83681
+ // if(!item.getAttribute('data-module') && !item.style.width) {
83682
+ // item.style.width = '100%';
83683
+ // item.style.flex = '';
83684
+ // }
83685
+ if (!item.getAttribute('data-module') && item === col.nextElementSibling) {
83686
+ item.style.width = '100%';
83687
+ item.style.flex = '';
83688
+ }
83689
+ }
83175
83690
  });
83176
83691
  } // /adjust others
83177
83692
  // New: Final fix (if column resized exceeds its max)
@@ -83225,12 +83740,11 @@ class Resize {
83225
83740
  item.style.height = '';
83226
83741
  item.style.minHeight = '';
83227
83742
  });
83228
- } // To position columnTool correctly, add delay.
83743
+ } // // To position columnTool correctly, add delay.
83744
+ // setTimeout(()=>{
83745
+ // col.click();
83746
+ // },30);
83229
83747
 
83230
-
83231
- setTimeout(() => {
83232
- col.click();
83233
- }, 30);
83234
83748
  }
83235
83749
  });
83236
83750
  }
@@ -84380,6 +84894,7 @@ class ContentBuilder {
84380
84894
  //set -1 for no max (use original image width)
84381
84895
  zoom: 1,
84382
84896
  useLightbox: false,
84897
+ lightboxArrow: true,
84383
84898
  imageRenameOnEdit: true,
84384
84899
  disableAutoEmbedVideo: false,
84385
84900
 
@@ -85098,8 +85613,8 @@ class ContentBuilder {
85098
85613
 
85099
85614
  if (!(b || j || m || n || target.tagName.toLowerCase() === 'img')) {
85100
85615
  let imageTool = document.querySelector('#divImageTool');
85101
- imageTool.style.display = '';
85102
- this.activeImage = null;
85616
+ imageTool.style.display = ''; // this.activeImage = null; // Commented => Additional (to prevent lost focus)
85617
+
85103
85618
  let imageResizer = document.querySelector('#divImageResizer');
85104
85619
  imageResizer.style.display = 'none'; // moveable
85105
85620
 
@@ -85117,9 +85632,14 @@ class ContentBuilder {
85117
85632
  if (!(a || b || c || d || f || g || h || i || j || o || isSpecialElement) || rowClicked && !i || containerClicked) {
85118
85633
  // Click anywhere but is not inside builder area, modal, popup, tool or rte, then clear row/column (cell) selection
85119
85634
  if (!this.dom.getSelected()) {
85120
- util.clearActiveCell();
85121
- util.clearControls();
85635
+ if (!document.querySelector('.is-modal.active')) {
85636
+ // Additional (to prevent lost focus)
85637
+ util.clearActiveCell();
85638
+ util.clearControls();
85639
+ }
85122
85640
  }
85641
+
85642
+ this.element.hyperlink.buttonEditor.hide();
85123
85643
  } // Button Modal
85124
85644
 
85125
85645
 
@@ -85859,7 +86379,8 @@ class ContentBuilder {
85859
86379
  }
85860
86380
 
85861
86381
  selectAsset(s) {
85862
- let extension = s.split('.').pop();
86382
+ let extension = s.split('.').pop().split('?')[0].split('#')[0]; //
86383
+
85863
86384
  extension = extension.toLowerCase();
85864
86385
  let ok = false;
85865
86386
 
@@ -86754,7 +87275,7 @@ class ContentBuilder {
86754
87275
 
86755
87276
  if (elm.getAttribute('data-modal-url')) {
86756
87277
  url = elm.getAttribute('data-modal-url');
86757
- let extension = url.split('.').pop();
87278
+ let extension = url.split('.').pop().split('?')[0].split('#')[0]; //
86758
87279
 
86759
87280
  if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm') {
86760
87281
  this.lightbox.openImage(url, theme, color);
@@ -86871,7 +87392,8 @@ class ContentBuilder {
86871
87392
  return false;
86872
87393
  }
86873
87394
 
86874
- let extension = url.split('.').pop();
87395
+ let extension = url.split('.').pop().split('?')[0].split('#')[0]; //
87396
+
86875
87397
  let theme = link.getAttribute('data-modal-theme');
86876
87398
  if (!theme) theme = 'light';
86877
87399
  const color = elm.getAttribute('data-modal-color');
@@ -89220,6 +89742,7 @@ class ContentBox {
89220
89742
  constructor(settings = {}) {
89221
89743
  const defaults = {
89222
89744
  wrapper: '.is-wrapper',
89745
+ previewURL: 'preview.html',
89223
89746
  sectionHoverOutline: false,
89224
89747
  useSidebar: true,
89225
89748
  disableLoadingStatus: false,
@@ -89294,6 +89817,7 @@ class ContentBox {
89294
89817
  }],
89295
89818
  disableConfig: false,
89296
89819
  useLightbox: true,
89820
+ lightboxArrow: true,
89297
89821
  themes: [['#ffffff', '', ''], ['#282828', 'dark', 'contentbuilder/themes/dark.css'], ['#0088dc', 'colored', 'contentbuilder/themes/colored-blue.css'], ['#006add', 'colored', 'contentbuilder/themes/colored-blue6.css'], ['#0a4d92', 'colored', 'contentbuilder/themes/colored-darkblue.css'], ['#96af16', 'colored', 'contentbuilder/themes/colored-green.css'], ['#f3522b', 'colored', 'contentbuilder/themes/colored-orange.css'], ['#b92ea6', 'colored', 'contentbuilder/themes/colored-magenta.css'], ['#e73171', 'colored', 'contentbuilder/themes/colored-pink.css'], ['#782ec5', 'colored', 'contentbuilder/themes/colored-purple.css'], ['#ed2828', 'colored', 'contentbuilder/themes/colored-red.css'], ['#f9930f', 'colored', 'contentbuilder/themes/colored-yellow.css'], ['#13b34b', 'colored', 'contentbuilder/themes/colored-green4.css'], ['#333333', 'colored-dark', 'contentbuilder/themes/colored-dark.css'], ['#dbe5f5', 'light', 'contentbuilder/themes/light-blue.css'], ['#fbe6f2', 'light', 'contentbuilder/themes/light-pink.css'], ['#dcdaf3', 'light', 'contentbuilder/themes/light-purple.css'], ['#ffe9e0', 'light', 'contentbuilder/themes/light-red.css'], ['#fffae5', 'light', 'contentbuilder/themes/light-yellow.css'], ['#ddf3dc', 'light', 'contentbuilder/themes/light-green.css'], ['#c7ebfd', 'light', 'contentbuilder/themes/light-blue2.css'], ['#ffd5f2', 'light', 'contentbuilder/themes/light-pink2.css'], ['#eadafb', 'light', 'contentbuilder/themes/light-purple2.css'], ['#c5d4ff', 'light', 'contentbuilder/themes/light-blue3.css'], ['#ffefb1', 'light', 'contentbuilder/themes/light-yellow2.css'], ['#fefefe', 'light', 'contentbuilder/themes/light-gray3.css'], ['#e5e5e5', 'light', 'contentbuilder/themes/light-gray2.css'], ['#dadada', 'light', 'contentbuilder/themes/light-gray.css'], ['#3f4ec9', 'colored', 'contentbuilder/themes/colored-blue2.css'], ['#6779d9', 'colored', 'contentbuilder/themes/colored-blue4.css'], ['#10b9d7', 'colored', 'contentbuilder/themes/colored-blue3.css'], ['#006add', 'colored', 'contentbuilder/themes/colored-blue5.css'], ['#e92f94', 'colored', 'contentbuilder/themes/colored-pink3.css'], ['#a761d9', 'colored', 'contentbuilder/themes/colored-purple2.css'], ['#f9930f', 'colored', 'contentbuilder/themes/colored-yellow2.css'], ['#f3522b', 'colored', 'contentbuilder/themes/colored-red3.css'], ['#36b741', 'colored', 'contentbuilder/themes/colored-green2.css'], ['#00c17c', 'colored', 'contentbuilder/themes/colored-green3.css'], ['#fb3279', 'colored', 'contentbuilder/themes/colored-pink2.css'], ['#ff6d13', 'colored', 'contentbuilder/themes/colored-orange2.css'], ['#f13535', 'colored', 'contentbuilder/themes/colored-red2.css'], ['#646464', 'colored', 'contentbuilder/themes/colored-gray.css'], ['#3f4ec9', 'dark', 'contentbuilder/themes/dark-blue.css'], ['#0b4d92', 'dark', 'contentbuilder/themes/dark-blue2.css'], ['#006add', 'dark', 'contentbuilder/themes/dark-blue3.css'], ['#5f3ebf', 'dark', 'contentbuilder/themes/dark-purple.css'], ['#e92f69', 'dark', 'contentbuilder/themes/dark-pink.css'], ['#4c4c4c', 'dark', 'contentbuilder/themes/dark-gray.css'], ['#ed2828', 'dark', 'contentbuilder/themes/dark-red.css'], ['#006add', 'colored', 'contentbuilder/themes/colored-blue8.css'], ['#ff7723', 'colored', 'contentbuilder/themes/colored-orange3.css'], ['#ff5722', 'colored', 'contentbuilder/themes/colored-red5.css'], ['#f13535', 'colored', 'contentbuilder/themes/colored-red4.css'], ['#00bd79', 'colored', 'contentbuilder/themes/colored-green5.css'], ['#557ae9', 'colored', 'contentbuilder/themes/colored-blue7.css'], ['#fb3279', 'colored', 'contentbuilder/themes/colored-pink4.css']],
89298
89822
  backgroundColor: '#f1f1f1',
89299
89823
  imageselect: '',
@@ -91807,6 +92331,7 @@ class ContentBox {
91807
92331
  // }, 100);
91808
92332
  // },
91809
92333
  useLightbox: this.settings.useLightbox,
92334
+ lightboxArrow: this.settings.lightboxArrow,
91810
92335
  themes: this.settings.themes,
91811
92336
  moduleConfig: this.settings.moduleConfig,
91812
92337
  onImageSelectClick: this.settings.onImageSelectClick,