@innovastudio/contentbox 1.5.25 → 1.5.26

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.5.25",
4
+ "version": "1.5.26",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -492,7 +492,7 @@ class Select$1 {
492
492
  dropDown.dispatchEvent(new Event('change'));
493
493
  toggler.focus();
494
494
  let elms = menu.children;
495
- Array.from(elms).map(elm => {
495
+ Array.from(elms).forEach(elm => {
496
496
  elm.classList.remove('selected');
497
497
  });
498
498
  let optionselected = menu.querySelector('[data-value="' + val + '"]');
@@ -582,28 +582,28 @@ class SideBar {
582
582
  html += '<div class="is-sidebar is-area active" style="transform: translate3d(0,0,0);display: flex;flex-direction: column;opacity: 0.0001;">';
583
583
  var sideIndex = 0;
584
584
  this.builder.sidebarData.buttons.map(button => {
585
- if (button.name == 'section') {
586
- html += '<button class="is-sidebar-button" tabindex="-1" data-content="divSidebarSections" data-command="section" data-title="' + button.title + '" title="' + button.title + '">' + // '<svg class="svg-icon"><use xlink:href="#ion-android-add"></use></svg>' +
585
+ if (button.name === 'section') {
586
+ html += '<button class="is-sidebar-button" tabindex="-1" data-content="divSidebarSections" data-command="section" data-title="' + out(button.title) + '" title="' + out(button.title) + '">' + // '<svg class="svg-icon"><use xlink:href="#ion-android-add"></use></svg>' +
587
587
  '<svg class="svg-icon"><use xlink:href="#icon-plus"></use></svg>' + '</button>';
588
- } else if (button.name == 'snippet') {
589
- html += '<button class="is-sidebar-button" tabindex="-1" data-content="divSidebarSnippets" data-title="' + button.title + '" title="' + button.title + '">' + // '<svg class="svg-icon"><use xlink:href="#icon-align-center"></use></svg>' +
588
+ } else if (button.name === 'snippet') {
589
+ html += '<button class="is-sidebar-button" tabindex="-1" data-content="divSidebarSnippets" data-title="' + out(button.title) + '" title="' + out(button.title) + '">' + // '<svg class="svg-icon"><use xlink:href="#icon-align-center"></use></svg>' +
590
590
  '<svg class="svg-icon"><use xlink:href="#icon-box-multiple"></use></svg>' + '</button>';
591
- } else if (button.name == 'typography') {
591
+ } else if (button.name === 'typography') {
592
592
  if (this.builder.enableContentStyle) {
593
- html += '<button class="is-sidebar-button" tabindex="-1" data-content="divSidebarTypography" data-command="typography" data-title="' + button.title + '" title="' + button.title + '">' + // '<span style="">a</span>' +
593
+ html += '<button class="is-sidebar-button" tabindex="-1" data-content="divSidebarTypography" data-command="typography" data-title="' + out(button.title) + '" title="' + out(button.title) + '">' + // '<span style="">a</span>' +
594
594
  '<svg class="svg-icon"><use xlink:href="#icon-typography"></use></svg>' + '</button>';
595
595
  }
596
- } else if (button.name == 'code') {
596
+ } else if (button.name === 'code') {
597
597
  if (this.builder.htmlSyntaxHighlighting) {
598
- html += '<button class="is-sidebar-button" tabindex="-1" data-command="code" data-title="' + button.title + '" title="' + button.title + '">' + '<svg class="svg-icon" style="width:13px;height:13px;"><use xlink:href="#ion-code"></use></svg>' + '</button>';
598
+ html += '<button class="is-sidebar-button" tabindex="-1" data-command="code" data-title="' + out(button.title) + '" title="' + out(button.title) + '">' + '<svg class="svg-icon" style="width:13px;height:13px;"><use xlink:href="#ion-code"></use></svg>' + '</button>';
599
599
  } else {
600
- html += '<button class="is-sidebar-button" tabindex="-1" data-content="divSidebarSource" data-command="code" data-title="' + button.title + '" title="' + button.title + '">' + '<svg class="svg-icon" style="width:13px;height:13px;"><use xlink:href="#ion-code"></use></svg>' + '</button>';
600
+ html += '<button class="is-sidebar-button" tabindex="-1" data-content="divSidebarSource" data-command="code" data-title="' + out(button.title) + '" title="' + out(button.title) + '">' + '<svg class="svg-icon" style="width:13px;height:13px;"><use xlink:href="#ion-code"></use></svg>' + '</button>';
601
601
  }
602
602
  } else {
603
603
  //custom buttons
604
604
  if (button.src) {
605
605
  var panelId = dom$n.uniqueId();
606
- html += `<button class="is-sidebar-button" tabindex="-1" data-content="${panelId}" data-title="${button.title}" title="${button.title}" data-src="${button.src}" data-refresh="${button.refresh ? 1 : 0}">${button.html}</button>`;
606
+ html += `<button class="is-sidebar-button" tabindex="-1" data-content="${panelId}" data-title="${out(button.title)}" title="${out(button.title)}" data-src="${button.src}" data-refresh="${button.refresh ? 1 : 0}">${button.html}</button>`;
607
607
 
608
608
  if (!builderStuff.querySelector(`#${panelId}`)) {
609
609
  let customPanelHtml = `<div id="${panelId}" class="is-sidebar-content is-area-2nd" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="max-width:${button.maxwidth ? button.maxwidth : '500px'};">
@@ -615,7 +615,7 @@ class SideBar {
615
615
  dom$n.appendHtml(builderStuff, customPanelHtml);
616
616
  }
617
617
  } else {
618
- html += '<button class="is-sidebar-button" tabindex="-1" data-content="' + button.content.substr(1) + '" data-title="' + button.title + '" title="' + button.title + '" data-refresh="' + (button.refresh ? 1 : 0) + '">' + button.html + '</button>';
618
+ html += '<button class="is-sidebar-button" tabindex="-1" data-content="' + button.content.substr(1) + '" data-title="' + out(button.title) + '" title="' + out(button.title) + '" data-refresh="' + (button.refresh ? 1 : 0) + '">' + button.html + '</button>';
619
619
  }
620
620
  }
621
621
 
@@ -798,11 +798,11 @@ class SideBar {
798
798
  let cmd = btn.getAttribute('data-command');
799
799
 
800
800
  if (cmd) {
801
- if (cmd == 'section') {
801
+ if (cmd === 'section') {
802
802
  this.viewIdeas();
803
803
  }
804
804
 
805
- if (cmd == 'code') {
805
+ if (cmd === 'code') {
806
806
  if (this.builder.htmlSyntaxHighlighting) {
807
807
  this.viewHtml();
808
808
  } else {
@@ -810,7 +810,7 @@ class SideBar {
810
810
  }
811
811
  }
812
812
 
813
- if (cmd == 'typography') {
813
+ if (cmd === 'typography') {
814
814
  btn.setAttribute('data-applyto', 'page');
815
815
  builderStuff.querySelector('.typo-target-default').style.display = 'flex';
816
816
  builderStuff.querySelector('.typo-target-box').style.display = 'none';
@@ -1127,7 +1127,7 @@ class SideBar {
1127
1127
  let styles = jsonStyles.data.styles;
1128
1128
  let html = '';
1129
1129
 
1130
- if (catid == -1) {
1130
+ if (parseInt(catid) === -1) {
1131
1131
  //show all
1132
1132
  for (let i = 0; i < styles.length; i++) {
1133
1133
  html += '<div data-css="' + styles[i].css + '" data-sectioncss="' + styles[i].sectioncss + '" data-classname="' + styles[i].classname + '">' + '<div>[' + (i + 1) + '] ' + styles[i].caption + '</div>' + '<img src="' + contentStylePath + styles[i].img + '" /><span class="is-overlay"></span></div></div>';
@@ -1135,7 +1135,7 @@ class SideBar {
1135
1135
  } else {
1136
1136
  //show based on category
1137
1137
  for (let i = 0; i < styles.length; i++) {
1138
- if (catid == styles[i].category) {
1138
+ if (parseInt(catid) === styles[i].category) {
1139
1139
  html += '<div data-css="' + styles[i].css + '" data-sectioncss="' + styles[i].sectioncss + '" data-classname="' + styles[i].classname + '">' + '<div>[' + (i + 1) + '] ' + styles[i].caption + '</div>' + '<img src="' + contentStylePath + styles[i].img + '" /><span class="is-overlay"></span></div></div>';
1140
1140
  }
1141
1141
  }
@@ -1905,7 +1905,7 @@ class SideBar {
1905
1905
  let snippetPathReplace = gallery.pathReplace;
1906
1906
 
1907
1907
  //To Tailwind
1908
- if (framework == 'tailwind') {
1908
+ if (framework === 'tailwind') {
1909
1909
  html = html.replace(new RegExp(' container', 'g'), ' container');
1910
1910
 
1911
1911
  //html = html.replace(new RegExp('row clearfix', 'g'), 'flex flex-col md:flex-row');
@@ -1924,7 +1924,7 @@ class SideBar {
1924
1924
  }
1925
1925
 
1926
1926
  //To Bootstrap
1927
- if (framework == 'bootstrap') {
1927
+ if (framework === 'bootstrap') {
1928
1928
  html = html.replace(new RegExp(' container', 'g'), ' container-fluid');
1929
1929
  html = html.replace(new RegExp('row clearfix', 'g'), 'row');
1930
1930
  html = html.replace(new RegExp('column full', 'g'), 'col-md-12');
@@ -1941,7 +1941,7 @@ class SideBar {
1941
1941
  }`;
1942
1942
  html += `
1943
1943
  //To Foundation
1944
- if (framework == 'foundation') {
1944
+ if (framework === 'foundation') {
1945
1945
  //html = html.replace(new RegExp(' container', 'g'), ' container');
1946
1946
  html = html.replace(new RegExp('row clearfix', 'g'), 'row');
1947
1947
  html = html.replace(new RegExp('column full', 'g'), 'large-12 columns');
@@ -1958,7 +1958,7 @@ class SideBar {
1958
1958
  }
1959
1959
 
1960
1960
  //To UIKit
1961
- if (framework == 'uikit') {
1961
+ if (framework === 'uikit') {
1962
1962
  html = html.replace(new RegExp(' container', 'g'), ' uk-container uk-container-center');
1963
1963
 
1964
1964
  // html = html.replace(new RegExp('row clearfix', 'g'), 'uk-grid');
@@ -1979,7 +1979,7 @@ class SideBar {
1979
1979
  }
1980
1980
 
1981
1981
  //To Material
1982
- if (framework == 'material') {
1982
+ if (framework === 'material') {
1983
1983
  html = html.replace(new RegExp(' container', 'g'), '');
1984
1984
 
1985
1985
  // html = html.replace(new RegExp('row clearfix', 'g'), 'mdl-grid');
@@ -3443,7 +3443,7 @@ class SideBar {
3443
3443
  var contentClass = result[0].contentClass;
3444
3444
 
3445
3445
  //To Tailwind
3446
- if (framework == 'tailwind') {
3446
+ if (framework === 'tailwind') {
3447
3447
  html = html.replace(new RegExp(' container', 'g'), ' container');
3448
3448
  html = html.replace(new RegExp('row clearfix', 'g'), 'flex flex-col md:flex-row');
3449
3449
  html = html.replace(new RegExp('column full', 'g'), 'w-full px-4');
@@ -3458,7 +3458,7 @@ class SideBar {
3458
3458
  }
3459
3459
 
3460
3460
  //To Bootstrap
3461
- if (framework == 'bootstrap') {
3461
+ if (framework === 'bootstrap') {
3462
3462
  html = html.replace(new RegExp(' container', 'g'), ' container-fluid');
3463
3463
  html = html.replace(new RegExp('row clearfix', 'g'), 'row');
3464
3464
  html = html.replace(new RegExp('column full', 'g'), 'col-md-12');
@@ -3475,7 +3475,7 @@ class SideBar {
3475
3475
  }
3476
3476
 
3477
3477
  //To Foundation
3478
- if (framework == 'foundation') {
3478
+ if (framework === 'foundation') {
3479
3479
  //html = html.replace(new RegExp(' container', 'g'), ' container');
3480
3480
  html = html.replace(new RegExp('row clearfix', 'g'), 'row');
3481
3481
  html = html.replace(new RegExp('column full', 'g'), 'large-12 columns');
@@ -3492,7 +3492,7 @@ class SideBar {
3492
3492
  }
3493
3493
 
3494
3494
  //To UIKit
3495
- if (framework == 'uikit') {
3495
+ if (framework === 'uikit') {
3496
3496
  html = html.replace(new RegExp(' container', 'g'), ' uk-container uk-container-center');
3497
3497
  html = html.replace(new RegExp('row clearfix', 'g'), 'uk-grid');
3498
3498
  html = html.replace(new RegExp('column full', 'g'), 'uk-width-1-1');
@@ -3509,7 +3509,7 @@ class SideBar {
3509
3509
  }
3510
3510
 
3511
3511
  //To Material
3512
- if (framework == 'material') {
3512
+ if (framework === 'material') {
3513
3513
  html = html.replace(new RegExp(' container', 'g'), '');
3514
3514
  html = html.replace(new RegExp('row clearfix', 'g'), 'mdl-grid');
3515
3515
  html = html.replace(new RegExp('column full', 'g'), 'mdl-cell mdl-cell--12-col');
@@ -4293,7 +4293,7 @@ class EditSection {
4293
4293
  let val = btn.getAttribute('data-value');
4294
4294
  const activeSection = this.builder.activeSection;
4295
4295
 
4296
- if (val == 'space') {
4296
+ if (val === 'space') {
4297
4297
  dom$m.removeClass(activeSection, 'space-around');
4298
4298
  } else {
4299
4299
  dom$m.addClass(activeSection, 'space-around');
@@ -4318,11 +4318,11 @@ class EditSection {
4318
4318
  dom$m.removeClass(activeSection, 'stack-middle');
4319
4319
  dom$m.removeClass(activeSection, 'stack-bottom');
4320
4320
 
4321
- if (val == 'top') {
4321
+ if (val === 'top') {
4322
4322
  dom$m.addClass(activeSection, 'stack-top');
4323
- } else if (val == 'middle') {
4323
+ } else if (val === 'middle') {
4324
4324
  dom$m.addClass(activeSection, 'stack-middle');
4325
- } else if (val == 'bottom') {
4325
+ } else if (val === 'bottom') {
4326
4326
  dom$m.addClass(activeSection, 'stack-bottom');
4327
4327
  }
4328
4328
 
@@ -5224,7 +5224,7 @@ class EditSection {
5224
5224
  const activeSection = this.builder.activeSection;
5225
5225
  const divSectionSpaceSettings = this.modalEditSection.querySelector('.div-section-spacesettings');
5226
5226
 
5227
- if (s == '') {
5227
+ if (s === '') {
5228
5228
  dom$m.removeClass(activeSection, 'box-space');
5229
5229
  dom$m.removeClass(activeSection, 'box-space-xxs');
5230
5230
  dom$m.removeClass(activeSection, 'box-space-sm');
@@ -5241,22 +5241,22 @@ class EditSection {
5241
5241
  dom$m.removeClass(activeSection, 'box-space-m');
5242
5242
  dom$m.removeClass(activeSection, 'box-space-lg');
5243
5243
  dom$m.addClass(activeSection, 'box-space-sm');
5244
- } else if (s == 'xxs') {
5244
+ } else if (s === 'xxs') {
5245
5245
  dom$m.removeClass(activeSection, 'box-space-m');
5246
5246
  dom$m.removeClass(activeSection, 'box-space-sm');
5247
5247
  dom$m.removeClass(activeSection, 'box-space-lg');
5248
5248
  dom$m.addClass(activeSection, 'box-space-xxs');
5249
- } else if (s == 'm') {
5249
+ } else if (s === 'm') {
5250
5250
  dom$m.removeClass(activeSection, 'box-space-xxs');
5251
5251
  dom$m.removeClass(activeSection, 'box-space-sm');
5252
5252
  dom$m.removeClass(activeSection, 'box-space-lg');
5253
5253
  dom$m.addClass(activeSection, 'box-space-m');
5254
- } else if (s == 'lg') {
5254
+ } else if (s === 'lg') {
5255
5255
  dom$m.removeClass(activeSection, 'box-space-xxs');
5256
5256
  dom$m.removeClass(activeSection, 'box-space-sm');
5257
5257
  dom$m.removeClass(activeSection, 'box-space-m');
5258
5258
  dom$m.addClass(activeSection, 'box-space-lg');
5259
- } else if (s == 'default') {
5259
+ } else if (s === 'default') {
5260
5260
  dom$m.removeClass(activeSection, 'box-space-xxs');
5261
5261
  dom$m.removeClass(activeSection, 'box-space-sm');
5262
5262
  dom$m.removeClass(activeSection, 'box-space-m');
@@ -108210,7 +108210,7 @@ class ContentBox {
108210
108210
 
108211
108211
  let exist = false;
108212
108212
 
108213
- let links = parent._cb.doc.getElementsByTagName('link');
108213
+ let links = window.parent._cb.doc.getElementsByTagName('link');
108214
108214
 
108215
108215
  for (let i = 0; i < links.length; i++) {
108216
108216
  let src = links[i].href.toLowerCase();
@@ -109164,7 +109164,7 @@ class ContentBox {
109164
109164
  // make absolute
109165
109165
  const link = links[i].cloneNode();
109166
109166
  let imgUrl = link.href;
109167
- let urlBase = location.href.substring(0, location.href.lastIndexOf('/'));
109167
+ let urlBase = window.location.href.substring(0, window.location.href.lastIndexOf('/'));
109168
109168
  imgUrl = imgUrl.replace(urlBase, '[%PATH%]');
109169
109169
  link.href = imgUrl;
109170
109170
  arrLinks.push(link.outerHTML);
@@ -109206,7 +109206,7 @@ class ContentBox {
109206
109206
  // make absolute
109207
109207
  const link = links[i].cloneNode();
109208
109208
  let imgUrl = link.href;
109209
- let urlBase = location.href.substring(0, location.href.lastIndexOf('/'));
109209
+ let urlBase = window.location.href.substring(0, window.location.href.lastIndexOf('/'));
109210
109210
  imgUrl = imgUrl.replace(urlBase, '[%PATH%]');
109211
109211
  link.href = imgUrl;
109212
109212
  arrLinks.push(link.outerHTML);
@@ -109276,7 +109276,7 @@ class ContentBox {
109276
109276
  output = output.replaceAll('[%PATH%]', options.path);
109277
109277
  } else {
109278
109278
  let urlBase;
109279
- urlBase = location.href.substring(0, location.href.lastIndexOf('/'));
109279
+ urlBase = window.location.href.substring(0, window.location.href.lastIndexOf('/'));
109280
109280
  output = output.replaceAll('[%PATH%]', urlBase);
109281
109281
  } // Beautify
109282
109282