@innovastudio/contentbuilder 1.4.77 → 1.4.78

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.4.77",
4
+ "version": "1.4.78",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -57,6 +57,7 @@
57
57
  "moveable": "^0.30.0",
58
58
  "rangy": "^1.3.0",
59
59
  "recordrtc": "^5.6.2",
60
+ "socket.io-client": "^4.7.1",
60
61
  "sortablejs": "^1.14.0",
61
62
  "string-similarity": "^4.0.4"
62
63
  }
@@ -32,6 +32,11 @@ button:focus-visible {
32
32
  transition: all ease 0.1s;
33
33
  }
34
34
 
35
+ .focus-outline {
36
+ outline: #3e93f7 2px solid !important;
37
+ outline-offset: 2px !important;
38
+ }
39
+
35
40
  .is-builder {
36
41
  transition: all ease 0.3s;
37
42
  transform-origin: top;
@@ -3932,13 +3932,13 @@ class Util {
3932
3932
  return s;
3933
3933
  }
3934
3934
  }
3935
- showMessage(message) {
3935
+ showMessage(message, focusOutline) {
3936
3936
  const dom = this.dom;
3937
3937
  let html = '';
3938
3938
  html = `<div class="is-modal modalmessage" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
3939
3939
  <div class="is-modal-content" style="padding-top: 15px;padding-bottom: 20px;max-width: 450px;">
3940
3940
  <div style="margin: 20px 0 30px;font-size: 17px;">${message}</div>
3941
- <button title="${this.out('Ok')}" class="input-ok classic focus-warning">${this.out('Ok')}</button>
3941
+ <button title="${this.out('Ok')}" class="input-ok classic">${this.out('Ok')}</button>
3942
3942
  </div>
3943
3943
  </div>`;
3944
3944
  const builderStuff = this.builder.builderStuff;
@@ -3953,8 +3953,12 @@ class Util {
3953
3953
  let buttonok = modalMessage.querySelector('.modalmessage .input-ok');
3954
3954
  dom.addEventListener(buttonok, 'click', () => {
3955
3955
  this.hideModal(modalMessage);
3956
- modalMessage.parentNode.removeChild(modalMessage);
3956
+ if (modalMessage.parentNode) modalMessage.parentNode.removeChild(modalMessage);
3957
3957
  });
3958
+ buttonok.focus();
3959
+ if (focusOutline) {
3960
+ buttonok.classList.add('focus-outline');
3961
+ }
3958
3962
  }
3959
3963
  showChoice(message, yestext, callback) {
3960
3964
  const dom = this.dom;
@@ -83994,6 +83998,22 @@ class Dictation {
83994
83998
  });
83995
83999
  }
83996
84000
  async startDictation() {
84001
+ if (this.builder.onlineDemo) {
84002
+ setTimeout(() => {
84003
+ const btnDictation = this.builderStuff.querySelector('.cmd-enable-dictation');
84004
+ const btnClear = this.builderStuff.querySelector('.cmd-clear-command');
84005
+ const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
84006
+ this.stopDictation();
84007
+ btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
84008
+ localStorage.setItem('_mic', '0');
84009
+ chkAutoSend.parentNode.style.display = 'none';
84010
+ btnClear.style.marginRight = '6px';
84011
+ }, 1); // to give delay from the btnDictation click
84012
+
84013
+ //Show info
84014
+ this.util.showMessage(this.util.out('Speech recognition is disabled in this online demo. Please type your command/prompt in the textbox.'), true);
84015
+ return;
84016
+ }
83997
84017
  if (this.builder.speechTranscribeUrl) {
83998
84018
  this.websocket = new WebSocket(this.builder.speechTranscribeUrl);
83999
84019
  try {
@@ -84062,7 +84082,7 @@ class Dictation {
84062
84082
  const btnSend = this.modalCommand.querySelector('.cmd-send-command');
84063
84083
  btnSend.click();
84064
84084
  }
84065
- }, 2000);
84085
+ }, this.builder.autoSendDelay);
84066
84086
  }
84067
84087
  };
84068
84088
  } else {
@@ -84106,7 +84126,7 @@ class Dictation {
84106
84126
  const btnSend = this.modalCommand.querySelector('.cmd-send-command');
84107
84127
  btnSend.click();
84108
84128
  }
84109
- }, 3000);
84129
+ }, this.builder.autoSendDelay);
84110
84130
  };
84111
84131
  this.recognition.onend = () => {
84112
84132
  if (!this.aborted) this.startDictation();
@@ -84880,6 +84900,8 @@ class ContentBuilder {
84880
84900
  isContentBox: false,
84881
84901
  sendCommandUrl: 'http://localhost:8081/answer',
84882
84902
  // speechTranscribeUrl: 'http://192.168.1.7:8081',
84903
+ onlineDemo: false,
84904
+ autoSendDelay: 3000,
84883
84905
  commandPlaceholderText: '',
84884
84906
  enableShortCommands: true,
84885
84907
  speechRecognitionLang: 'en-US',