@innovastudio/contentbuilder 1.4.71 → 1.4.73

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.4.71",
4
+ "version": "1.4.73",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -18588,6 +18588,7 @@ class Draggable$1 {
18588
18588
  dragEnd(e) {
18589
18589
  if (!e.target.hasAttribute('draggable')) return; //any child element (ex. close button) should not be draggable. LATER: revew.
18590
18590
 
18591
+ if (!activeDraggableBox) return;
18591
18592
  e.target.parentNode.style.transition = '';
18592
18593
 
18593
18594
  //Update
@@ -77401,6 +77402,7 @@ class Dictation {
77401
77402
  localStorage.setItem('_mic', '0'); // make mic disable by default
77402
77403
  }
77403
77404
 
77405
+ this.builder.isInProgress = false;
77404
77406
  const commandInfo = this.builder.commandInfo;
77405
77407
  let htmlList = '';
77406
77408
  for (const key in commandInfo) {
@@ -77410,9 +77412,18 @@ class Dictation {
77410
77412
  list,
77411
77413
  width
77412
77414
  } = commandInfo[key];
77413
- htmlList += `<h2>${title}</h2>`;
77414
- for (const item of list) {
77415
- if (width) htmlList += `<div role="button" tabindex="0" class="command-item" style="width:${width}">${item}</div>`;else htmlList += `<div role="button" tabindex="0" class="command-item">${item}</div>`;
77415
+ if (!this.builder.enableShortCommands) {
77416
+ if (key === 'general') {
77417
+ htmlList += `<h2>${title}</h2>`;
77418
+ for (const item of list) {
77419
+ if (width) htmlList += `<div role="button" tabindex="0" class="command-item" style="width:${width}">${item}</div>`;else htmlList += `<div role="button" tabindex="0" class="command-item">${item}</div>`;
77420
+ }
77421
+ }
77422
+ } else {
77423
+ htmlList += `<h2>${title}</h2>`;
77424
+ for (const item of list) {
77425
+ if (width) htmlList += `<div role="button" tabindex="0" class="command-item" style="width:${width}">${item}</div>`;else htmlList += `<div role="button" tabindex="0" class="command-item">${item}</div>`;
77426
+ }
77416
77427
  }
77417
77428
  }
77418
77429
  }
@@ -77801,20 +77812,22 @@ class Dictation {
77801
77812
  this.aborted = true;
77802
77813
  }
77803
77814
  startDictation() {
77804
- if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {
77805
- var SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
77815
+ if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window || 'mozSpeechRecognition' in window) {
77816
+ const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition;
77806
77817
  this.recognition = new SpeechRecognition();
77807
77818
  this.recognition.continuous = true;
77808
77819
  this.recognition.interimResults = true;
77809
77820
  let lang = this.builder.speechRecognitionLang;
77810
77821
  this.recognition.lang = lang;
77811
77822
  this.recognition.start();
77812
- let speechTimeout;
77823
+ this.speechTimeout;
77824
+ this.builder.commandText = '';
77813
77825
  this.recognition.onresult = event => {
77814
- clearTimeout(speechTimeout);
77815
- if (this.builder.isInProgress) return;
77816
- var interimTranscripts = '';
77817
- var finalTranscripts = '';
77826
+ if (this.builder.isInProgress) {
77827
+ return;
77828
+ }
77829
+ let interimTranscripts = '';
77830
+ let finalTranscripts = '';
77818
77831
  for (var i = event.resultIndex; i < event.results.length; ++i) {
77819
77832
  if (event.results[i].isFinal) {
77820
77833
  finalTranscripts += event.results[i][0].transcript;
@@ -77831,13 +77844,15 @@ class Dictation {
77831
77844
 
77832
77845
  const inpCommand = this.modalCommand.querySelector('.inp-command');
77833
77846
  inpCommand.value = this.builder.commandText;
77834
- if (this.builder.autoSendCommand) {
77835
- speechTimeout = setTimeout(() => {
77847
+ clearTimeout(this.speechTimeout);
77848
+ this.speechTimeout = setTimeout(() => {
77849
+ this.builder.commandText = '';
77850
+ if (this.builder.autoSendCommand) {
77836
77851
  if (inpCommand.value.trim() === '') return;
77837
77852
  const btnSend = this.modalCommand.querySelector('.cmd-send-command');
77838
77853
  btnSend.click();
77839
- }, 1000);
77840
- }
77854
+ }
77855
+ }, 3000);
77841
77856
  };
77842
77857
  this.recognition.onend = () => {
77843
77858
  if (!this.aborted) this.startDictation();
@@ -77845,11 +77860,24 @@ class Dictation {
77845
77860
  this.recognition.onstart = () => {
77846
77861
  this.aborted = false;
77847
77862
  };
77848
- this.recognition.onerror = () => {
77849
- // console.log(e.error);
77863
+ this.recognition.onerror = e => {
77864
+ console.log(e.message);
77850
77865
  };
77851
77866
  } else {
77852
- alert(this.util.out('Speech recognition not supported in this browser.'));
77867
+ // See btnDictation click
77868
+ setTimeout(() => {
77869
+ const btnDictation = this.builderStuff.querySelector('.cmd-enable-dictation');
77870
+ const btnClear = this.builderStuff.querySelector('.cmd-clear-command');
77871
+ const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
77872
+ this.stopDictation();
77873
+ btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
77874
+ localStorage.setItem('_mic', '0');
77875
+ chkAutoSend.parentNode.style.display = 'none';
77876
+ btnClear.style.marginRight = '6px';
77877
+ }, 1); // to give delay from the btnDictation click
77878
+
77879
+ //Show info
77880
+ this.util.showMessage(this.util.out('Speech recognition not supported in this browser.'));
77853
77881
  }
77854
77882
  }
77855
77883
  startSending() {
@@ -77864,24 +77892,12 @@ class Dictation {
77864
77892
  ovl.style.display = 'flex';
77865
77893
  this.builder.isInProgress = true;
77866
77894
  }
77867
- finish(doNotClear) {
77895
+ finish() {
77896
+ this.builder.isInProgress = false;
77868
77897
  const btnSend = this.modalCommand.querySelector('.cmd-send-command');
77869
77898
  btnSend.innerText = this.util.out('Send');
77870
77899
  const ovl = this.builderStuff.querySelector('.page-command-overlay');
77871
77900
  ovl.style.display = 'none';
77872
- this.builder.isInProgress = false;
77873
- if (this.checkMic() === false) {
77874
- // Do not clear inpCommand text
77875
- return;
77876
- }
77877
- if (this.builder.autoSendCommand) {
77878
- // Clear
77879
- const inpCommand = this.builderStuff.querySelector('.inp-command');
77880
- if (doNotClear) ; else {
77881
- this.builder.commandText = '';
77882
- inpCommand.value = '';
77883
- }
77884
- }
77885
77901
  }
77886
77902
  }
77887
77903
 
@@ -78609,6 +78625,7 @@ class ContentBuilder {
78609
78625
  isContentBox: false,
78610
78626
  sendCommandUrl: 'http://localhost:8081/answer',
78611
78627
  //sampleCommand: '',
78628
+ enableShortCommands: true,
78612
78629
  speechRecognitionLang: 'en-US',
78613
78630
  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'],
78614
78631
  shortCommandList: {