@innovastudio/contentbuilder 1.5.10 → 1.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.10",
4
+ "version": "1.5.12",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -2515,6 +2515,10 @@ button:focus-visible {
2515
2515
  box-sizing: border-box;
2516
2516
  height: 590px;
2517
2517
  }
2518
+ #_cbhtml .is-modal.pagesize .div-page-sizes .paper-item,
2519
+ .is-ui .is-modal.pagesize .div-page-sizes .paper-item {
2520
+ flex: none;
2521
+ }
2518
2522
  #_cbhtml .is-modal.pagesize [data-pagesize],
2519
2523
  .is-ui .is-modal.pagesize [data-pagesize] {
2520
2524
  background: #fff;
@@ -3221,6 +3221,7 @@ class Util {
3221
3221
  localStorage.removeItem('_auto_editblock');
3222
3222
  localStorage.removeItem('_command_lang');
3223
3223
  localStorage.removeItem('_ai_panel_open');
3224
+ localStorage.removeItem('_pagesize');
3224
3225
 
3225
3226
  //NOT USED
3226
3227
  localStorage.removeItem('_scrollableeditor');
@@ -71864,7 +71865,12 @@ class SaveImages {
71864
71865
  //Read image (base64 string)
71865
71866
  let image = src;
71866
71867
  image = image.replace(/^data:image\/(png|svg\+xml|jpeg);base64,/, '');
71867
- let filename = this.builder.util.makeId() + '.' + ext; //img.getAttribute('data-filename');
71868
+ let filename;
71869
+ if (div.hasAttribute('data-filename')) {
71870
+ filename = div.getAttribute('data-filename');
71871
+ } else {
71872
+ filename = this.builder.util.makeId() + '.' + ext;
71873
+ }
71868
71874
 
71869
71875
  // console.log(div)
71870
71876
  this.opts.onBase64Upload(div, image, filename); // target image, base64 string, filename
@@ -85075,6 +85081,7 @@ class PageSize {
85075
85081
  const builderStuff = this.builderStuff;
85076
85082
  const util = this.util;
85077
85083
  const dom = this.dom;
85084
+ const pageSizes = this.builder.pageSizes;
85078
85085
  let modal = builderStuff.querySelector('.is-modal.pagesize');
85079
85086
  if (!modal) {
85080
85087
  const html = `
@@ -85082,24 +85089,7 @@ class PageSize {
85082
85089
  <div class="is-modal-content">
85083
85090
 
85084
85091
  <div class="div-page-sizes">
85085
- <button title="Web" data-pagesize="100%,100vh,web" data-width="" data-height="" style="flex:none;width:180px;height:112.5px" class="paper-item">Web (full)</button>
85086
- <button title="Web" data-pagesize="800px,1000px,web" data-width="" data-height="" style="flex:none;width:180px;height:112.5px" class="paper-item">Web (container)</button>
85087
- <button title="8.27x5.52" data-pagesize="8.27in,5.52in" data-width="8.27in" data-height="5.52in" style="flex:none;width:124.05px;height:82.8px" class="paper-item">8.27x5.52</button>
85088
- <button title="8.3x5.8" data-pagesize="8.3in,5.8in" data-width="8.3in" data-height="5.8in" style="flex:none;width:124.50000000000001px;height:87px" class="paper-item">A5</button>
85089
- <button title="9x7" data-pagesize="9in,7in" data-width="9in" data-height="7in" style="flex:none;width:135px;height:105px" class="paper-item">9x7</button>
85090
- <button title="11.7x8.3" data-pagesize="11.7in,8.3in" data-width="11.7in" data-height="8.3in" style="flex:none;width:175.5px;height:124.50000000000001px" class="paper-item">A4</button>
85091
- <button title="11x8.5" data-pagesize="11in,8.5in" data-width="11in" data-height="8.5in" style="flex:none;width:165px;height:127.5px" class="paper-item">Letter</button>
85092
- <button title="12.5x10" data-pagesize="12.5in,10in" data-width="12.5in" data-height="10in" style="flex:none;width:187.5px;height:150px" class="paper-item">12.5x10</button>
85093
- <button title="14x11" data-pagesize="14in,11in" data-width="14in" data-height="11in" style="flex:none;width:210px;height:165px" class="paper-item">14x11</button>
85094
- <button title="8.5x8.5" data-pagesize="8.5in,8.5in" data-width="8.5in" data-height="8.5in" style="flex:none;width:127.5px;height:127.5px" class="paper-item">8.5x8.5</button>
85095
- <button title="10x10" data-pagesize="10in,10in" data-width="10in" data-height="10in" style="flex:none;width:150px;height:150px" class="paper-item on">10x10</button>
85096
- <button title="12x12" data-pagesize="12in,12in" data-width="12in" data-height="12in" style="flex:none;width:180px;height:180px" class="paper-item">12x12</button>
85097
- <button title="5.27x8.27" data-pagesize="5.27in,8.27in" data-width="5.27in" data-height="8.27in" style="flex:none;width:79.05px;height:124.05px" class="paper-item">5.27x8.27</button>
85098
- <button title="5.8x8.3" data-pagesize="5.8in,8.3in" data-width="5.8in" data-height="8.3in" style="flex:none;width:87px;height:124.50000000000001px" class="paper-item">A5</button>
85099
- <button title="6x9" data-pagesize="6in,9in" data-width="6in" data-height="9in" style="flex:none;width:90px;height:135px" class="paper-item">6x9</button>
85100
- <button title="6.6x10.25" data-pagesize="6.6in,10.25in" data-width="6.6in" data-height="10.25in" style="flex:none;width:99px;height:153.75px" class="paper-item">6.6x10.25</button>
85101
- <button title="8.5x11" data-pagesize="8.5in,11in" data-width="8.5in" data-height="11in" style="flex:none;width:127.5px;height:165px" class="paper-item">Letter</button>
85102
- <button title="8.3x11.7" data-pagesize="8.3in,11.7in" data-width="8.3in" data-height="11.7in" style="flex:none;width:124.50000000000001px;height:175.5px" class="paper-item">A4</button>
85092
+ ${pageSizes.map(item => `<button title="${item.title}" data-pagesize="${item.pagesize}" style="${item.style}" class="paper-item">${item.title}</button>`).join('')}
85103
85093
  </div>
85104
85094
 
85105
85095
  <div class="flex" style="gap:10px;justify-content:center;margin-top:15px;">
@@ -85678,6 +85668,81 @@ class ContentBuilder {
85678
85668
  onBlockCanvasAdd: function () {},
85679
85669
  // docContainer: '.is-page',
85680
85670
  blockContainer: '.is-box',
85671
+ pageSize: '100%,100vh,web',
85672
+ //'800px,1000px,web'
85673
+ pageSizes: [{
85674
+ title: 'Web',
85675
+ pagesize: '100%,100vh,web',
85676
+ style: 'width:180px;height:112.5px'
85677
+ }, {
85678
+ title: 'Web (container)',
85679
+ pagesize: '800px,1000px,web',
85680
+ style: 'width:180px;height:112.5px'
85681
+ }, {
85682
+ title: '8.27x5.52',
85683
+ pagesize: '8.27in,5.52in',
85684
+ style: 'width:124.05px;height:82.8px'
85685
+ }, {
85686
+ title: '8.3x5.8',
85687
+ pagesize: '8.3in,5.8in',
85688
+ style: 'width:124.5px;height:87px'
85689
+ }, {
85690
+ title: '9x7',
85691
+ pagesize: '9in,7in',
85692
+ style: 'wwidth:135px;height:105px'
85693
+ }, {
85694
+ title: 'A4',
85695
+ pagesize: '11.7in,8.3in',
85696
+ style: 'width:175.5px;height:124.5px'
85697
+ }, {
85698
+ title: 'Letter',
85699
+ pagesize: '11in,8.5in',
85700
+ style: 'width:165px;height:127.5px'
85701
+ }, {
85702
+ title: '12.5x10',
85703
+ pagesize: '12.5in,10in',
85704
+ style: 'width:187.5px;height:150px'
85705
+ }, {
85706
+ title: '14x11',
85707
+ pagesize: '14in,11in',
85708
+ style: 'width:210px;height:165px'
85709
+ }, {
85710
+ title: '8.5x8.5',
85711
+ pagesize: '8.5in,8.5in',
85712
+ style: 'width:127.5px;height:127.5px'
85713
+ }, {
85714
+ title: '10x10',
85715
+ pagesize: '10in,10in',
85716
+ style: 'width:150px;height:150px'
85717
+ }, {
85718
+ title: '12x12',
85719
+ pagesize: '12in,12in',
85720
+ style: 'width:180px;height:180px'
85721
+ }, {
85722
+ title: '5.27x8.27',
85723
+ pagesize: '5.27in,8.27in',
85724
+ style: 'width:79.05px;height:124.05px'
85725
+ }, {
85726
+ title: 'A5',
85727
+ pagesize: '5.8in,8.3in',
85728
+ style: 'width:87px;height:124.5px'
85729
+ }, {
85730
+ title: '6x9',
85731
+ pagesize: '6in,9in',
85732
+ style: 'width:90px;height:135px'
85733
+ }, {
85734
+ title: '6.6x10.25',
85735
+ pagesize: '6.6in,10.25in',
85736
+ style: 'width:99px;height:153.75px'
85737
+ }, {
85738
+ title: 'Letter',
85739
+ pagesize: '8.5in,11in',
85740
+ style: 'width:127.5px;height:165px'
85741
+ }, {
85742
+ title: 'A4',
85743
+ pagesize: '8.3in,11.7in',
85744
+ style: 'width:124.5px;height:175.5px'
85745
+ }],
85681
85746
  /*
85682
85747
  Deprecated:
85683
85748
  snippetSampleImage: '',
@@ -89816,6 +89881,18 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
89816
89881
  const docContainer = this.doc.querySelector(this.docContainer);
89817
89882
  let range = this.doc.createRange();
89818
89883
  docContainer.innerHTML = '';
89884
+ if (!html.includes('is-box')) {
89885
+ html = `
89886
+ <div class="is-box box-canvas autolayout">
89887
+ <div class="is-block block-steady height-auto" style="top: calc(50% - 357px); left: calc(50% - 348px); width: 696px;" data--t="calc(50% - 357px)" data--l="calc(50% - 348px)" data--b="" data--r="" data--w="696px" data--h="">
89888
+ <div class="is-container leading-12 size-17">
89889
+ ${html}
89890
+ </div>
89891
+ <div class="is-block-overlay"></div>
89892
+ </div>
89893
+ </div>
89894
+ `;
89895
+ }
89819
89896
  docContainer.appendChild(range.createContextualFragment(html)); // We use createContextualFragment so that embedded javascript code (code block) will be executed
89820
89897
 
89821
89898
  // set page size