@innovastudio/contentbox 1.5.66 → 1.5.68

Sign up to get free protection for your applications and to get access to all the features.
@@ -5840,7 +5840,7 @@ var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof w
5840
5840
 
5841
5841
  var js$2 = {exports: {}};
5842
5842
 
5843
- var src$2 = {};
5843
+ var src$1 = {};
5844
5844
 
5845
5845
  var javascript$1 = {exports: {}};
5846
5846
 
@@ -11024,9 +11024,9 @@ function style_html$2(html_source, options, js, css) {
11024
11024
  }
11025
11025
  style_html$2.defaultOptions = html_beautify$1.defaultOptions;
11026
11026
 
11027
- src$2.js = js_beautify$2;
11028
- src$2.css = css_beautify$2;
11029
- src$2.html = style_html$2;
11027
+ src$1.js = js_beautify$2;
11028
+ src$1.css = css_beautify$2;
11029
+ src$1.html = style_html$2;
11030
11030
 
11031
11031
  /*jshint node:true */
11032
11032
 
@@ -11069,7 +11069,7 @@ function get_beautify(js_beautify, css_beautify, html_beautify) {
11069
11069
 
11070
11070
  {
11071
11071
  (function(mod) {
11072
- var beautifier = src$2;
11072
+ var beautifier = src$1;
11073
11073
  beautifier.js_beautify = beautifier.js;
11074
11074
  beautifier.css_beautify = beautifier.css;
11075
11075
  beautifier.html_beautify = beautifier.html;
@@ -14057,10 +14057,10 @@ class EditBox {
14057
14057
  <div data-glide-el="track" class="glide__track">
14058
14058
  <ul class="glide__slides">
14059
14059
  <li class="glide__slide">
14060
- <div><img src="${imageList[0]}" alt=""></div>
14060
+ <div><img src="${this.builder.mediaPath + imageList[0]}" alt=""></div>
14061
14061
  </li>
14062
14062
  <li class="glide__slide">
14063
- <div><img src="${imageList[1]}" alt=""></div>
14063
+ <div><img src="${this.builder.mediaPath + imageList[1]}" alt=""></div>
14064
14064
  </li>
14065
14065
  </ul>
14066
14066
  </div>
@@ -14156,11 +14156,11 @@ class EditBox {
14156
14156
  "images":
14157
14157
  [
14158
14158
  {
14159
- "src": "${imageList[0]}",
14159
+ "src": "${this.builder.mediaPath + imageList[0]}",
14160
14160
  "caption": "", "style": ""
14161
14161
  },
14162
14162
  {
14163
- "src": "${imageList[1]}",
14163
+ "src": "${this.builder.mediaPath + imageList[1]}",
14164
14164
  "caption": "", "style": ""
14165
14165
  }
14166
14166
  ]
@@ -15138,10 +15138,6 @@ class EditBox {
15138
15138
 
15139
15139
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
15140
15140
 
15141
- function getDefaultExportFromCjs (x) {
15142
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
15143
- }
15144
-
15145
15141
  var rangyCore = {exports: {}};
15146
15142
 
15147
15143
  /**
@@ -23689,7 +23685,7 @@ class Dom {
23689
23685
 
23690
23686
  var js$1 = {exports: {}};
23691
23687
 
23692
- var src$1 = {};
23688
+ var src = {};
23693
23689
 
23694
23690
  var javascript = {exports: {}};
23695
23691
 
@@ -28828,9 +28824,9 @@ function style_html(html_source, options, js, css) {
28828
28824
  }
28829
28825
  style_html.defaultOptions = html_beautify.defaultOptions;
28830
28826
 
28831
- src$1.js = js_beautify;
28832
- src$1.css = css_beautify;
28833
- src$1.html = style_html;
28827
+ src.js = js_beautify;
28828
+ src.css = css_beautify;
28829
+ src.html = style_html;
28834
28830
 
28835
28831
  /*jshint node:true */
28836
28832
 
@@ -28873,7 +28869,7 @@ function get_beautify(js_beautify, css_beautify, html_beautify) {
28873
28869
 
28874
28870
  {
28875
28871
  (function(mod) {
28876
- var beautifier = src$1;
28872
+ var beautifier = src;
28877
28873
  beautifier.js_beautify = beautifier.js;
28878
28874
  beautifier.css_beautify = beautifier.css;
28879
28875
  beautifier.html_beautify = beautifier.html;
@@ -73946,6 +73942,33 @@ class ColumnTool {
73946
73942
  util.clearControls();
73947
73943
  });
73948
73944
 
73945
+ /*
73946
+ const fixLayout = (row) => {
73947
+ let hasFixed = false;
73948
+ let elm = row.firstElementChild;
73949
+ let cols = this.builder.cols;
73950
+ cols.forEach(item=>{
73951
+ let elmClass = elm.getAttribute('class');
73952
+ if(elmClass) {
73953
+ // console.log(elmClass, item);
73954
+ if(elmClass.indexOf(item)!==-1) {
73955
+ hasFixed=true;
73956
+ }
73957
+ }
73958
+ });
73959
+ // console.log('result:' + hasFixed);
73960
+ if(!hasFixed) {
73961
+ if(this.builder.framework==='foundation') Array.from(row.children).map((item) => {
73962
+ if(item.classList.contains('is-row-tool')) return;
73963
+ if(item.classList.contains('is-col-tool')) return;
73964
+ if(item.classList.contains('is-rowadd-tool')) return;
73965
+ item.classList.remove('column');
73966
+ });
73967
+ util.fixLayout(row);
73968
+ }
73969
+ };
73970
+ */
73971
+
73949
73972
  // Increase
73950
73973
  elm = columnMore.querySelector('.cell-increase');
73951
73974
  dom.addEventListener(elm, 'click', () => {
@@ -73973,7 +73996,10 @@ class ColumnTool {
73973
73996
  });
73974
73997
  util.fixLayout(row);
73975
73998
  }
73999
+
74000
+ // fixLayout(row);
73976
74001
  }
74002
+
73977
74003
  this.grid.increaseColumn();
73978
74004
 
73979
74005
  // Refresh Module
@@ -74017,7 +74043,10 @@ class ColumnTool {
74017
74043
  });
74018
74044
  util.fixLayout(row);
74019
74045
  }
74046
+
74047
+ // fixLayout(row);
74020
74048
  }
74049
+
74021
74050
  this.grid.decreaseColumn();
74022
74051
 
74023
74052
  // Refresh Module
@@ -92536,14 +92565,8 @@ class Lib$1 {
92536
92565
  }
92537
92566
  }
92538
92567
 
92539
- var recorder_min = {exports: {}};
92540
-
92541
- (function (module, exports) {
92542
- !function(e,t){module.exports=t();}("undefined"!=typeof self?self:commonjsGlobal,(function(){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n});},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){(function(t){function o(e,t){if(null==e)return {};var o,n,i=function(e,t){if(null==e)return {};var o,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i}var n=t.AudioContext||t.webkitAudioContext,i=function e(){var t=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.isRecordingSupported())throw new Error("Recording is not supported in this browser");this.state="inactive",this.config=Object.assign({bufferLength:4096,encoderApplication:2049,encoderFrameSize:20,encoderPath:"encoderWorker.min.js",encoderSampleRate:48e3,maxFramesPerPage:40,mediaTrackConstraints:!0,monitorGain:0,numberOfChannels:1,recordingGain:1,resampleQuality:3,streamPages:!1,wavBitDepth:16,sourceNode:{context:null}},o),this.encodedSamplePosition=0,this.initAudioContext(),this.initialize=this.initWorklet().then((function(){return t.initEncoder()}));};i.isRecordingSupported=function(){var e=t.navigator&&t.navigator.mediaDevices&&t.navigator.mediaDevices.getUserMedia;return n&&e&&t.WebAssembly},i.version="8.0.5",i.prototype.clearStream=function(){this.stream&&(this.stream.getTracks?this.stream.getTracks().forEach((function(e){return e.stop()})):this.stream.stop());},i.prototype.close=function(){return this.monitorGainNode.disconnect(),this.recordingGainNode.disconnect(),this.sourceNode&&this.sourceNode.disconnect(),this.clearStream(),this.encoder&&(this.encoderNode.disconnect(),this.encoder.postMessage({command:"close"})),this.config.sourceNode.context?Promise.resolve():this.audioContext.close()},i.prototype.encodeBuffers=function(e){if("recording"===this.state){for(var t=[],o=0;o<e.numberOfChannels;o++)t[o]=e.getChannelData(o);this.encoder.postMessage({command:"encode",buffers:t});}},i.prototype.initAudioContext=function(){this.audioContext=this.config.sourceNode.context?this.config.sourceNode.context:new n,this.monitorGainNode=this.audioContext.createGain(),this.setMonitorGain(this.config.monitorGain),this.recordingGainNode=this.audioContext.createGain(),this.setRecordingGain(this.config.recordingGain);},i.prototype.initEncoder=function(){var e=this;this.audioContext.audioWorklet?(this.encoderNode=new AudioWorkletNode(this.audioContext,"encoder-worklet",{numberOfOutputs:0}),this.encoder=this.encoderNode.port):(console.log("audioWorklet support not detected. Falling back to scriptProcessor"),this.encodeBuffers=function(){return delete e.encodeBuffers},this.encoderNode=this.audioContext.createScriptProcessor(this.config.bufferLength,this.config.numberOfChannels,this.config.numberOfChannels),this.encoderNode.onaudioprocess=function(t){var o=t.inputBuffer;return e.encodeBuffers(o)},this.encoderNode.connect(this.audioContext.destination),this.encoder=new t.Worker(this.config.encoderPath));},i.prototype.initSourceNode=function(){var e=this;return this.config.sourceNode.context?(this.sourceNode=this.config.sourceNode,Promise.resolve()):t.navigator.mediaDevices.getUserMedia({audio:this.config.mediaTrackConstraints}).then((function(t){e.stream=t,e.sourceNode=e.audioContext.createMediaStreamSource(t);}))},i.prototype.initWorker=function(){var e=this,t=(this.config.streamPages?this.streamPage:this.storePage).bind(this);return this.recordedPages=[],this.totalLength=0,new Promise((function(n){e.encoder.addEventListener("message",(function o(i){var r=i.data;switch(r.message){case"ready":n();break;case"page":e.encodedSamplePosition=r.samplePosition,t(r.page);break;case"done":e.encoder.removeEventListener("message",o),e.finish();}})),e.encoder.start&&e.encoder.start();var i=e.config,r=(i.sourceNode,o(i,["sourceNode"]));e.encoder.postMessage(Object.assign({command:"init",originalSampleRate:e.audioContext.sampleRate,wavSampleRate:e.audioContext.sampleRate},r));}))},i.prototype.initWorklet=function(){return this.audioContext.audioWorklet?this.audioContext.audioWorklet.addModule(this.config.encoderPath):Promise.resolve()},i.prototype.pause=function(e){var t=this;if("recording"===this.state)return this.state="paused",this.recordingGainNode.disconnect(),e&&this.config.streamPages?new Promise((function(e){t.encoder.addEventListener("message",(function o(n){"flushed"===n.data.message&&(t.encoder.removeEventListener("message",o),t.onpause(),e());})),t.encoder.start&&t.encoder.start(),t.encoder.postMessage({command:"flush"});})):(this.onpause(),Promise.resolve())},i.prototype.resume=function(){"paused"===this.state&&(this.state="recording",this.recordingGainNode.connect(this.encoderNode),this.onresume());},i.prototype.setRecordingGain=function(e){this.config.recordingGain=e,this.recordingGainNode&&this.audioContext&&this.recordingGainNode.gain.setTargetAtTime(e,this.audioContext.currentTime,.01);},i.prototype.setMonitorGain=function(e){this.config.monitorGain=e,this.monitorGainNode&&this.audioContext&&this.monitorGainNode.gain.setTargetAtTime(e,this.audioContext.currentTime,.01);},i.prototype.start=function(){var e=this;return "inactive"===this.state?(this.state="loading",this.encodedSamplePosition=0,this.audioContext.resume().then((function(){return e.initialize})).then((function(){return Promise.all([e.initSourceNode(),e.initWorker()])})).then((function(){e.state="recording",e.encoder.postMessage({command:"getHeaderPages"}),e.sourceNode.connect(e.monitorGainNode),e.sourceNode.connect(e.recordingGainNode),e.monitorGainNode.connect(e.audioContext.destination),e.recordingGainNode.connect(e.encoderNode),e.onstart();})).catch((function(t){throw e.state="inactive",t}))):Promise.resolve()},i.prototype.stop=function(){var e=this;return "paused"===this.state||"recording"===this.state?(this.state="inactive",this.recordingGainNode.connect(this.encoderNode),this.monitorGainNode.disconnect(),this.clearStream(),new Promise((function(t){e.encoder.addEventListener("message",(function o(n){"done"===n.data.message&&(e.encoder.removeEventListener("message",o),t());})),e.encoder.start&&e.encoder.start(),e.encoder.postMessage({command:"done"});}))):Promise.resolve()},i.prototype.storePage=function(e){this.recordedPages.push(e),this.totalLength+=e.length;},i.prototype.streamPage=function(e){this.ondataavailable(e);},i.prototype.finish=function(){if(!this.config.streamPages){var e=new Uint8Array(this.totalLength);this.recordedPages.reduce((function(t,o){return e.set(o,t),t+o.length}),0),this.ondataavailable(e);}this.onstop();},i.prototype.ondataavailable=function(){},i.prototype.onpause=function(){},i.prototype.onresume=function(){},i.prototype.onstart=function(){},i.prototype.onstop=function(){},e.exports=i;}).call(this,o(1));},function(e,t){var o;o=function(){return this}();try{o=o||new Function("return this")();}catch(e){"object"==typeof window&&(o=window);}e.exports=o;}])}));
92543
- }(recorder_min));
92544
-
92545
- var Recorder = /*@__PURE__*/getDefaultExportFromCjs(recorder_min.exports);
92546
-
92568
+ // import RecordRTC from 'recordrtc';
92569
+ // import Recorder from 'opus-recorder'; // Using Recorder
92547
92570
  const dom$l = new Dom();
92548
92571
  class Dictation {
92549
92572
  constructor(opts = {}, builder) {
@@ -92731,6 +92754,9 @@ class Dictation {
92731
92754
  transform: rotate(450deg);
92732
92755
  }
92733
92756
  }
92757
+ .inp-command::placeholder {
92758
+ color: #aaa;
92759
+ }
92734
92760
  </style>
92735
92761
  <div class="is-overlay page-command-overlay">
92736
92762
  <svg class="spinner" width="40px" height="40px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
@@ -92983,11 +93009,11 @@ class Dictation {
92983
93009
  this.mediaRecorder.stop();
92984
93010
  this.localStream.getTracks().forEach(track => track.stop()); // Stop the tracks to release the resources
92985
93011
  }
92986
- } else {
92987
- // Using Recorder
92988
- if (this.recorder) this.recorder.stop();
92989
- if (this.localStream) this.localStream.getTracks().forEach(track => track.stop()); // Stop the tracks to release the resources
92990
- }
93012
+ } /* else {
93013
+ // Using Recorder
93014
+ if(this.recorder) this.recorder.stop();
93015
+ if(this.localStream) this.localStream.getTracks().forEach(track => track.stop()); // Stop the tracks to release the resources
93016
+ } */
92991
93017
 
92992
93018
  if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
92993
93019
  this.websocket.close();
@@ -93060,22 +93086,23 @@ class Dictation {
93060
93086
  }).catch(error => {
93061
93087
  console.log(error);
93062
93088
  });
93063
- } else {
93064
- // Using Recorder
93065
- this.recorder = new Recorder({
93066
- encoderPath: 'https://cdnjs.cloudflare.com/ajax/libs/opus-recorder/8.0.5/encoderWorker.min.js',
93067
- leaveStreamOpen: true,
93068
- numberOfChannels: 1,
93069
- // OPUS options
93070
- encoderSampleRate: sampleRate,
93071
- streamPages: true,
93072
- maxBuffersPerPage: 1
93073
- });
93074
- this.recorder.ondataavailable = e => {
93075
- if (this.aborted) return;
93076
- this.websocket.send(e.buffer);
93077
- };
93078
- }
93089
+ } /* else {
93090
+ // Using Recorder
93091
+ this.recorder = new Recorder({
93092
+ encoderPath: this.builder.encoderPath||
93093
+ 'https://cdnjs.cloudflare.com/ajax/libs/opus-recorder/8.0.5/encoderWorker.min.js',
93094
+ leaveStreamOpen: true,
93095
+ numberOfChannels: 1,
93096
+ // OPUS options
93097
+ encoderSampleRate: sampleRate,
93098
+ streamPages: true,
93099
+ maxBuffersPerPage: 1,
93100
+ });
93101
+ this.recorder.ondataavailable = (e) => {
93102
+ if(this.aborted) return;
93103
+ this.websocket.send(e.buffer);
93104
+ };
93105
+ } */
93079
93106
 
93080
93107
  /*
93081
93108
  // Using RecordRTC
@@ -93104,6 +93131,7 @@ class Dictation {
93104
93131
  }, 2000);
93105
93132
  }
93106
93133
  let finalTranscripts = '';
93134
+ let speechTimeout;
93107
93135
  this.websocket.onmessage = event => {
93108
93136
  const message = JSON.parse(event.data);
93109
93137
  if (message.event === 'can-open-mic') {
@@ -93111,22 +93139,30 @@ class Dictation {
93111
93139
 
93112
93140
  if (this.builder.useMediaRecorder) {
93113
93141
  this.mediaRecorder.start(1000); // Using mediaRecorder
93114
- } else {
93115
- this.recorder.start(); // Using Recorder
93116
- }
93142
+ } /* else {
93143
+ this.recorder.start(); // Using Recorder
93144
+ } */
93117
93145
 
93118
93146
  // console.log('Start Dictation');
93119
93147
  this.aborted = false;
93120
93148
  }
93121
93149
  if (message.event === 'transcript-result') {
93122
- const transcripts = message.data;
93123
93150
  if (this.builder.isInProgress || this.aborted) {
93124
93151
  return;
93125
93152
  }
93126
- finalTranscripts += ' ' + transcripts;
93153
+ const transcript = message.data.channel.alternatives[0].transcript;
93154
+ if (transcript && message.data.is_final) {
93155
+ finalTranscripts += ' ' + transcript;
93156
+ }
93157
+
93158
+ // Format
93159
+ finalTranscripts = finalTranscripts.charAt(0).toUpperCase() + finalTranscripts.slice(1);
93160
+ finalTranscripts = finalTranscripts.trim();
93127
93161
  inpCommand.value = finalTranscripts;
93128
- clearTimeout(this.speechTimeout);
93129
- this.speechTimeout = setTimeout(() => {
93162
+ clearTimeout(speechTimeout);
93163
+ console.log('Writing..');
93164
+ speechTimeout = setTimeout(() => {
93165
+ console.log('Clear');
93130
93166
  this.builder.commandText = '';
93131
93167
  finalTranscripts = '';
93132
93168
  if (this.builder.autoSendCommand) {
@@ -93227,72 +93263,51 @@ class Dictation {
93227
93263
  }
93228
93264
  }
93229
93265
 
93230
- var src = {
93231
- compareTwoStrings:compareTwoStrings,
93232
- findBestMatch:findBestMatch
93266
+ var stringSimilarity = {};
93267
+
93268
+ (function (exports) {
93269
+ Object.defineProperty(exports, "__esModule", { value: true });
93270
+ exports.stringSimilarity = void 0;
93271
+ /* global exports, Map */
93272
+ /**
93273
+ * Calculate similarity between two strings
93274
+ * @param {string} str1 First string to match
93275
+ * @param {string} str2 Second string to match
93276
+ * @param {number} [substringLength=2] Optional. Length of substring to be used in calculating similarity. Default 2.
93277
+ * @param {boolean} [caseSensitive=false] Optional. Whether you want to consider case in string matching. Default false;
93278
+ * @returns Number between 0 and 1, with 0 being a low match score.
93279
+ */
93280
+ var stringSimilarity = function (str1, str2, substringLength, caseSensitive) {
93281
+ if (substringLength === void 0) { substringLength = 2; }
93282
+ if (caseSensitive === void 0) { caseSensitive = false; }
93283
+ if (!caseSensitive) {
93284
+ str1 = str1.toLowerCase();
93285
+ str2 = str2.toLowerCase();
93286
+ }
93287
+ if (str1.length < substringLength || str2.length < substringLength)
93288
+ return 0;
93289
+ var map = new Map();
93290
+ for (var i = 0; i < str1.length - (substringLength - 1); i++) {
93291
+ var substr1 = str1.substr(i, substringLength);
93292
+ map.set(substr1, map.has(substr1) ? map.get(substr1) + 1 : 1);
93293
+ }
93294
+ var match = 0;
93295
+ for (var j = 0; j < str2.length - (substringLength - 1); j++) {
93296
+ var substr2 = str2.substr(j, substringLength);
93297
+ var count = map.has(substr2) ? map.get(substr2) : 0;
93298
+ if (count > 0) {
93299
+ map.set(substr2, count - 1);
93300
+ match++;
93301
+ }
93302
+ }
93303
+ return (match * 2) / (str1.length + str2.length - ((substringLength - 1) * 2));
93233
93304
  };
93305
+ exports.stringSimilarity = stringSimilarity;
93306
+ exports.default = exports.stringSimilarity;
93234
93307
 
93235
- function compareTwoStrings(first, second) {
93236
- first = first.replace(/\s+/g, '');
93237
- second = second.replace(/\s+/g, '');
93238
-
93239
- if (first === second) return 1; // identical or empty
93240
- if (first.length < 2 || second.length < 2) return 0; // if either is a 0-letter or 1-letter string
93241
-
93242
- let firstBigrams = new Map();
93243
- for (let i = 0; i < first.length - 1; i++) {
93244
- const bigram = first.substring(i, i + 2);
93245
- const count = firstBigrams.has(bigram)
93246
- ? firstBigrams.get(bigram) + 1
93247
- : 1;
93248
-
93249
- firstBigrams.set(bigram, count);
93250
- }
93251
- let intersectionSize = 0;
93252
- for (let i = 0; i < second.length - 1; i++) {
93253
- const bigram = second.substring(i, i + 2);
93254
- const count = firstBigrams.has(bigram)
93255
- ? firstBigrams.get(bigram)
93256
- : 0;
93257
-
93258
- if (count > 0) {
93259
- firstBigrams.set(bigram, count - 1);
93260
- intersectionSize++;
93261
- }
93262
- }
93263
-
93264
- return (2.0 * intersectionSize) / (first.length + second.length - 2);
93265
- }
93266
-
93267
- function findBestMatch(mainString, targetStrings) {
93268
- if (!areArgsValid(mainString, targetStrings)) throw new Error('Bad arguments: First argument should be a string, second should be an array of strings');
93269
-
93270
- const ratings = [];
93271
- let bestMatchIndex = 0;
93272
-
93273
- for (let i = 0; i < targetStrings.length; i++) {
93274
- const currentTargetString = targetStrings[i];
93275
- const currentRating = compareTwoStrings(mainString, currentTargetString);
93276
- ratings.push({target: currentTargetString, rating: currentRating});
93277
- if (currentRating > ratings[bestMatchIndex].rating) {
93278
- bestMatchIndex = i;
93279
- }
93280
- }
93281
-
93282
-
93283
- const bestMatch = ratings[bestMatchIndex];
93284
-
93285
- return { ratings: ratings, bestMatch: bestMatch, bestMatchIndex: bestMatchIndex };
93286
- }
93287
-
93288
- function areArgsValid(mainString, targetStrings) {
93289
- if (typeof mainString !== 'string') return false;
93290
- if (!Array.isArray(targetStrings)) return false;
93291
- if (!targetStrings.length) return false;
93292
- if (targetStrings.find( function (s) { return typeof s !== 'string'})) return false;
93293
- return true;
93294
- }
93308
+ }(stringSimilarity));
93295
93309
 
93310
+ // import stringSimilarity from 'string-similarity';
93296
93311
  class Similarity {
93297
93312
  constructor(builder) {
93298
93313
  this.builder = builder;
@@ -93322,7 +93337,7 @@ class Similarity {
93322
93337
  const normalizedCommand = command.toLowerCase();
93323
93338
  let maxSimilarity = 0;
93324
93339
  for (const cmd of list) {
93325
- const similarity = src.compareTwoStrings(normalizedCommand, cmd);
93340
+ const similarity = stringSimilarity.stringSimilarity(normalizedCommand, cmd);
93326
93341
  if (similarity > maxSimilarity) {
93327
93342
  // console.log(list)
93328
93343
  // console.log(similarity)
@@ -93947,16 +93962,18 @@ class ContentBuilder {
93947
93962
  enableDragResize: true,
93948
93963
  simpleTextSettings: false,
93949
93964
  enableColumnsPerLine: true,
93950
- /* Prompt/Command Stuff */
93965
+ /* Prompt/Command Stuff for AI Assistant */
93951
93966
  isContentBox: false,
93952
93967
  sendCommandUrl: 'http://localhost:8081/answer',
93953
93968
  // speechTranscribeUrl: 'http://192.168.1.7:8081',
93954
93969
  onlineDemo: false,
93955
- autoSendDelay: 3000,
93970
+ autoSendDelay: 4000,
93956
93971
  commandPlaceholderText: '',
93957
93972
  enableShortCommands: true,
93958
93973
  speechRecognitionLang: 'en-US',
93959
- useMediaRecorder: false,
93974
+ useMediaRecorder: true,
93975
+ // do not change
93976
+ encoderPath: '',
93960
93977
  headlineList: ['We create simple and effective designs.', 'Ultimate Experiences With Story, Emotion, And Purpose.', 'Build Anything Beautifully', 'With Less Stuff and More Compassion', '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.', 'Creative and Inspiring'],
93961
93978
  shortCommandList: {
93962
93979
  undo: ['undo'],
@@ -107136,7 +107153,6 @@ Example result:
107136
107153
  `,
107137
107154
  redesign_layout2: [`To redesign the provided section:
107138
107155
  - Decide the best placement of each content element (title, paragraph, images, etc) and change the position based on the template below.
107139
- - You must update the title class with 'leading-09 size-116 font-extrabold'.
107140
107156
 
107141
107157
  This is the template:
107142
107158
 
@@ -107148,7 +107164,7 @@ This is the template:
107148
107164
  <div class="spacer height-60"></div>
107149
107165
  </div>
107150
107166
  <div class="column" style="width: 60%; flex: 0 0 auto;">
107151
- <h1 class="leading-09 size-116 font-extrabold">{{Place title here}}</h1>
107167
+ <h1 class="leading-09 size-116 font-extrabold">{{TITLE}}</h1>
107152
107168
  </div>
107153
107169
  </div>
107154
107170
  <div class="row">
@@ -107180,8 +107196,6 @@ This is the template:
107180
107196
  </div>
107181
107197
  </div>
107182
107198
 
107183
- Important: include all images from the original section in the returned result!
107184
-
107185
107199
  `, `To redesign the provided section:
107186
107200
  - Decide the best placement of each content element (title, paragraph, images, etc) and change the position based on the template below.
107187
107201
  - You must update the title class with 'tracking-tight leading-09 size-120 font-normal'.
@@ -109745,6 +109759,19 @@ class Command {
109745
109759
  }
109746
109760
 
109747
109761
  this.builder.editor.lib.updateBackgroundImage(activeBox, chosenImage);
109762
+
109763
+ if (activeBox.classList.contains('is-section')) {
109764
+ const overlay = activeBox.querySelector('div.is-overlay');
109765
+
109766
+ if (overlay && overlay.querySelector('.is-overlay-bg')) {
109767
+ let box = overlay.closest('.is-box');
109768
+ if (box) if (box.querySelector('.is-container')) {
109769
+ box.classList.add('m-overlay-stack');
109770
+ box.classList.add('m-dark-text');
109771
+ }
109772
+ }
109773
+ }
109774
+
109748
109775
  this.builder.settings.onChange();
109749
109776
  this.dictation.finish();
109750
109777
  return false;
@@ -109978,11 +110005,7 @@ class Command {
109978
110005
  question = `Add a new section containing your response on this user request: ${question}`;
109979
110006
  } else if (args.new_section || args.new_section_two_boxes || args.new_section_three_boxes || args.new_section_four_boxes) {
109980
110007
  if (args.new_section === 'new-section' || args.new_section === 'new-section-2-columns' || args.new_section === 'new-section-3-columns' || args.new_section === 'new-section-3-columns' || args.new_section === 'new-section-4-columns') {
109981
- if (args.section_background && args.section_background === 'image') {
109982
- context = this.chooseContext(cl.new_section);
109983
- } else if ((args.add_headline || args.add_paragraph) && args.add_image === 'image') {
109984
- context = cl.new_section_with_image;
109985
- } else if (args.add_image === 'gallery') {
110008
+ if (args.add_image === 'gallery') {
109986
110009
  context = cl.new_section_with_gallery;
109987
110010
  } else if (args.add_list_with_image) {
109988
110011
  context = cl.new_section_with_list_images;
@@ -109996,6 +110019,10 @@ class Command {
109996
110019
  context = this.chooseContext(cl.new_section_article_with_image);
109997
110020
  } else if (args.add_article) {
109998
110021
  context = this.chooseContext(cl.new_section_article);
110022
+ } else if (args.section_background && args.section_background === 'image') {
110023
+ context = this.chooseContext(cl.new_section);
110024
+ } else if ((args.add_headline || args.add_paragraph) && args.add_image === 'image') {
110025
+ context = cl.new_section_with_image;
109999
110026
  } else {
110000
110027
  context = cl.new_section_others;
110001
110028
  }
@@ -110190,6 +110217,11 @@ ${currentHtml}
110190
110217
 
110191
110218
  if (args.section_background && args.section_background === 'video') {
110192
110219
  html = this.setBgVideo(html);
110220
+ } // Apply bg stack
110221
+
110222
+
110223
+ if (args.section_background && args.section_background === 'image') {
110224
+ html = this.applyBgStack(html);
110193
110225
  } // Render
110194
110226
 
110195
110227
 
@@ -110210,9 +110242,11 @@ ${currentHtml}
110210
110242
 
110211
110243
  if (args.section_background && args.section_background === 'video') {
110212
110244
  html = this.setBgVideo(html);
110213
- } // Render
110245
+ } // Apply bg stack
110214
110246
 
110215
110247
 
110248
+ html = this.applyBgStack(html); // Render
110249
+
110216
110250
  this.renderResult_NewSection(html);
110217
110251
  }
110218
110252
 
@@ -110452,7 +110486,9 @@ ${currentHtml}`;
110452
110486
  } else {
110453
110487
  context = this.chooseContext(cl.change_layout_of_box, val);
110454
110488
  }
110455
- }
110489
+ } // Experiment
110490
+ // context = cl.redesign_layout2[0];
110491
+
110456
110492
 
110457
110493
  if (useSavedSection) {
110458
110494
  let con = this.lib.getPreviousSectionStyleContext();
@@ -110462,7 +110498,15 @@ ${currentHtml}`;
110462
110498
  } else {
110463
110499
  context = con.boxContext;
110464
110500
  }
110465
- }
110501
+ } // get content width
110502
+ // let contentWidth = '';
110503
+ // const container = activeBox.querySelector('.is-container');
110504
+ // if(container) container.classList.forEach(item=>{
110505
+ // if(item.indexOf('is-content-')!==-1 && item !=='is-content-left' && item !== 'is-content-right') {
110506
+ // contentWidth=item;
110507
+ // }
110508
+ // });
110509
+
110466
110510
 
110467
110511
  if (this.builder.consoleLog) console.log(context); // get typo class.
110468
110512
 
@@ -110497,7 +110541,9 @@ ${currentHtml}`;
110497
110541
  console.log('Unable to proceed. Error: mergeContent.');
110498
110542
  this.dictation.finish(true);
110499
110543
  return;
110500
- }
110544
+ } // mergedHtml = this.applyBgStack(mergedHtml);
110545
+ // this.renderResult(mergedHtml, typeClass, contentWidth); // To apply original content width
110546
+
110501
110547
 
110502
110548
  this.renderResult(mergedHtml, typeClass);
110503
110549
  this.dictation.finish(); // Must be called after finished
@@ -110639,8 +110685,7 @@ ${currentHtml}`;
110639
110685
 
110640
110686
 
110641
110687
  const adjustIntentForContentAlignment = (intent, question) => {
110642
- if (intent === 'move_content_left' || intent === 'move_content_center' || intent === 'move_content_right' || intent === 'move_content_top' || intent === 'move_content_middle' || intent === 'move_content_bottom' || intent === 'make_content_center' || // This
110643
- intent === 'align_content_top_left' || intent === 'align_content_top_center' || intent === 'align_content_top_right' || intent === 'align_content_middle_left' || intent === 'align_content_middle_center' || intent === 'align_content_middle_right' || intent === 'align_content_bottom_left' || intent === 'align_content_bottom_center' || intent === 'align_content_bottom_right') {
110688
+ if (intent === 'move_content_left' || intent === 'move_content_center' || intent === 'move_content_right' || intent === 'move_content_top' || intent === 'move_content_bottom' || intent === 'align_content_top_left' || intent === 'align_content_top_right' || intent === 'align_content_bottom_left' || intent === 'align_content_bottom_right') {
110644
110689
  let direct = false;
110645
110690
 
110646
110691
  if (question.indexOf('top left') !== -1 || question.indexOf('left top') !== -1 || question.indexOf('top center') !== -1 || question.indexOf('center top') !== -1 || question.indexOf('top right') !== -1 || question.indexOf('right top') !== -1 || question.indexOf('middle left') !== -1 || question.indexOf('left middle') !== -1 || question.indexOf('middle center') !== -1 || question.indexOf('center middle') !== -1 || question.indexOf('middle right') !== -1 || question.indexOf('right middle') !== -1 || question.indexOf('bottom left') !== -1 || question.indexOf('left bottom') !== -1 || question.indexOf('bottom center') !== -1 || question.indexOf('center bottom') !== -1 || question.indexOf('bottom right') !== -1 || question.indexOf('right bottom') !== -1) {
@@ -110650,14 +110695,12 @@ ${currentHtml}`;
110650
110695
  if (!direct) {
110651
110696
  if (question.indexOf('top') !== -1) {
110652
110697
  intent = 'move_content_top';
110653
- } else if (question.indexOf('middle') !== -1) {
110654
- intent = 'move_content_middle';
110655
110698
  } else if (question.indexOf('bottom') !== -1) {
110656
110699
  intent = 'move_content_bottom';
110657
110700
  } else if (question.indexOf('left') !== -1) {
110658
110701
  intent = 'move_content_left';
110659
110702
  } else if (question.indexOf('center') !== -1) {
110660
- if (intent === 'make_content_center') ;else intent = 'move_content_center';
110703
+ intent = 'move_content_center';
110661
110704
  } else if (question.indexOf('right') !== -1) {
110662
110705
  intent = 'move_content_right';
110663
110706
  }
@@ -110686,31 +110729,16 @@ ${currentHtml}`;
110686
110729
  this.builder.animateScroll.applyPresetBasic('is-fadeIn', 100);
110687
110730
  this.builder.settings.onChange();
110688
110731
  return false;
110689
- } else if (intent == 'fade_in_slow') {
110690
- this.builder.editor.saveForUndo();
110691
- this.builder.animateScroll.applyPresetBasic('is-fadeIn', 300);
110692
- this.builder.settings.onChange();
110693
- return false;
110694
110732
  } else if (intent == 'fade_in_up') {
110695
110733
  this.builder.editor.saveForUndo();
110696
110734
  this.builder.animateScroll.applyPresetBasic('is-fadeInUp', 100);
110697
110735
  this.builder.settings.onChange();
110698
110736
  return false;
110699
- } else if (intent == 'fade_in_up_slow') {
110700
- this.builder.editor.saveForUndo();
110701
- this.builder.animateScroll.applyPresetBasic('is-fadeInUp', 300);
110702
- this.builder.settings.onChange();
110703
- return false;
110704
110737
  } else if (intent == 'slide_up') {
110705
110738
  this.builder.editor.saveForUndo();
110706
110739
  this.builder.animateScroll.applyPresetBasic('is-slideInUp', 100);
110707
110740
  this.builder.settings.onChange();
110708
110741
  return false;
110709
- } else if (intent == 'slide_up_slow') {
110710
- this.builder.editor.saveForUndo();
110711
- this.builder.animateScroll.applyPresetBasic('is-slideInUp', 300);
110712
- this.builder.settings.onChange();
110713
- return false;
110714
110742
  } else if (intent == 'zoom_in') {
110715
110743
  this.builder.editor.saveForUndo();
110716
110744
  this.builder.animateScroll.applyPresetBasic('is-zoomIn', 300);
@@ -110880,6 +110908,19 @@ ${currentHtml}`;
110880
110908
 
110881
110909
  let chosenImage = this.chooseBgImage(activeBox);
110882
110910
  this.builder.editor.lib.updateBackgroundImage(activeBox, chosenImage);
110911
+
110912
+ if (activeBox.classList.contains('is-section')) {
110913
+ const overlay = activeBox.querySelector('div.is-overlay');
110914
+
110915
+ if (overlay && overlay.querySelector('.is-overlay-bg')) {
110916
+ let box = overlay.closest('.is-box');
110917
+ if (box) if (box.querySelector('.is-container')) {
110918
+ box.classList.add('m-overlay-stack');
110919
+ box.classList.add('m-dark-text');
110920
+ }
110921
+ }
110922
+ }
110923
+
110883
110924
  this.builder.settings.onChange();
110884
110925
  return false;
110885
110926
  } else if (intent === 'change_bg_image') {
@@ -110898,6 +110939,19 @@ ${currentHtml}`;
110898
110939
  }
110899
110940
 
110900
110941
  this.builder.editor.lib.updateBackgroundImage(activeBox, chosenImage);
110942
+
110943
+ if (activeBox.classList.contains('is-section')) {
110944
+ const overlay = activeBox.querySelector('div.is-overlay');
110945
+
110946
+ if (overlay && overlay.querySelector('.is-overlay-bg')) {
110947
+ let box = overlay.closest('.is-box');
110948
+ if (box) if (box.querySelector('.is-container')) {
110949
+ box.classList.add('m-overlay-stack');
110950
+ box.classList.add('m-dark-text');
110951
+ }
110952
+ }
110953
+ }
110954
+
110901
110955
  this.builder.settings.onChange();
110902
110956
  return false;
110903
110957
  } else if (intent === 'remove_bg_color') {
@@ -111294,132 +111348,61 @@ ${currentHtml}`;
111294
111348
 
111295
111349
  this.builder.settings.onChange();
111296
111350
  return false;
111297
- }
111298
- /*else if(intent==='move_content_left') {
111299
-
111300
- this.builder.editor.saveForUndo();
111301
- this.builder.editor.lib.moveContent(activeBox, 'left');
111302
- this.builder.settings.onChange();
111303
- return false;
111304
-
111305
- } else if(intent==='move_content_center') {
111306
-
111307
- this.builder.editor.saveForUndo();
111308
- this.builder.editor.lib.moveContent(activeBox, 'center');
111309
- // this.builder.editor.lib.moveContent(activeBox, 'middle');
111310
- this.builder.settings.onChange();
111311
- return false;
111312
-
111313
- } else if(intent==='move_content_right') {
111314
-
111315
- this.builder.editor.saveForUndo();
111316
- this.builder.editor.lib.moveContent(activeBox, 'right');
111317
- this.builder.settings.onChange();
111318
- return false;
111319
-
111320
- } else if(intent==='move_content_top') {
111321
-
111322
- this.builder.editor.saveForUndo();
111323
- this.builder.editor.lib.moveContent(activeBox, 'top');
111324
- this.builder.settings.onChange();
111325
- return false;
111326
-
111327
- } else if(intent==='move_content_middle') {
111328
-
111329
- this.builder.editor.saveForUndo();
111330
- this.builder.editor.lib.moveContent(activeBox, 'middle');
111331
- this.builder.settings.onChange();
111332
- return false;
111333
-
111334
- } else if(intent==='move_content_bottom') {
111335
-
111351
+ } else if (intent === 'move_content_left') {
111336
111352
  this.builder.editor.saveForUndo();
111337
- this.builder.editor.lib.moveContent(activeBox, 'bottom');
111338
- this.builder.settings.onChange();
111353
+ this.builder.editor.lib.moveContent(activeBox, 'left');
111354
+ this.builder.editor.lib.moveContent(activeBox, 'middle');
111355
+ this.builder.settings.onChange();
111339
111356
  return false;
111340
-
111341
- } else if(intent==='make_content_center') { // This
111342
-
111357
+ } else if (intent === 'move_content_center') {
111343
111358
  this.builder.editor.saveForUndo();
111344
- this.builder.editor.lib.moveContent(activeBox, 'center');
111359
+ this.builder.editor.lib.moveContent(activeBox, 'center');
111345
111360
  this.builder.editor.lib.moveContent(activeBox, 'middle');
111346
- this.builder.settings.onChange();
111361
+ this.builder.settings.onChange();
111347
111362
  return false;
111348
-
111349
- } else if(intent==='align_content_top_left') {
111350
-
111363
+ } else if (intent === 'move_content_right') {
111351
111364
  this.builder.editor.saveForUndo();
111352
- this.builder.editor.lib.moveContent(activeBox, 'top');
111353
- this.builder.editor.lib.moveContent(activeBox, 'left');
111354
- this.builder.settings.onChange();
111365
+ this.builder.editor.lib.moveContent(activeBox, 'right');
111366
+ this.builder.editor.lib.moveContent(activeBox, 'middle');
111367
+ this.builder.settings.onChange();
111355
111368
  return false;
111356
-
111357
- } else if(intent==='align_content_top_center') {
111358
-
111369
+ } else if (intent === 'move_content_top') {
111359
111370
  this.builder.editor.saveForUndo();
111360
- this.builder.editor.lib.moveContent(activeBox, 'top');
111361
111371
  this.builder.editor.lib.moveContent(activeBox, 'center');
111362
- this.builder.settings.onChange();
111372
+ this.builder.editor.lib.moveContent(activeBox, 'top');
111373
+ this.builder.settings.onChange();
111363
111374
  return false;
111364
-
111365
- } else if(intent==='align_content_top_right') {
111366
-
111375
+ } else if (intent === 'move_content_bottom') {
111367
111376
  this.builder.editor.saveForUndo();
111368
- this.builder.editor.lib.moveContent(activeBox, 'top');
111369
- this.builder.editor.lib.moveContent(activeBox, 'right');
111370
- this.builder.settings.onChange();
111377
+ this.builder.editor.lib.moveContent(activeBox, 'center');
111378
+ this.builder.editor.lib.moveContent(activeBox, 'bottom');
111379
+ this.builder.settings.onChange();
111371
111380
  return false;
111372
-
111373
- } else if(intent==='align_content_middle_left') {
111374
-
111381
+ } else if (intent === 'align_content_top_left') {
111375
111382
  this.builder.editor.saveForUndo();
111376
- this.builder.editor.lib.moveContent(activeBox, 'middle');
111383
+ this.builder.editor.lib.moveContent(activeBox, 'top');
111377
111384
  this.builder.editor.lib.moveContent(activeBox, 'left');
111378
- this.builder.settings.onChange();
111379
- return false;
111380
-
111381
- } else if(intent==='align_content_middle_center') {
111382
-
111383
- this.builder.editor.saveForUndo();
111384
- this.builder.editor.lib.moveContent(activeBox, 'middle');
111385
- this.builder.editor.lib.moveContent(activeBox, 'center');
111386
- this.builder.settings.onChange();
111385
+ this.builder.settings.onChange();
111387
111386
  return false;
111388
-
111389
- } else if(intent==='align_content_middle_right') {
111390
-
111387
+ } else if (intent === 'align_content_top_right') {
111391
111388
  this.builder.editor.saveForUndo();
111392
- this.builder.editor.lib.moveContent(activeBox, 'middle');
111389
+ this.builder.editor.lib.moveContent(activeBox, 'top');
111393
111390
  this.builder.editor.lib.moveContent(activeBox, 'right');
111394
- this.builder.settings.onChange();
111391
+ this.builder.settings.onChange();
111395
111392
  return false;
111396
-
111397
- } else if(intent==='align_content_bottom_left') {
111398
-
111393
+ } else if (intent === 'align_content_bottom_left') {
111399
111394
  this.builder.editor.saveForUndo();
111400
- this.builder.editor.lib.moveContent(activeBox, 'bottom');
111395
+ this.builder.editor.lib.moveContent(activeBox, 'bottom');
111401
111396
  this.builder.editor.lib.moveContent(activeBox, 'left');
111402
- this.builder.settings.onChange();
111403
- return false;
111404
-
111405
- } else if(intent==='align_content_bottom_center') {
111406
-
111407
- this.builder.editor.saveForUndo();
111408
- this.builder.editor.lib.moveContent(activeBox, 'bottom');
111409
- this.builder.editor.lib.moveContent(activeBox, 'center');
111410
- this.builder.settings.onChange();
111397
+ this.builder.settings.onChange();
111411
111398
  return false;
111412
-
111413
- } else if(intent==='align_content_bottom_right') {
111414
-
111399
+ } else if (intent === 'align_content_bottom_right') {
111415
111400
  this.builder.editor.saveForUndo();
111416
- this.builder.editor.lib.moveContent(activeBox, 'bottom');
111401
+ this.builder.editor.lib.moveContent(activeBox, 'bottom');
111417
111402
  this.builder.editor.lib.moveContent(activeBox, 'right');
111418
- this.builder.settings.onChange();
111403
+ this.builder.settings.onChange();
111419
111404
  return false;
111420
-
111421
- } */
111422
- else if (intent === 'increase_space') {
111405
+ } else if (intent === 'increase_space') {
111423
111406
  let elm = this.builder.editor.activeElement;
111424
111407
 
111425
111408
  if (elm) {
@@ -111867,6 +111850,22 @@ ${currentHtml}`;
111867
111850
  return doc.documentElement.innerHTML;
111868
111851
  }
111869
111852
 
111853
+ applyBgStack(html) {
111854
+ const parser = new DOMParser();
111855
+ let doc = parser.parseFromString(html, 'text/html');
111856
+ const overlay = doc.querySelector('div.is-overlay');
111857
+
111858
+ if (overlay && overlay.querySelector('.is-overlay-bg')) {
111859
+ let box = overlay.closest('.is-box');
111860
+ if (box) if (box.querySelector('.is-container')) {
111861
+ box.classList.add('m-overlay-stack');
111862
+ box.classList.add('m-dark-text');
111863
+ }
111864
+ }
111865
+
111866
+ return doc.documentElement.innerHTML;
111867
+ }
111868
+
111870
111869
  fixCommon(html) {
111871
111870
  html = html.replaceAll('{{CONTENT}}', '');
111872
111871
  const parser = new DOMParser();
@@ -111893,6 +111892,34 @@ ${currentHtml}`;
111893
111892
  col.style.width = '';
111894
111893
  col.style.flex = '';
111895
111894
  }
111895
+ }); // Fix grid (width)
111896
+
111897
+ const rows = container.querySelectorAll('.row');
111898
+ rows.forEach(row => {
111899
+ let totalWidth = 0;
111900
+ let hasAutoWidthCol = false;
111901
+ let lastCol;
111902
+ const cols = row.querySelectorAll('.column');
111903
+ cols.forEach(col => {
111904
+ if (col.style.width && col.style.width.includes('%')) {
111905
+ totalWidth += parseFloat(col.style.width);
111906
+ } else {
111907
+ hasAutoWidthCol = true;
111908
+ }
111909
+
111910
+ lastCol = col;
111911
+ });
111912
+
111913
+ if (totalWidth > 100) {
111914
+ console.log('FIX: clear width. Total: ' + totalWidth);
111915
+ cols.forEach(col => {
111916
+ col.style.width = '';
111917
+ col.style.flex = '';
111918
+ });
111919
+ } else if (totalWidth < 100 && !hasAutoWidthCol) {
111920
+ console.log('FIX: add col. Total: ' + totalWidth);
111921
+ if (lastCol) lastCol.insertAdjacentHTML('afterend', '<div class="column"><div class="spacer height-60"></div></div>');
111922
+ }
111896
111923
  }); // Replace element style with class
111897
111924
 
111898
111925
  const elements = doc.querySelectorAll('*');
@@ -111988,17 +112015,6 @@ ${currentHtml}`;
111988
112015
 
111989
112016
  doc = parser.parseFromString(docBox.body.innerHTML, 'text/html');
111990
112017
  }
111991
- } // Apply bg stacking
111992
-
111993
-
111994
- const overlay = doc.querySelector('div.is-overlay');
111995
-
111996
- if (overlay && overlay.querySelector('.is-overlay-bg')) {
111997
- let box = overlay.closest('.is-box');
111998
- if (box) if (box.querySelector('.is-container')) {
111999
- box.classList.add('m-overlay-stack');
112000
- box.classList.add('m-dark-text');
112001
- }
112002
112018
  }
112003
112019
 
112004
112020
  if (container) {
@@ -112374,7 +112390,7 @@ ${currentHtml}`;
112374
112390
  this.dictation.finish(); // Must be called after finished
112375
112391
  }
112376
112392
 
112377
- renderResult(html, typeClass) {
112393
+ renderResult(html, typeClass, contentWidth) {
112378
112394
  const activeBox = this.builder.activeBox;
112379
112395
  const activeSection = this.builder.activeSection;
112380
112396
  let sectionBox = false;
@@ -112387,7 +112403,7 @@ ${currentHtml}`;
112387
112403
 
112388
112404
  if (sectionBox) {
112389
112405
  // section
112390
- // Replace class
112406
+ // Replace type class
112391
112407
  const parser = new DOMParser();
112392
112408
  const htmlDocument = parser.parseFromString(html, 'text/html');
112393
112409
 
@@ -112398,6 +112414,21 @@ ${currentHtml}`;
112398
112414
  section.classList.remove(...Array.from(section.classList).filter(className => className.startsWith('type-')));
112399
112415
  section.classList.add(typeClass);
112400
112416
  }
112417
+ } // Replace content width
112418
+
112419
+
112420
+ if (contentWidth) {
112421
+ const container = htmlDocument.querySelector('.is-container');
112422
+
112423
+ if (container) {
112424
+ container.classList.forEach(item => {
112425
+ if (item.indexOf('is-content-') !== -1 && item !== 'is-content-left' && item !== 'is-content-right') {
112426
+ container.classList.remove(item);
112427
+ container.classList.add(contentWidth);
112428
+ }
112429
+ });
112430
+ container.classList.add(contentWidth);
112431
+ }
112401
112432
  }
112402
112433
 
112403
112434
  html = htmlDocument.body.innerHTML; // const typeClass = this.lib.getTypographyClass(html);
@@ -112432,6 +112463,7 @@ ${currentHtml}`;
112432
112463
  const replacementElement = tempContainer.firstChild; // replacementElement.setAttribute('class', savedClasses);
112433
112464
 
112434
112465
  if (savedClass) replacementElement.classList.add(savedClass); // const typeClass = this.lib.getTypographyClass(html);
112466
+ // Replace type class
112435
112467
 
112436
112468
  if (typeClass) {
112437
112469
  const section = htmlDocument.querySelector('div.is-section');
@@ -112440,6 +112472,20 @@ ${currentHtml}`;
112440
112472
  section.classList.remove(...Array.from(section.classList).filter(className => className.startsWith('type-')));
112441
112473
  section.classList.add(typeClass);
112442
112474
  }
112475
+ } // Replace content width
112476
+
112477
+
112478
+ if (contentWidth) {
112479
+ const container = replacementElement.querySelector('.is-container');
112480
+
112481
+ if (container) {
112482
+ container.classList.forEach(item => {
112483
+ if (item.indexOf('is-content-') !== -1 && item !== 'is-content-left' && item !== 'is-content-right') {
112484
+ container.classList.remove(item);
112485
+ }
112486
+ });
112487
+ container.classList.add(contentWidth);
112488
+ }
112443
112489
  } // Replace
112444
112490
 
112445
112491
 
@@ -115126,14 +115172,16 @@ class ContentBox {
115126
115172
  // http://localhost:8081/answer
115127
115173
  speechTranscribeUrl: '',
115128
115174
  // http://localhost:8081
115129
- autoSendDelay: 3000,
115175
+ autoSendDelay: 4000,
115130
115176
  onlineDemo: false,
115131
115177
  startAIAssistant: false,
115132
115178
  temperature: 0.6,
115133
115179
  //0.4,
115134
115180
  topP: 0.9,
115135
115181
  //0.6,
115136
- useMediaRecorder: false,
115182
+ useMediaRecorder: true,
115183
+ // do not change
115184
+ encoderPath: '',
115137
115185
  commandPlaceholderText: 'Create a section containing a short article with ideas for outdoor activities.',
115138
115186
  disclaimerAI: `The feature you're about to use utilizes AI in some of its processes.
115139
115187
  It's important to understand that AI systems have limitations.
@@ -115145,7 +115193,7 @@ class ContentBox {
115145
115193
  speechRecognitionLang: 'en-US',
115146
115194
  similarityThreshold: 0.65,
115147
115195
  // for commandList similarity checking
115148
- 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.'],
115196
+ headlineList: ['We\'re [CompanyName]. Full stack development with a spark of creativity.'],
115149
115197
  mediaPath: 'assets/gallery/',
115150
115198
  media: {
115151
115199
  slider: ['slide-01.jpg', 'slide-02.jpg'],
@@ -115217,11 +115265,8 @@ class ContentBox {
115217
115265
  select_image: ['select image'],
115218
115266
  change_font: ['change font', 'change typography', 'change style'],
115219
115267
  fade_in: ['fade in'],
115220
- fade_in_slow: ['fade in slow'],
115221
115268
  fade_in_up: ['fade in up'],
115222
- fade_in_up_slow: ['fade in up slow'],
115223
115269
  slide_up: ['slide up'],
115224
- slide_up_slow: ['slide up slow'],
115225
115270
  zoom_in: ['zoom in'],
115226
115271
  zoom_out: ['zoom out'],
115227
115272
  animate_once: ['animate once'],
@@ -115290,22 +115335,14 @@ class ContentBox {
115290
115335
  align_right: ['align right', 'align text right', 'right aligned'],
115291
115336
  align_full: ['align full', 'align justify', 'justify', 'justify text', 'justify full'],
115292
115337
  clear_alignment: ['clear alignment', 'remove alignment', 'clear text alignment', 'remove text alignment'],
115293
- make_content_center: ['make content center'],
115294
- // middle center
115295
115338
  move_content_left: ['move content left', 'align content left'],
115296
115339
  move_content_center: ['move content center', 'align content center'],
115297
115340
  move_content_right: ['move content right', 'align content right'],
115298
115341
  move_content_top: ['move content top', 'align content top'],
115299
- move_content_middle: ['move content middle', 'align content middle'],
115300
115342
  move_content_bottom: ['move content bottom', 'align content bottom'],
115301
115343
  align_content_top_left: ['move content top left', 'align content top left'],
115302
- align_content_top_center: ['move content top center', 'align content top center'],
115303
115344
  align_content_top_right: ['move content top right', 'align content top right'],
115304
- align_content_middle_left: ['move content middle left', 'align content middle left'],
115305
- align_content_middle_center: ['move content middle center', 'align content middle center'],
115306
- align_content_middle_right: ['move content middle right', 'align content middle right'],
115307
115345
  align_content_bottom_left: ['move content bottom left', 'align content bottom left'],
115308
- align_content_bottom_center: ['move content bottom center', 'align content bottom center'],
115309
115346
  align_content_bottom_right: ['move content bottom right', 'align content bottom right'],
115310
115347
  increase_space: ['more space', 'increase space', 'enlarge space'],
115311
115348
  decrease_space: ['less space', 'decrease space', 'reduce space'],
@@ -115358,7 +115395,7 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
115358
115395
 
115359
115396
  },
115360
115397
  selection: {
115361
- title: 'Selection',
115398
+ title: 'Selection & Layout',
115362
115399
  list: ['Select the headline', // 'Select the paragraph',
115363
115400
  // 'Select the button',
115364
115401
  // 'Select the space',
@@ -115379,7 +115416,7 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
115379
115416
  list: [// 'Set the background color to light green',
115380
115417
  // 'Change the background color to light yellow',
115381
115418
  'Add a background image', 'Change the background image', 'Add a background slider', 'Add a background video', 'Clear background', // 'Adjust the section height to 50%',
115382
- 'Adjust the section height to 70%', 'Adjust the section height to 100%', 'Set the section height to auto']
115419
+ 'Adjust the section height to 70%', 'Change the section height to 100%', 'Set the section height to auto']
115383
115420
  },
115384
115421
  typography: {
115385
115422
  title: 'Typography',
@@ -115389,21 +115426,25 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
115389
115426
  title: 'Content',
115390
115427
  list: ['Set the content color to white', 'Set the content color to black', 'Increase the width of the content', 'Reduce the width of the content', 'Increase the default font size', // 'Decrease the default font size',
115391
115428
  'Increase the default line height', // 'Decrease the default line height',
115392
- 'Clear the content', 'Add new content', // 'Add text',
115429
+ 'Clear the content', 'Add new content', // 'Align the content to the center',
115430
+ // 'Align the content to the left',
115393
115431
  // 'Align the content to the center',
115394
- 'Align the content to the left', // 'Align the content to the center',
115395
115432
  // 'Align the content to the right',
115396
- 'Align the content to the top', 'Align the content to the middle', // 'Align the content to the bottom',
115397
- 'Make the content centered']
115433
+ // 'Align the content to the top',
115434
+ // 'Align the content to the middle',
115435
+ // 'Align the content to the bottom',
115436
+ // 'Make the content centered'
115437
+ 'Move the content to the left', 'Move the content to the center', 'Move the content to the right', 'Move the content to the top']
115398
115438
  },
115399
115439
  element: {
115400
115440
  title: 'Element',
115401
- list: ['Add a paragraph', 'Add an image', 'Add a Youtube video', // 'Add a table',
115441
+ list: ['Add a headline', 'Add a paragraph', 'Add an image', 'Add a Youtube video', // 'Add a table',
115402
115442
  // 'Add audio',
115403
115443
  // 'Add map',
115404
115444
  // 'Add an icon',
115405
115445
  // 'Add social links',
115406
- 'Add a button', 'Add two buttons', 'Add a space', 'Increase the space', 'Reduce the space']
115446
+ 'Add a button', 'Add two buttons', 'Add a space', 'Increase the space' // 'Reduce the space',
115447
+ ]
115407
115448
  },
115408
115449
  text: {
115409
115450
  title: 'Text Formatting',
@@ -115419,7 +115460,7 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
115419
115460
  },
115420
115461
  animation: {
115421
115462
  title: 'Animation',
115422
- list: ['Add a fade in animation', 'Add fade in slow animation', 'Add fade in up animation', 'Add fade in up slow animation', 'Add slide up animation', 'Add slide up slow animation', 'Add zoom in animation', 'Add zoom out animation', 'Clear the animation', 'Animate once', 'Always animate']
115463
+ list: ['Add a fade in animation', 'Add fade in up animation', 'Add slide up animation', 'Add zoom in animation', 'Add zoom out animation', 'Clear the animation', 'Animate once', 'Always animate']
115423
115464
  }
115424
115465
  },
115425
115466
 
@@ -115637,6 +115678,7 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
115637
115678
  commandPlaceholderText: this.settings.commandPlaceholderText,
115638
115679
  similarityThreshold: this.settings.similarityThreshold,
115639
115680
  useMediaRecorder: this.settings.useMediaRecorder,
115681
+ encoderPath: this.settings.encoderPath,
115640
115682
  container: '.is-container',
115641
115683
  page: '.is-wrapper',
115642
115684
  deleteConfirm: this.settings.deleteConfirm,
@@ -117321,6 +117363,8 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
117321
117363
 
117322
117364
  addIdea(newArea) {
117323
117365
  this.editor.saveForUndo();
117366
+ const d = new Date();
117367
+ newArea = newArea.replace('[%YEAR%]', d.getFullYear());
117324
117368
  let newSection;
117325
117369
  let arrSections = [];
117326
117370
 
@@ -117546,7 +117590,114 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
117546
117590
  return false;
117547
117591
  });
117548
117592
  });
117549
- this.sectionStack(); //Trigger Change event
117593
+ this.sectionStack();
117594
+
117595
+ const addMultiClass = (col, multiClass) => {
117596
+ let current = col.getAttribute('class');
117597
+ col.setAttribute('class', current + ' ' + multiClass);
117598
+ };
117599
+
117600
+ const applyClass = (col, w) => {
117601
+ //['col-md-1', 'col-md-2', 'col-md-3', 'col-md-4', 'col-md-5', 'col-md-6', 'col-md-7', 'col-md-8', 'col-md-9', 'col-md-10', 'col-md-11', 'col-md-12'];
117602
+ if (94 <= w && w <= 100) {
117603
+ //col-md-11 = 91.666667%
117604
+ addMultiClass(col, this.editor.cols[11]);
117605
+ }
117606
+
117607
+ if (86 <= w && w < 94) {
117608
+ //col-md-11 = 91.666667%
117609
+ addMultiClass(col, this.editor.cols[10]);
117610
+ }
117611
+
117612
+ if (78 <= w && w < 86) {
117613
+ //col-md-10 = 83.333333%
117614
+ addMultiClass(col, this.editor.cols[9]);
117615
+ }
117616
+
117617
+ if (70 <= w && w < 78) {
117618
+ //col-md-9 = 75%
117619
+ addMultiClass(col, this.editor.cols[8]);
117620
+ }
117621
+
117622
+ if (62 <= w && w < 70) {
117623
+ //col-md-8 = 66.666667%
117624
+ addMultiClass(col, this.editor.cols[7]);
117625
+ }
117626
+
117627
+ if (54 <= w && w < 62) {
117628
+ //col-md-7 = 58.333333%
117629
+ addMultiClass(col, this.editor.cols[6]);
117630
+ }
117631
+
117632
+ if (46 <= w && w < 54) {
117633
+ //col-md-6 = 50%
117634
+ addMultiClass(col, this.editor.cols[5]);
117635
+ }
117636
+
117637
+ if (37 <= w && w < 46) {
117638
+ //col-md-5 = 41.666667%
117639
+ addMultiClass(col, this.editor.cols[4]);
117640
+ }
117641
+
117642
+ if (29 <= w && w < 37) {
117643
+ //col-md-4 = 33%
117644
+ addMultiClass(col, this.editor.cols[3]);
117645
+ }
117646
+
117647
+ if (21 <= w && w < 29) {
117648
+ //col-md-3 = 25%
117649
+ addMultiClass(col, this.editor.cols[2]);
117650
+ }
117651
+
117652
+ if (13 <= w && w < 21) {
117653
+ //col-md-2 = 16.666667%%
117654
+ addMultiClass(col, this.editor.cols[1]);
117655
+ }
117656
+
117657
+ if (5 <= w && w < 13) {
117658
+ //col-md-1 = 8.333333%%%
117659
+ addMultiClass(col, this.editor.cols[0]);
117660
+ }
117661
+ };
117662
+
117663
+ if (!this.editor.useDefaultGrid) {
117664
+ let rows = newSection.querySelectorAll('.is-container > div');
117665
+ rows.forEach(row => {
117666
+ let cols = this.editor.util.getAllColumns(row);
117667
+ cols.forEach(col => {
117668
+ if (col.style.width && col.style.width.includes('%')) {
117669
+ let w = parseFloat(col.style.width);
117670
+ col.setAttribute('data-temp-w', w);
117671
+ } else {
117672
+ let colWidth = Number(window.getComputedStyle(col).getPropertyValue('width').match(/\d+/)[0]);
117673
+ let rowWidth = Number(window.getComputedStyle(row).getPropertyValue('width').match(/\d+/)[0]);
117674
+ let w = colWidth / rowWidth * 100;
117675
+ col.setAttribute('data-temp-w', w);
117676
+ }
117677
+ });
117678
+ });
117679
+ rows = newSection.querySelectorAll('.is-container > div');
117680
+ rows.forEach(row => {
117681
+ let cols = this.editor.util.getAllColumns(row);
117682
+ cols.forEach(col => {
117683
+ let w = col.getAttribute('data-temp-w');
117684
+ applyClass(col, parseFloat(w));
117685
+ col.removeAttribute('data-temp-w');
117686
+ let classes = this.editor.cols[0].split(' ');
117687
+ if (!classes.includes('column')) col.classList.remove('column');else {
117688
+ const classNames = col.className.split(' ');
117689
+ const uniqueClassNames = [...new Set(classNames)]; // Using Set to remove duplicates
117690
+
117691
+ col.className = uniqueClassNames.join(' ');
117692
+ }
117693
+ col.style.width = '';
117694
+ col.style.flex = '';
117695
+ }); // this.editor.util.fixLayout(row);
117696
+ });
117697
+ }
117698
+
117699
+ this.clearSelection();
117700
+ this.selectNewSection(newSection); //Trigger Change event
117550
117701
 
117551
117702
  this.onChange();
117552
117703
  dom.removeElement(document.querySelector('.is-sidebar-overlay'));
@@ -117562,6 +117713,48 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
117562
117713
  } // addIdea
117563
117714
 
117564
117715
 
117716
+ clearSelection() {
117717
+ const prevBox = this.doc.querySelector('.box-select');
117718
+ if (prevBox) prevBox.classList.remove('box-select');
117719
+ const prevSection = this.doc.querySelector('.section-select');
117720
+ if (prevSection) prevSection.classList.remove('section-select');
117721
+ this.editor.util.clearActiveCell();
117722
+ this.editor.util.clearAfterUndoRedo();
117723
+ }
117724
+
117725
+ selectNewSection(newSection) {
117726
+ let sectionBox = false;
117727
+ if (newSection.classList.contains('is-box')) sectionBox = true;
117728
+
117729
+ if (sectionBox) {
117730
+ // section
117731
+ // select box
117732
+ newSection.classList.add('box-select');
117733
+ this.activeBox = newSection;
117734
+ this.wrapperEl.classList.add('hard-select'); // select section
117735
+
117736
+ newSection.classList.add('section-select');
117737
+ this.activeSection = newSection; // Select
117738
+
117739
+ this.positionTool(newSection);
117740
+ } else {
117741
+ // select box
117742
+ let box = newSection.querySelector('.is-box');
117743
+
117744
+ if (box) {
117745
+ box.classList.add('box-select');
117746
+ this.activeBox = box;
117747
+ }
117748
+
117749
+ this.wrapperEl.classList.add('hard-select'); // select section
117750
+
117751
+ newSection.classList.add('section-select');
117752
+ this.activeSection = newSection; // Select
117753
+
117754
+ this.positionTool(newSection);
117755
+ }
117756
+ }
117757
+
117565
117758
  refreshUIStyle() {
117566
117759
  // -------
117567
117760