@innovastudio/contentbuilder 1.4.77 → 1.4.79

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.79",
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, callback) {
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;
@@ -3949,12 +3949,18 @@ class Util {
3949
3949
  }
3950
3950
  this.showModal(modalMessage, false, () => {
3951
3951
  modalMessage.parentNode.removeChild(modalMessage);
3952
+ if (callback) callback();
3952
3953
  });
3953
3954
  let buttonok = modalMessage.querySelector('.modalmessage .input-ok');
3954
3955
  dom.addEventListener(buttonok, 'click', () => {
3955
3956
  this.hideModal(modalMessage);
3956
- modalMessage.parentNode.removeChild(modalMessage);
3957
+ if (modalMessage.parentNode) modalMessage.parentNode.removeChild(modalMessage);
3958
+ if (callback) callback();
3957
3959
  });
3960
+ buttonok.focus();
3961
+ if (focusOutline) {
3962
+ buttonok.classList.add('focus-outline');
3963
+ }
3958
3964
  }
3959
3965
  showChoice(message, yestext, callback) {
3960
3966
  const dom = this.dom;
@@ -83958,16 +83964,15 @@ class Dictation {
83958
83964
  }
83959
83965
  }
83960
83966
  openDictation() {
83967
+ const inpCommand = this.modalCommand.querySelector('.inp-command');
83961
83968
  if (this.modalCommand.classList.contains('active')) {
83962
83969
  setTimeout(() => {
83963
83970
  // Needed if opens programmatically on builder start (wait until all loaded)
83964
- const inpCommand = this.modalCommand.querySelector('.inp-command');
83965
83971
  inpCommand.focus();
83966
83972
  }, 600);
83967
83973
  return;
83968
83974
  }
83969
83975
  this.modalCommand.classList.add('active');
83970
- const inpCommand = this.modalCommand.querySelector('.inp-command');
83971
83976
  inpCommand.focus();
83972
83977
  localStorage.setItem('_dictation', '1');
83973
83978
  const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
@@ -83994,6 +83999,25 @@ class Dictation {
83994
83999
  });
83995
84000
  }
83996
84001
  async startDictation() {
84002
+ const inpCommand = this.modalCommand.querySelector('.inp-command');
84003
+ if (this.builder.onlineDemo) {
84004
+ setTimeout(() => {
84005
+ const btnDictation = this.builderStuff.querySelector('.cmd-enable-dictation');
84006
+ const btnClear = this.builderStuff.querySelector('.cmd-clear-command');
84007
+ const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
84008
+ this.stopDictation();
84009
+ btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
84010
+ localStorage.setItem('_mic', '0');
84011
+ chkAutoSend.parentNode.style.display = 'none';
84012
+ btnClear.style.marginRight = '6px';
84013
+ }, 1); // to give delay from the btnDictation click
84014
+
84015
+ //Show info
84016
+ this.util.showMessage(this.util.out('Speech recognition is disabled in this online demo. You can type your command/prompt in the textbox.'), true, () => {
84017
+ inpCommand.focus();
84018
+ });
84019
+ return;
84020
+ }
83997
84021
  if (this.builder.speechTranscribeUrl) {
83998
84022
  this.websocket = new WebSocket(this.builder.speechTranscribeUrl);
83999
84023
  try {
@@ -84038,7 +84062,6 @@ class Dictation {
84038
84062
  this.startDictation();
84039
84063
  }
84040
84064
  let finalTranscripts = '';
84041
- const inpCommand = this.modalCommand.querySelector('.inp-command');
84042
84065
  this.websocket.onmessage = event => {
84043
84066
  const message = JSON.parse(event.data);
84044
84067
  if (message.event === 'can-open-mic') {
@@ -84062,7 +84085,7 @@ class Dictation {
84062
84085
  const btnSend = this.modalCommand.querySelector('.cmd-send-command');
84063
84086
  btnSend.click();
84064
84087
  }
84065
- }, 2000);
84088
+ }, this.builder.autoSendDelay);
84066
84089
  }
84067
84090
  };
84068
84091
  } else {
@@ -84096,7 +84119,6 @@ class Dictation {
84096
84119
  }
84097
84120
  this.builder.commandText += finalTranscripts; // + '<i style="color:#999">' + interimTranscripts + '</i>';
84098
84121
 
84099
- const inpCommand = this.modalCommand.querySelector('.inp-command');
84100
84122
  inpCommand.value = this.builder.commandText;
84101
84123
  clearTimeout(this.speechTimeout);
84102
84124
  this.speechTimeout = setTimeout(() => {
@@ -84106,7 +84128,7 @@ class Dictation {
84106
84128
  const btnSend = this.modalCommand.querySelector('.cmd-send-command');
84107
84129
  btnSend.click();
84108
84130
  }
84109
- }, 3000);
84131
+ }, this.builder.autoSendDelay);
84110
84132
  };
84111
84133
  this.recognition.onend = () => {
84112
84134
  if (!this.aborted) this.startDictation();
@@ -84880,6 +84902,8 @@ class ContentBuilder {
84880
84902
  isContentBox: false,
84881
84903
  sendCommandUrl: 'http://localhost:8081/answer',
84882
84904
  // speechTranscribeUrl: 'http://192.168.1.7:8081',
84905
+ onlineDemo: false,
84906
+ autoSendDelay: 3000,
84883
84907
  commandPlaceholderText: '',
84884
84908
  enableShortCommands: true,
84885
84909
  speechRecognitionLang: 'en-US',