@innovastudio/contentbox 1.5.63 → 1.5.65

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/contentbox",
3
3
  "type": "module",
4
- "version": "1.5.63",
4
+ "version": "1.5.65",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -50,7 +50,7 @@
50
50
  "ws": "^8.13.0"
51
51
  },
52
52
  "dependencies": {
53
- "@innovastudio/contentbuilder": "^1.4.81",
53
+ "@innovastudio/contentbuilder": "^1.4.82",
54
54
  "js-beautify": "^1.14.0"
55
55
  }
56
56
  }
@@ -13799,7 +13799,7 @@ class EditBox {
13799
13799
  } else if (s === 'video') {
13800
13800
  const chooseVideoBg = currentVideo => {
13801
13801
  // Choose random video
13802
- let videoList = this.builder.media.bg_videos;
13802
+ let videoList = this.builder.media.videos;
13803
13803
  let randomIndex;
13804
13804
 
13805
13805
  if (currentVideo) {
@@ -13810,13 +13810,13 @@ class EditBox {
13810
13810
  randomIndex = Math.floor(Math.random() * videoList.length);
13811
13811
  }
13812
13812
 
13813
- return videoList[randomIndex];
13813
+ return this.builder.mediaPath + videoList[randomIndex];
13814
13814
  };
13815
13815
 
13816
13816
  let video = chooseVideoBg();
13817
13817
  code = `
13818
13818
  <video id="{id}" class="is-video-bg" muted loop playsinline autoplay>
13819
- <source src="${this.builder.media.blank_video}" data-default="${video}">
13819
+ <source src="${this.builder.mediaPath + this.builder.media.blank_video}" data-default="${video}">
13820
13820
  </video>
13821
13821
  <div class="is-overlay-video" style="opacity:0.05"></div>
13822
13822
  <script>
@@ -92960,10 +92960,22 @@ class Dictation {
92960
92960
  stopDictation() {
92961
92961
  if (this.recognition) this.recognition.abort();
92962
92962
  this.aborted = true;
92963
- if (this.recorder) this.recorder.stopRecording();
92964
- if (this.localStream) this.localStream.getAudioTracks().forEach(track => {
92965
- track.stop();
92966
- });
92963
+
92964
+ // Using RecordRTC
92965
+ // if(this.recorder) this.recorder.stopRecording();
92966
+ // if(this.localStream) this.localStream.getAudioTracks().forEach(track => {
92967
+ // track.stop();
92968
+ // });
92969
+
92970
+ // Using mediaRecorder
92971
+ if (this.mediaRecorder && this.mediaRecorder.state !== 'inactive') {
92972
+ this.mediaRecorder.stop();
92973
+ this.localStream.getTracks().forEach(track => track.stop()); // Stop the tracks to release the resources
92974
+ }
92975
+
92976
+ if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
92977
+ this.websocket.close();
92978
+ }
92967
92979
  }
92968
92980
  async startDictation() {
92969
92981
  const inpCommand = this.modalCommand.querySelector('.inp-command');
@@ -93017,9 +93029,14 @@ class Dictation {
93017
93029
  sampleRate: sampleRate
93018
93030
  }
93019
93031
  }).then(stream => {
93032
+ this.localStream = stream;
93020
93033
  this.mediaRecorder = new MediaRecorder(stream);
93021
93034
  this.mediaRecorder.addEventListener('dataavailable', event => {
93035
+ if (this.aborted) return;
93036
+
93022
93037
  // console.log(event.data);
93038
+ // if (event.data.size > 0) {
93039
+ // }
93023
93040
  this.websocket.send(event.data);
93024
93041
  });
93025
93042
 
@@ -109145,7 +109162,7 @@ Important: Do not change the 'div.is-container' element!
109145
109162
 
109146
109163
  let newMedia = mediaList[randomIndex];
109147
109164
  this.builder.currentMedia = newMedia;
109148
- return newMedia;
109165
+ return this.builder.mediaPath + newMedia;
109149
109166
  }
109150
109167
 
109151
109168
  getTypographyClass(html) {
@@ -109953,10 +109970,12 @@ class Command {
109953
109970
  } // Replace {{_IMAGEURL}}
109954
109971
 
109955
109972
 
109956
- const gallery = this.builder.media.images;
109957
- const imageList = gallery.square;
109958
- const imageUrl = this.lib.chooseMedia(imageList);
109959
- context = context.replaceAll('{{_IMAGEURL}}', imageUrl);
109973
+ if (context.includes('{{_IMAGEURL}}')) {
109974
+ const gallery = this.builder.media.images;
109975
+ const imageList = gallery.square;
109976
+ const imageUrl = this.lib.chooseMedia(imageList);
109977
+ context = context.replaceAll('{{_IMAGEURL}}', imageUrl);
109978
+ }
109960
109979
  } else if (args.new_section_two_boxes || args.new_section_three_boxes || args.new_section_four_boxes) {
109961
109980
  if (args.new_section_two_boxes) {
109962
109981
  context = cl.new_section_two_boxes;
@@ -109983,13 +110002,15 @@ class Command {
109983
110002
  context += '\n\n' + cl.update_section_article_with_image;
109984
110003
  } else if (args.add_article) {
109985
110004
  context += '\n\n' + cl.update_section_article_with_image;
109986
- } else ; //Replace {{_IMAGEURL}}
109987
-
110005
+ } else ;
109988
110006
 
109989
- const gallery = this.builder.media.images;
109990
- const imageList = gallery.square;
109991
- const imageUrl = this.lib.chooseMedia(imageList);
109992
- context = context.replaceAll('{{_IMAGEURL}}', imageUrl);
110007
+ if (context.includes('{{_IMAGEURL}}')) {
110008
+ //Replace {{_IMAGEURL}}
110009
+ const gallery = this.builder.media.images;
110010
+ const imageList = gallery.square;
110011
+ const imageUrl = this.lib.chooseMedia(imageList);
110012
+ context = context.replaceAll('{{_IMAGEURL}}', imageUrl);
110013
+ }
109993
110014
  }
109994
110015
  } else {
109995
110016
  //if(args.redesign_layout || args.change_text || args.change_style) {
@@ -110068,13 +110089,15 @@ ${currentHtml}
110068
110089
  } else if (args.add_article) {
110069
110090
  context += '\n' + cl.update_section_article_with_image;
110070
110091
  } else ;
110071
- } //Replace {{_IMAGEURL}}
110072
-
110092
+ }
110073
110093
 
110074
- const gallery = this.builder.media.images;
110075
- const imageList = gallery.square;
110076
- const imageUrl = this.lib.chooseMedia(imageList);
110077
- context = context.replaceAll('{{_IMAGEURL}}', imageUrl);
110094
+ if (context.includes('{{_IMAGEURL}}')) {
110095
+ //Replace {{_IMAGEURL}}
110096
+ const gallery = this.builder.media.images;
110097
+ const imageList = gallery.square;
110098
+ const imageUrl = this.lib.chooseMedia(imageList);
110099
+ context = context.replaceAll('{{_IMAGEURL}}', imageUrl);
110100
+ }
110078
110101
  } // Check elements and add relevant context
110079
110102
 
110080
110103
 
@@ -110134,7 +110157,7 @@ ${currentHtml}
110134
110157
  // New Section
110135
110158
  // html = this.fixIcons(html);
110136
110159
  html = this.fixButtons(html);
110137
- html = this.fixBgImage(html);
110160
+ html = this.fixBgImage(html); // only if box has inline bg image, which is incorrect
110138
110161
 
110139
110162
  if (args.section_background && args.section_background === 'image') {
110140
110163
  html = this.setBgImage(html, true); // Change the bg image (also fix incorrect structure)
@@ -111454,7 +111477,7 @@ ${currentHtml}`;
111454
111477
  randomIndex = Math.floor(Math.random() * imageList.length);
111455
111478
  }
111456
111479
 
111457
- return imageList[randomIndex];
111480
+ return this.builder.mediaPath + imageList[randomIndex];
111458
111481
  } // Not Used
111459
111482
 
111460
111483
 
@@ -111669,31 +111692,7 @@ ${currentHtml}`;
111669
111692
  let overlayCode = overlay.querySelector('.is-overlay-content');
111670
111693
  if (overlayCode) overlayCode.parentNode.removeChild(overlayCode);
111671
111694
  let sectionBox = false;
111672
- if (box.classList.contains('is-section')) sectionBox = true; // Choose random image
111673
-
111674
- let bgImageUrl;
111675
- let imageList;
111676
-
111677
- if (sectionBox) {
111678
- const gallery = this.builder.media.bg_images;
111679
- imageList = gallery.section_text_left;
111680
- const container = box.querySelector('.is-container');
111681
-
111682
- if (container) {
111683
- if (container.classList.contains('is-content-left')) {
111684
- imageList = gallery.section_text_left;
111685
- } else if (container.classList.contains('is-content-right')) {
111686
- imageList = gallery.section_text_right;
111687
- } else {
111688
- imageList = gallery.section_text_center;
111689
- }
111690
- }
111691
- } else {
111692
- const gallery = this.builder.media.bg_images;
111693
- imageList = gallery.box;
111694
- }
111695
-
111696
- bgImageUrl = this.lib.chooseMedia(imageList); // Check/fix if container misplaced
111695
+ if (box.classList.contains('is-section')) sectionBox = true; // Check/fix if container misplaced
111697
111696
 
111698
111697
  const container = overlay.querySelector('.is-container');
111699
111698
 
@@ -111704,6 +111703,30 @@ ${currentHtml}`;
111704
111703
  }
111705
111704
 
111706
111705
  if (overlayBg) {
111706
+ // Choose random image
111707
+ let bgImageUrl;
111708
+ let imageList;
111709
+
111710
+ if (sectionBox) {
111711
+ const gallery = this.builder.media.bg_images;
111712
+ imageList = gallery.section_text_left;
111713
+ const container = box.querySelector('.is-container');
111714
+
111715
+ if (container) {
111716
+ if (container.classList.contains('is-content-left')) {
111717
+ imageList = gallery.section_text_left;
111718
+ } else if (container.classList.contains('is-content-right')) {
111719
+ imageList = gallery.section_text_right;
111720
+ } else {
111721
+ imageList = gallery.section_text_center;
111722
+ }
111723
+ }
111724
+ } else {
111725
+ const gallery = this.builder.media.bg_images;
111726
+ imageList = gallery.box;
111727
+ }
111728
+
111729
+ bgImageUrl = this.lib.chooseMedia(imageList);
111707
111730
  overlayBg.style.backgroundImage = `url('${bgImageUrl}')`;
111708
111731
  overlayBg.style.backgroundImage = `url('${bgImageUrl}')`;
111709
111732
  overlayBg.style.backgroundPosition = '50% 60%';
@@ -111996,12 +112019,16 @@ ${currentHtml}`;
111996
112019
  fixHtml(html) {
111997
112020
  // Fix overlay structure when "is-overlay" containing background image in the style attribute
111998
112021
  let regex = /<div class="is-overlay"([^>]*)style="([^"]*background-image:[^;"]+;)([^"]*)"([^>]*)>/g;
111999
- html = html.replace(regex, '<div class="is-overlay"$1$4>\n <div class="is-overlay-bg" style="$2"></div>'); // Fix {{IMAGEURL}} that failed to replace
112022
+ html = html.replace(regex, '<div class="is-overlay"$1$4>\n <div class="is-overlay-bg" style="$2"></div>');
112023
+
112024
+ if (html.includes('{{_IMAGEURL}}')) {
112025
+ // Fix {{IMAGEURL}} that failed to replace
112026
+ const gallery = this.builder.media.images;
112027
+ const imageList = gallery.square;
112028
+ const imageUrl = this.lib.chooseMedia(imageList);
112029
+ html = html.replaceAll('{{IMAGEURL}}', imageUrl);
112030
+ } // Fix {{ICONCLASS}} that failed to replace
112000
112031
 
112001
- const gallery = this.builder.media.images;
112002
- const imageList = gallery.square;
112003
- const imageUrl = this.lib.chooseMedia(imageList);
112004
- html = html.replaceAll('{{IMAGEURL}}', imageUrl); // Fix {{ICONCLASS}} that failed to replace
112005
112032
 
112006
112033
  html = html.replaceAll('{{ICONCLASS}}', 'ion-checkmark');
112007
112034
  html = this.replaceButtonsWithAnchorTags(html);
@@ -115044,42 +115071,42 @@ class ContentBox {
115044
115071
  similarityThreshold: 0.65,
115045
115072
  // for commandList similarity checking
115046
115073
  headlineList: ['We\'re [CompanyName]. Full stack development with a spark of creativity.', 'Transforming your digital experience with [CompanyName]. Achieve your online goals with our customized solutions.', 'Revolutionizing web development with [CompanyName]. Unleash your digital potential with our high-performance solutions.'],
115074
+ mediaPath: 'assets/gallery/',
115047
115075
  media: {
115048
- slider: ['assets/templates-simple/images/img-030.jpg', 'assets/templates-simple/images/img-025.jpg'],
115049
- blank_video: 'assets/templates-simple/videos/blank.mp4',
115050
- bg_videos: ['assets/templates-simple/videos/beach1.mp4', 'assets/templates-simple/videos/beach2.mp4'],
115051
- videos: ['assets/templates-simple/videos/beach1.mp4', 'assets/templates-simple/videos/beach2.mp4'],
115076
+ slider: ['slide-01.jpg', 'slide-02.jpg'],
115077
+ blank_video: 'blank.mp4',
115078
+ videos: ['beach1.mp4', 'beach2.mp4'],
115052
115079
  youtube_videos: ['https://www.youtube.com/embed/P5yHEKqx86U?rel=0'],
115053
115080
  maps: ['https://www.youtube.com/embed/P5yHEKqx86U?rel=0'],
115054
- audios: ['assets/minimalist-blocks/example.mp3'],
115081
+ audios: ['example.mp3'],
115055
115082
  images: {
115056
- square: ['assets/gallery/person-01.jpg', 'assets/gallery/person-02.jpg', 'assets/gallery/person-03.jpg', 'assets/gallery/person-04.jpg', 'assets/gallery/person-05.jpg', 'assets/gallery/person-06.jpg', 'assets/gallery/person-08.jpg']
115083
+ square: ['person-01.jpg', 'person-02.jpg', 'person-03.jpg', 'person-04.jpg', 'person-05.jpg', 'person-06.jpg', 'person-08.jpg']
115057
115084
  },
115058
115085
  bg_images: {
115059
- box: ['assets/gallery/person-01.jpg', 'assets/gallery/person-02.jpg', 'assets/gallery/person-03.jpg', 'assets/gallery/person-04.jpg', 'assets/gallery/person-05.jpg', 'assets/gallery/person-06.jpg', 'assets/gallery/person-07.jpg', 'assets/gallery/person-08.jpg', 'assets/gallery/person-09.jpg', 'assets/gallery/person-10.jpg', 'assets/gallery/building.jpg', 'assets/gallery/desk.jpg', 'assets/gallery/chair.jpg', 'assets/gallery/coffee.jpg', 'assets/gallery/product.jpg', 'assets/gallery/table.jpg'],
115060
- small_box: ['assets/gallery/person-01.jpg', 'assets/gallery/person-03.jpg', 'assets/gallery/person-04.jpg', 'assets/gallery/person-05.jpg', 'assets/gallery/person-10.jpg', 'assets/gallery/chair.jpg', 'assets/gallery/coffee.jpg', 'assets/gallery/product.jpg', 'assets/gallery/table.jpg'],
115086
+ box: ['person-01.jpg', 'person-02.jpg', 'person-03.jpg', 'person-04.jpg', 'person-05.jpg', 'person-06.jpg', 'person-07.jpg', 'person-08.jpg', 'person-09.jpg', 'person-10.jpg', 'building.jpg', 'desk.jpg', 'chair.jpg', 'coffee.jpg', 'product.jpg', 'table.jpg'],
115087
+ small_box: ['person-01.jpg', 'person-03.jpg', 'person-04.jpg', 'person-05.jpg', 'person-10.jpg', 'chair.jpg', 'coffee.jpg', 'product.jpg', 'table.jpg'],
115061
115088
  // section: [
115062
- // 'assets/gallery/header-01.jpg',
115063
- // 'assets/gallery/header-02.jpg',
115064
- // 'assets/gallery/header-03.jpg',
115065
- // 'assets/gallery/header-04.jpg',
115066
- // 'assets/gallery/header-05.jpg',
115067
- // 'assets/gallery/header-06.jpg',
115068
- // 'assets/gallery/header-07.jpg',
115069
- // 'assets/gallery/header-08.jpg',
115070
- // 'assets/gallery/header-09.jpg',
115071
- // 'assets/gallery/header-10.jpg',
115072
- // 'assets/gallery/header-11.jpg',
115073
- // 'assets/gallery/header-12.jpg',
115074
- // 'assets/gallery/header-13.jpg',
115075
- // 'assets/gallery/header-14.jpg',
115076
- // 'assets/gallery/header-15.jpg',
115089
+ // 'header-01.jpg',
115090
+ // 'header-02.jpg',
115091
+ // 'header-03.jpg',
115092
+ // 'header-04.jpg',
115093
+ // 'header-05.jpg',
115094
+ // 'header-06.jpg',
115095
+ // 'header-07.jpg',
115096
+ // 'header-08.jpg',
115097
+ // 'header-09.jpg',
115098
+ // 'header-10.jpg',
115099
+ // 'header-11.jpg',
115100
+ // 'header-12.jpg',
115101
+ // 'header-13.jpg',
115102
+ // 'header-14.jpg',
115103
+ // 'header-15.jpg',
115077
115104
  // ],
115078
- section_text_left: ['assets/gallery/header-01.jpg', 'assets/gallery/header-02.jpg', 'assets/gallery/header-03.jpg', 'assets/gallery/header-05.jpg', 'assets/gallery/header-08.jpg', 'assets/gallery/header-10b.jpg', // 'assets/gallery/header-13.jpg',
115079
- 'assets/gallery/header-14.jpg' // 'assets/gallery/header-15b.jpg',
115105
+ section_text_left: ['header-01.jpg', 'header-02.jpg', 'header-03.jpg', 'header-05.jpg', 'header-08.jpg', 'header-10b.jpg', // 'header-13.jpg',
115106
+ 'header-14.jpg' // 'header-15b.jpg',
115080
115107
  ],
115081
- section_text_center: ['assets/gallery/header-07.jpg', 'assets/gallery/header-11.jpg', 'assets/gallery/header-12.jpg', 'assets/gallery/header-13.jpg'],
115082
- section_text_right: ['assets/gallery/header-04.jpg', 'assets/gallery/header-05b.jpg', 'assets/gallery/header-06.jpg', 'assets/gallery/header-08b.jpg', 'assets/gallery/header-09.jpg', 'assets/gallery/header-10.jpg', 'assets/gallery/header-14b.jpg', 'assets/gallery/header-15.jpg']
115108
+ section_text_center: ['header-07.jpg', 'header-11.jpg', 'header-12.jpg', 'header-13.jpg'],
115109
+ section_text_right: ['header-04.jpg', 'header-05b.jpg', 'header-06.jpg', 'header-08b.jpg', 'header-09.jpg', 'header-10.jpg', 'header-14b.jpg', 'header-15.jpg']
115083
115110
  }
115084
115111
  },
115085
115112
  shortCommandList: {