@innovastudio/contentbox 1.4.19 → 1.4.21

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.
@@ -1918,8 +1918,65 @@ class SideBar {
1918
1918
  const wait2 = document.querySelector('.is-waiting2');
1919
1919
  wait2.style.display = 'flex';
1920
1920
 
1921
+ let totalLoaded = 0;
1922
+
1921
1923
  let designId = 1;
1922
1924
  loadJsFiles(templateJSON, (template)=>{
1925
+ // console.log(template_list)
1926
+
1927
+
1928
+ // ---- Old Version (backward compatible) ----
1929
+ totalLoaded+=1;
1930
+ if(template_list.length!==totalLoaded) {
1931
+ if(template.url.indexOf('basic.js')!==-1) {
1932
+
1933
+ let arr = {
1934
+ name: 'Simple Start',
1935
+ categories: [
1936
+ { id: 5, name: 'Random' },
1937
+ { id: 1, name: 'Basic' },
1938
+ { id: 2, name: 'Slider' },
1939
+ { id: 3, name: 'Video' },
1940
+ { id: 4, name: 'Custom' },
1941
+ ],
1942
+ designs: window.data_basic.designs
1943
+ };
1944
+ template_list.push(arr);
1945
+
1946
+ }
1947
+ if(template.url.indexOf('examples.js')!==-1) {
1948
+
1949
+ let arr = {
1950
+ name: 'Quick Start',
1951
+ categories: [
1952
+ { id: 101, name: 'Header' },
1953
+ { id: 118, name: 'Article' },
1954
+ { id: 102, name: 'Photos' },
1955
+ { id: 103, name: 'Profile' },
1956
+ { id: 104, name: 'Products, Services' },
1957
+ { id: 105, name: 'Features' },
1958
+ { id: 106, name: 'Process' },
1959
+ { id: 107, name: 'Pricing' },
1960
+ { id: 108, name: 'Skills' },
1961
+ { id: 109, name: 'Achievements' },
1962
+ { id: 110, name: 'Quotes' },
1963
+ { id: 111, name: 'Partners' },
1964
+ { id: 112, name: 'As Featured On' },
1965
+ { id: 113, name: 'Page Not Found' },
1966
+ { id: 114, name: 'Coming Soon' },
1967
+ { id: 115, name: 'Help, FAQ' },
1968
+ { id: 116, name: 'Contact' },
1969
+ { id: 117, name: 'Footer' },
1970
+ ],
1971
+ designs: window.data_examples.designs
1972
+ };
1973
+ template_list.push(arr);
1974
+
1975
+ }
1976
+ }
1977
+ // ---- /Old Version ----
1978
+
1979
+
1923
1980
  // console.log(template)
1924
1981
  const templateAdded = template_list[template_list.length-1];
1925
1982
  templateAdded.path = template.path;
@@ -10385,6 +10442,8 @@ class EditBox {
10385
10442
  dom$j.removeClass(activeBox.querySelector('.edge-y-3'), 'edge-y-3');
10386
10443
  dom$j.removeClass(activeBox.querySelector('.edge-y-4'), 'edge-y-4');
10387
10444
  dom$j.removeClass(activeBox.querySelector('.edge-y-5'), 'edge-y-5');
10445
+ dom$j.removeClass(activeBox.querySelector('.edge-y-8'), 'edge-y-8'); // old (backward compatible)
10446
+
10388
10447
  dom$j.removeClass(activeBox.querySelector('.edge-x--1'), 'edge-x--1');
10389
10448
  dom$j.removeClass(activeBox.querySelector('.edge-x--0-75'), 'edge-x--0-75');
10390
10449
  dom$j.removeClass(activeBox.querySelector('.edge-x--0-5'), 'edge-x--0-5');
@@ -11087,10 +11146,35 @@ class EditBox {
11087
11146
  chkBoxAddText.addEventListener('click', () => {
11088
11147
  const activeBox = this.builder.activeBox;
11089
11148
  const overlay = activeBox.querySelector('.is-overlay');
11149
+ const boxes = activeBox.querySelector('.is-boxes');
11150
+
11151
+ if (boxes) {
11152
+ if (boxes.querySelector('.is-overlay')) {
11153
+ // Need fix
11154
+ activeBox.prepend(overlay);
11155
+ boxes.parentNode.removeChild(boxes);
11156
+ }
11157
+ }
11158
+
11159
+ let copyClass = '';
11160
+ const otherContainer = activeBox.parentNode.querySelector('.is-container');
11161
+
11162
+ if (otherContainer) {
11163
+ otherContainer.classList.forEach(item => {
11164
+ if (item.indexOf('leading-') !== -1) {
11165
+ copyClass += ' ' + item;
11166
+ }
11167
+
11168
+ if (item.indexOf('size-') !== -1) {
11169
+ copyClass += ' ' + item;
11170
+ }
11171
+ });
11172
+ }
11173
+
11090
11174
  let html = `
11091
11175
  <div class="is-boxes">
11092
11176
  <div class="is-box-centered">
11093
- <div class="is-container container" style="max-width: 440px;">
11177
+ <div class="is-container is-content-700 v2${copyClass}">
11094
11178
 
11095
11179
  </div>
11096
11180
  </div>
@@ -11875,6 +11959,15 @@ class EditBox {
11875
11959
  } else {
11876
11960
  chkBoxAddText.style.display = 'flex';
11877
11961
  chkBoxRemoveText.style.display = 'none';
11962
+ } // noedit (not used yet)
11963
+
11964
+
11965
+ let activeSection = this.builder.activeSection;
11966
+
11967
+ if (dom$j.hasClass(activeSection, 'noedit')) {
11968
+ chkBoxAddText.style.display = 'none';
11969
+ } else {
11970
+ chkBoxAddText.style.display = 'flex';
11878
11971
  } // Content Height & Justify
11879
11972
 
11880
11973
 
@@ -12392,8 +12485,8 @@ class EditBox {
12392
12485
  if (!overlayBg) return;
12393
12486
 
12394
12487
  if (this.modalEditBox.querySelector('#chkParallaxBg').checked) {
12395
- overlayBg.setAttribute('data-bottom-top', 'transform:translateY(-120px) scale(1);');
12396
- overlayBg.setAttribute('data-top-bottom', 'transform:translateY(50px) scale(1.4)');
12488
+ overlayBg.setAttribute('data-bottom-top', 'transform:translateY(-70px) scale(1);');
12489
+ overlayBg.setAttribute('data-top-bottom', 'transform:translateY(50px) scale(1.1)');
12397
12490
  this.builder.settings.onRender();
12398
12491
  } else {
12399
12492
  dom$j.removeClass(overlayBg, 'skrollable');
@@ -27229,7 +27322,25 @@ class HtmlUtil {
27229
27322
  range.setStart(area, 0);
27230
27323
  area.appendChild(range.createContextualFragment(html));
27231
27324
  let builderActive = this.builder.doc.querySelector('.builder-active');
27232
- if (builderActive) this.builder.applyBehaviorOn(builderActive); //Trigger Change event
27325
+ if (builderActive) this.builder.applyBehaviorOn(builderActive);
27326
+ /*else {
27327
+ const builders = this.builder.doc.querySelectorAll(this.builder.opts.container);
27328
+ if(builders.length > 1) {
27329
+ const cell = util.cellSelected();
27330
+ if(!cell) {
27331
+ // Return first instance
27332
+ area = builders[0];
27333
+ } else {
27334
+ // Return active instance
27335
+ area = cell.parentNode.parentNode;
27336
+ }
27337
+ } else {
27338
+ // Single instance
27339
+ area = builders[0];
27340
+ }
27341
+ this.builder.applyBehaviorOn(area);
27342
+ }*/
27343
+ //Trigger Change event
27233
27344
 
27234
27345
  this.builder.opts.onChange(); //Trigger Render event
27235
27346
 
@@ -27457,9 +27568,9 @@ class HtmlUtil {
27457
27568
 
27458
27569
 
27459
27570
  let columnMore = builderStuff.querySelector('.is-pop.columnmore');
27460
- columnMore.style.display = '';
27571
+ if (columnMore) columnMore.style.display = '';
27461
27572
  let rowMore = builderStuff.querySelector('.is-pop.rowmore');
27462
- rowMore.style.display = '';
27573
+ if (rowMore) rowMore.style.display = '';
27463
27574
  this.builder.codeEditorMode = mode;
27464
27575
  this.builder.codeEditorArea = area;
27465
27576
  let codeEditor = viewhtml.querySelector('.input-code-editor');
@@ -62745,6 +62856,8 @@ class Image$1 {
62745
62856
  }
62746
62857
 
62747
62858
  newname = basename + '-edit' + this.util.makeId();
62859
+ newname = newname.replaceAll('%20', '-'); // fix 404 error after file upload
62860
+
62748
62861
  img.setAttribute('data-filename', newname + '.' + extension);
62749
62862
  }
62750
62863
 
@@ -62805,7 +62918,9 @@ class Image$1 {
62805
62918
  this.imageTool.style.display = '';
62806
62919
  }, 1000);
62807
62920
  } else {
62808
- this.refresh();
62921
+ elm.onload = () => {
62922
+ this.refresh();
62923
+ };
62809
62924
  }
62810
62925
  }
62811
62926
 
@@ -62880,7 +62995,9 @@ class Image$1 {
62880
62995
  this.builder.moveable.updateRect();
62881
62996
  document.querySelector('.moveable-control-box').style.display = 'none';
62882
62997
  }
62883
- }, 300);
62998
+
62999
+ this.util.repositionColumnTool();
63000
+ }, 0); // refesh() is called after img onload, so no need to have a delay.
62884
63001
  }
62885
63002
  }
62886
63003
 
@@ -78462,7 +78579,7 @@ class Rte {
78462
78579
  }
78463
78580
 
78464
78581
  if (this.builder.opts.toolbarAddSnippetButton && html_elementrte.indexOf('rte-addsnippet') === -1 && html_elementrtemore.indexOf('rte-addsnippet') === -1) {
78465
- html_elementrte = `<button tabindex="-1" title="${util.out('Add Snippet')}" class="rte-addsnippet"><svg class="is-icon-flex" style="width:18px;height:18px;margin-top:-1px;"><use xlink:href="#ion-ios-plus-empty"></use></svg></button>` + html_rte;
78582
+ html_elementrte = `<button tabindex="-1" title="${util.out('Add Snippet')}" class="rte-addsnippet"><svg class="is-icon-flex" style="width:18px;height:18px;margin-top:-1px;"><use xlink:href="#ion-ios-plus-empty"></use></svg></button>` + html_elementrte; //html_rte;
78466
78583
  }
78467
78584
 
78468
78585
  if (html_elementrtemore !== '' && html_elementrte.indexOf('rte-more') === -1) {
@@ -78493,7 +78610,7 @@ class Rte {
78493
78610
  }
78494
78611
 
78495
78612
  if (this.builder.opts.toolbarAddSnippetButton && html_iconrte.indexOf('rte-addsnippet') === -1 && html_iconrtemore.indexOf('rte-addsnippet') === -1) {
78496
- html_iconrte = `<button tabindex="-1" title="${util.out('Add Snippet')}" class="rte-addsnippet"><svg class="is-icon-flex" style="width:18px;height:18px;margin-top:-1px;"><use xlink:href="#ion-ios-plus-empty"></use></svg></button>` + html_rte;
78613
+ html_iconrte = `<button tabindex="-1" title="${util.out('Add Snippet')}" class="rte-addsnippet"><svg class="is-icon-flex" style="width:18px;height:18px;margin-top:-1px;"><use xlink:href="#ion-ios-plus-empty"></use></svg></button>` + html_iconrte; //html_rte;
78497
78614
  }
78498
78615
 
78499
78616
  if (html_iconrtemore !== '' && html_iconrte.indexOf('rte-more') === -1) {
@@ -94549,6 +94666,25 @@ class ContentBox {
94549
94666
  } // boxSetup
94550
94667
 
94551
94668
 
94669
+ addSection(html, contentCss) {
94670
+ this.addIdea(html);
94671
+ let contentClass = contentCss.replace('.css', '');
94672
+ let contentStylePath = this.settings.contentStylePath; //Add contentCss
94673
+
94674
+ let exist = false;
94675
+
94676
+ let links = parent._cb.doc.getElementsByTagName('link');
94677
+
94678
+ for (let i = 0; i < links.length; i++) {
94679
+ let src = links[i].href.toLowerCase();
94680
+ if (src.indexOf(contentCss.toLowerCase()) != -1) exist = true;
94681
+ }
94682
+
94683
+ if (!exist) {
94684
+ this.wrapperEl.insertAdjacentHTML('beforeend', '<link data-name="contentstyle" data-class="' + contentClass + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
94685
+ }
94686
+ }
94687
+
94552
94688
  addIdea(newArea) {
94553
94689
  this.editor.saveForUndo();
94554
94690
  const designPath = this.designPath;
@@ -95017,17 +95153,19 @@ class ContentBox {
95017
95153
  document.body.style.overflowY = '';
95018
95154
  });
95019
95155
  } else {
95020
- const sidebarOverlay = builderStuff.querySelector('.is-sidebar-overlay');
95021
- sidebarOverlay.parentNode.removeChild(sidebarOverlay);
95022
- let elms = builderStuff.querySelectorAll('.is-sidebar > div');
95023
- elms.forEach(elm => {
95024
- dom.removeClass(elm, 'active');
95025
- });
95026
- elms = builderStuff.querySelectorAll('.is-sidebar-content');
95027
- elms.forEach(elm => {
95028
- dom.removeClass(elm, 'active');
95029
- });
95030
- document.body.style.overflowY = '';
95156
+ // const sidebarOverlay = builderStuff.querySelector('.is-sidebar-overlay');
95157
+ // sidebarOverlay.parentNode.removeChild(sidebarOverlay);
95158
+ // let elms = builderStuff.querySelectorAll('.is-sidebar > div');
95159
+ // elms.forEach((elm)=>{
95160
+ // dom.removeClass(elm, 'active');
95161
+ // });
95162
+ // elms = builderStuff.querySelectorAll('.is-sidebar-content');
95163
+ // elms.forEach((elm)=>{
95164
+ // dom.removeClass(elm, 'active');
95165
+ // });
95166
+ // document.body.style.overflowY = '';
95167
+ // Close all opened sidebar
95168
+ this.sidebar.closeSidebar();
95031
95169
  }
95032
95170
  } else {
95033
95171
  btn.onClick();