@innovastudio/contentbox 1.6.91 → 1.6.92

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.91",
4
+ "version": "1.6.92",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "types": "index.d.ts",
@@ -54,7 +54,7 @@
54
54
  "ws": "^8.13.0"
55
55
  },
56
56
  "dependencies": {
57
- "@innovastudio/contentbuilder": "^1.5.77",
57
+ "@innovastudio/contentbuilder": "^1.5.79",
58
58
  "js-beautify": "^1.14.0",
59
59
  "sortablejs": "^1.15.2"
60
60
  }
@@ -13193,6 +13193,11 @@ class PanelBox {
13193
13193
  <button title="${out('Increase')}" data-content-size="+"><svg><use xlink:href="#icon-plus2"></use></svg></button>
13194
13194
  </div>
13195
13195
 
13196
+ <label class="label checkbox mt-3" style="margin-bottom:15px">
13197
+ <input type="checkbox" class="chk-lock-contentsize" />
13198
+ <span>${out('Lock Content Size')}</span>
13199
+ </label>
13200
+
13196
13201
  <div class="flex">
13197
13202
  <div class="mr-4">
13198
13203
  <div class="label mt-2">${out('Position')}:</div>
@@ -13729,6 +13734,11 @@ class PanelBox {
13729
13734
  chkParallax.addEventListener('click', () => {
13730
13735
  let isParallax = chkParallax.checked;
13731
13736
  this.box.parallaxContent(isParallax);
13737
+ });
13738
+ const chkLockContentSize = panel.querySelector('.chk-lock-contentsize');
13739
+ chkLockContentSize.addEventListener('click', () => {
13740
+ let isLockContentSize = chkLockContentSize.checked;
13741
+ this.box.lockContentSize(isLockContentSize);
13732
13742
  }); // Text
13733
13743
 
13734
13744
  const btnTextAlign = panel.querySelectorAll('[data-align]');
@@ -14285,6 +14295,16 @@ class PanelBox {
14285
14295
  chkParallax.checked = true;
14286
14296
  }
14287
14297
  }
14298
+ } // Lock Content Size
14299
+
14300
+
14301
+ const chkLockContentSize = panel.querySelector('.chk-lock-contentsize');
14302
+ chkLockContentSize.checked = false;
14303
+
14304
+ if (container) {
14305
+ if (container.classList.contains('v3')) {
14306
+ chkLockContentSize.checked = true;
14307
+ }
14288
14308
  } // Text Color
14289
14309
 
14290
14310
 
@@ -27883,10 +27903,10 @@ const renderQuickAdd = builder => {
27883
27903
  elm = quickadd.querySelector('.add-video');
27884
27904
  dom.addEventListener(elm, 'click', () => {
27885
27905
  const mode = quickadd.getAttribute('data-mode');
27886
- let html = `<video style="width: 100%;" loop="" autoplay="">
27906
+ let html = `<video style="width: 100%;" loop="" playsinline="" muted="" autoplay="">
27887
27907
  <source src="${builder.opts.snippetPath}example.mp4" type="video/mp4"></video>`;
27888
27908
  if (builder.opts.snippetSampleVideo) {
27889
- html = `<video style="width: 100%;" loop="" autoplay="">
27909
+ html = `<video style="width: 100%;" loop="" playsinline="" muted="" autoplay="">
27890
27910
  <source src="${builder.opts.snippetSampleVideo}" type="video/mp4"></video>`;
27891
27911
  }
27892
27912
  util.addContent(html, mode);
@@ -31723,15 +31743,15 @@ class Util$1 {
31723
31743
  } else {
31724
31744
  newelement.click();
31725
31745
  }
31726
- const builderStuff = this.builder.builderStuff;
31727
- let quickadd = builderStuff.querySelector('.quickadd');
31728
- this.hidePop(quickadd);
31729
31746
 
31730
31747
  // LATER: auto scroll
31731
31748
 
31732
31749
  // LATER: If image, then it needs time to load (resulting incorrect position), so hide element tool.
31733
31750
  }
31734
31751
 
31752
+ const builderStuff = this.builder.builderStuff;
31753
+ let quickadd = builderStuff.querySelector('.quickadd');
31754
+ if (quickadd) this.hidePop(quickadd);
31735
31755
  if (this.builder.useCssClasses) {
31736
31756
  let builderActive = this.builder.doc.querySelector('.builder-active');
31737
31757
  if (builderActive) dom.contentReformat(builderActive, this.builder.cssClasses);
@@ -41026,6 +41046,16 @@ class HtmlUtil {
41026
41046
  imgUrl = convertMediaUrl(imgUrl);
41027
41047
  elm.setAttribute('href', `${imgUrl}`);
41028
41048
  }
41049
+ if (elm.tagName.toLowerCase() === 'a') {
41050
+ //lightbox
41051
+ let s = elm.getAttribute('href');
41052
+ let extension = s.split('.').pop().split('?')[0].split('#')[0]; //
41053
+ extension = extension.toLowerCase();
41054
+ if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm' || extension === 'webp' || extension === 'mp4' || extension === 'mp3') {
41055
+ let mediaUrl = convertMediaUrl(s);
41056
+ elm.setAttribute('href', `${mediaUrl}`);
41057
+ }
41058
+ }
41029
41059
  }
41030
41060
  });
41031
41061
  }
@@ -44265,6 +44295,7 @@ const renderSnippetPanel = (builder, snippetOpen) => {
44265
44295
  block.offsetWidth / 2;
44266
44296
  let x = (snippetX - block.offsetWidth / 2 - rectContainer.left) / docContainer.offsetWidth * 100;
44267
44297
  let y = (snippetY - block.offsetHeight / 2 - rectContainer.top) / docContainer.offsetHeight * 100;
44298
+ if (y < 0) y = 15; // if block is not fully loaded, block height may be incorrect (y can be negative). Adjust to 15%.
44268
44299
  block.style.top = y + '%';
44269
44300
  block.style.left = x + '%';
44270
44301
  block.removeAttribute('data-new-dummy');
@@ -73168,7 +73199,7 @@ class ButtonEditor {
73168
73199
  <div class="flex flex-row" style="margin:15px 0 0">
73169
73200
  <div class="flex flex-col" style="margin-right: 40px;">
73170
73201
  <div>
73171
- <span>${util.out('Border Color')}</span>:
73202
+ <span>${util.out('Border Style')}</span>:
73172
73203
  </div>
73173
73204
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
73174
73205
  <button title="${util.out('Transparent')}" data-command="transparent" class="border-color-command" style="margin-right:4px">${util.out('Transparent')}</button>
@@ -73358,7 +73389,7 @@ class ButtonEditor {
73358
73389
 
73359
73390
  <div class="flex flex-col" style="margin:15px 0 0">
73360
73391
  <div>
73361
- <span>${util.out('Border Color')}</span>:
73392
+ <span>${util.out('Border Style')}</span>:
73362
73393
  </div>
73363
73394
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
73364
73395
  <button title="${util.out('Transparent')}" data-command="transparent" class="border-color-hover-command" style="margin-right:4px">${util.out('Transparent')}</button>
@@ -76954,6 +76985,12 @@ class Video {
76954
76985
  } else {
76955
76986
  inpAutoplay.checked = false;
76956
76987
  }
76988
+ const inpMuted = videoModal.querySelector('.input-video-muted');
76989
+ if (video.hasAttribute('muted')) {
76990
+ inpMuted.checked = true;
76991
+ } else {
76992
+ inpMuted.checked = false;
76993
+ }
76957
76994
  util.showModal(videoModal, true, () => {
76958
76995
  btn.removeAttribute('data-focus');
76959
76996
  btn.focus();
@@ -76997,6 +77034,9 @@ class Video {
76997
77034
  <label style="display:block;margin-top:5px;">
76998
77035
  <input class="input-video-autoplay" id="__input_video_autoplay" type="checkbox" /> ${util.out('Autoplay')}&nbsp;
76999
77036
  </label>
77037
+ <label style="display:block;margin-top:5px;">
77038
+ <input class="input-video-muted" id="__input_video_muted" type="checkbox" /> ${util.out('Muted')}&nbsp;
77039
+ </label>
77000
77040
 
77001
77041
  <div style="text-align:right;margin-top:14px;">
77002
77042
  <button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
@@ -77075,6 +77115,11 @@ class Video {
77075
77115
  } else {
77076
77116
  video.removeAttribute('autoplay');
77077
77117
  }
77118
+ if (videoModal.querySelector('.input-video-muted').checked) {
77119
+ video.setAttribute('muted', '');
77120
+ } else {
77121
+ video.removeAttribute('muted');
77122
+ }
77078
77123
  if (videoModal.querySelector('.input-url').value !== '') {
77079
77124
  let url = videoModal.querySelector('.input-url').value;
77080
77125
  let source = video.querySelector('source');
@@ -94717,15 +94762,15 @@ class Rte {
94717
94762
  activeCol = this.builder.activeCol;
94718
94763
  spans = activeCol.querySelectorAll('span');
94719
94764
  Array.prototype.forEach.call(spans, span => {
94720
- let attr = span.getAttribute('data-keep');
94765
+ let attr = span.hasAttribute('data-keep');
94721
94766
  if (!attr) {
94722
94767
  span.outerHTML = span.innerHTML;
94723
94768
  }
94724
94769
  });
94725
94770
  Array.prototype.forEach.call(spans, span => {
94726
- let attr = span.getAttribute('data-keep');
94771
+ let attr = span.hasAttribute('data-keep');
94727
94772
  if (attr) {
94728
- dom.removeAttribute(span, 'data-keep');
94773
+ span.removeAttribute('data-keep');
94729
94774
  }
94730
94775
  });
94731
94776
  this.getState();
@@ -123635,18 +123680,21 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
123635
123680
  }
123636
123681
 
123637
123682
  if (this.dom.textSelection()) {
123638
- if (e.keyCode === '38') {
123683
+ if (e.keyCode === 38) {
123639
123684
  // Up arrow
123640
123685
  this.util.saveSelection();
123641
- } else if (e.keyCode === '40') {
123686
+ } else if (e.keyCode === 40) {
123642
123687
  // Down arrow
123643
123688
  this.util.saveSelection();
123644
- } else if (e.keyCode === '37') {
123689
+ } else if (e.keyCode === 37) {
123645
123690
  // Left arrow
123646
123691
  this.util.saveSelection();
123647
- } else if (e.keyCode === '39') {
123692
+ } else if (e.keyCode === 39) {
123648
123693
  // Right arrow
123649
123694
  this.util.saveSelection();
123695
+ } else if (e.keyCode === 13) {
123696
+ // Enter
123697
+ this.util.saveSelection();
123650
123698
  }
123651
123699
  }
123652
123700
 
@@ -138817,6 +138865,18 @@ class Box {
138817
138865
  this.builder.onChange();
138818
138866
  }
138819
138867
 
138868
+ lockContentSize(isLock) {
138869
+ this.builder.editor.saveForUndo();
138870
+ let activeBox = this.builder.activeBox;
138871
+ let container = activeBox.querySelector('.is-builder');
138872
+
138873
+ if (isLock) {
138874
+ container.classList.add('v3');
138875
+ } else {
138876
+ container.classList.remove('v3');
138877
+ }
138878
+ }
138879
+
138820
138880
  parallaxContent(isParallax) {
138821
138881
  this.builder.editor.saveForUndo();
138822
138882
  let activeBox = this.builder.activeBox;
@@ -160273,65 +160333,93 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
160273
160333
 
160274
160334
 
160275
160335
  boxRender() {
160336
+ if (!this.linksWithClickListeners) {
160337
+ this.linksWithClickListeners = new Set();
160338
+ }
160339
+
160340
+ const links = this.wrapperEl.querySelectorAll('.is-box .is-overlay a'); // eg. slider links
160341
+
160342
+ links.forEach(link => {
160343
+ let url = link.getAttribute('href');
160344
+
160345
+ if (url.indexOf('#') === 0 || link.classList.contains('glightbox')) ; else {
160346
+ if (!this.linksWithClickListeners.has(link)) {
160347
+ link.addEventListener('click', e => {
160348
+ // Will go to the link
160349
+ const answer = window.confirm(out('Do you really want to leave?')); // Cancel the navigation and stay on the same page
160350
+
160351
+ if (!answer) {
160352
+ e.preventDefault();
160353
+ }
160354
+
160355
+ e.stopImmediatePropagation();
160356
+ });
160357
+ this.linksWithClickListeners.add(link); // Mark the listener as added
160358
+ }
160359
+ }
160360
+ });
160276
160361
  const navbar = this.doc.querySelector('.is-section-navbar');
160277
160362
 
160278
160363
  if (navbar) {
160279
160364
  const links = navbar.querySelectorAll('a');
160280
160365
  links.forEach(link => {
160281
- link.addEventListener('click', e => {
160282
- let url = link.getAttribute('href');
160283
-
160284
- if (url) {
160285
- if (url.indexOf('#') === 0) {
160286
- // Will go to bookmark
160287
- if (url.indexOf('#section') === 0) {
160288
- let num = url.replace('#section', '');
160289
-
160290
- if (!isNaN(parseInt(num))) {
160291
- let sections = this.doc.querySelectorAll('.is-section');
160292
- let gotoSection;
160293
- let x = 0;
160294
- sections.forEach(function (section) {
160295
- if (!dom.hasClass(section, 'is-section-navbar')) {
160296
- if (x === num - 1) {
160297
- gotoSection = section;
160366
+ if (!this.linksWithClickListeners.has(link)) {
160367
+ link.addEventListener('click', e => {
160368
+ let url = link.getAttribute('href');
160369
+
160370
+ if (url) {
160371
+ if (url.indexOf('#') === 0) {
160372
+ // Will go to bookmark
160373
+ if (url.indexOf('#section') === 0) {
160374
+ let num = url.replace('#section', '');
160375
+
160376
+ if (!isNaN(parseInt(num))) {
160377
+ let sections = this.doc.querySelectorAll('.is-section');
160378
+ let gotoSection;
160379
+ let x = 0;
160380
+ sections.forEach(function (section) {
160381
+ if (!dom.hasClass(section, 'is-section-navbar')) {
160382
+ if (x === num - 1) {
160383
+ gotoSection = section;
160384
+ }
160385
+
160386
+ x++;
160298
160387
  }
160388
+ });
160299
160389
 
160300
- x++;
160390
+ if (gotoSection) {
160391
+ this.scrollTo(gotoSection);
160301
160392
  }
160302
- });
160303
160393
 
160304
- if (gotoSection) {
160305
- this.scrollTo(gotoSection);
160394
+ e.preventDefault();
160306
160395
  }
160396
+ } else {
160397
+ try {
160398
+ let bookmark = this.doc.querySelector(url);
160307
160399
 
160308
- e.preventDefault();
160309
- }
160310
- } else {
160311
- try {
160312
- let bookmark = this.doc.querySelector(url);
160313
-
160314
- if (bookmark) {
160315
- this.scrollTo(bookmark);
160316
- e.preventDefault();
160400
+ if (bookmark) {
160401
+ this.scrollTo(bookmark);
160402
+ e.preventDefault();
160403
+ }
160404
+ } catch (e) {// Do Nothing
160317
160405
  }
160318
- } catch (e) {// Do Nothing
160319
160406
  }
160407
+ } else {
160408
+ // Prevent to go to the link
160409
+ if (e.target.closest('#is-menu-toggle')) return;
160410
+ e.preventDefault();
160411
+ e.stopImmediatePropagation();
160320
160412
  }
160321
160413
  } else {
160322
- // Prevent to go to the link
160323
- if (e.target.closest('#is-menu-toggle')) return;
160324
- e.preventDefault();
160325
- e.stopImmediatePropagation();
160326
- }
160327
- } else {
160328
- if (link.closest('.is-menu-search')) ; else {
160329
- if (!e.target.getAttribute('href')) return;
160330
- e.preventDefault();
160331
- e.stopImmediatePropagation();
160414
+ if (link.closest('.is-menu-search')) ; else {
160415
+ if (!e.target.getAttribute('href')) return;
160416
+ e.preventDefault();
160417
+ e.stopImmediatePropagation();
160418
+ }
160332
160419
  }
160333
- }
160334
- });
160420
+ });
160421
+ this.linksWithClickListeners.add(link); // Mark the listener as added
160422
+ }
160335
160423
  });
160336
160424
  }
160337
160425
  } // box
@@ -160498,7 +160586,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
160498
160586
  '</div>');
160499
160587
  */
160500
160588
 
160501
- dom.appendHtml(box, '<div class="is-box-tool" data-tool="1">' + '<button type="button" class="is-cover-upload" tabindex="-1" data-tooltip-top data-title="' + out('Change Background') + '" title="' + out('Change Background') + '" style="background:rgb(78 170 57)"><svg class="is-icon-flex" style="position: absolute;top: 9px;left: 9px;fill:rgb(255,255,255);"><use xlink:href="#ion-image"></use></svg></button>' + '<button type="button" class="is-select-image" tabindex="-1" data-tooltip-top data-title="' + out('Select') + '" title="' + out('Select') + '" style="background:rgb(251 173 27)"><svg class="is-icon-flex" style="color:#fff;width:17px;height:17px;"><use style="color: #fff;" xlink:href="#icon-folder2"></use></svg></button>' + '<button type="button" class="is-box-edit" tabindex="-1" data-tooltip-top data-title="' + out('Box Settings') + '" title="' + out('Box Settings') + '"><svg class="is-icon-flex"><use xlink:href="#ion-wrench"></use></svg></button>' + '<button type="button" class="is-module-edit" tabindex="-1" data-tooltip-top data-title="' + out('Module Settings') + '" title="' + out('Module Settings') + '" style="background:rgb(135 116 215)"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>' + '</div>');
160589
+ dom.appendHtml(box, '<div class="is-box-tool" data-tool="1">' + '<button type="button" class="is-cover-upload" tabindex="-1" data-tooltip-top data-title="' + out('Upload Background') + '" title="' + out('Upload Background') + '" style="background:rgb(78 170 57)"><svg class="is-icon-flex" style="position: absolute;top: 9px;left: 9px;fill:rgb(255,255,255);"><use xlink:href="#ion-image"></use></svg></button>' + '<button type="button" class="is-select-image" tabindex="-1" data-tooltip-top data-title="' + out('Select Background') + '" title="' + out('Select Background') + '" style="background:rgb(251 173 27)"><svg class="is-icon-flex" style="color:#fff;width:17px;height:17px;"><use style="color: #fff;" xlink:href="#icon-folder2"></use></svg></button>' + '<button type="button" class="is-box-edit" tabindex="-1" data-tooltip-top data-title="' + out('Box Settings') + '" title="' + out('Box Settings') + '"><svg class="is-icon-flex"><use xlink:href="#ion-wrench"></use></svg></button>' + '<button type="button" class="is-module-edit" tabindex="-1" data-tooltip-top data-title="' + out('Module Settings') + '" title="' + out('Module Settings') + '" style="background:rgb(135 116 215)"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>' + '</div>');
160502
160590
  let info = box.querySelector('.is-box-info');
160503
160591
  if (info) info.parentNode.removeChild(info);
160504
160592