@innovastudio/contentbuilder 1.4.71 → 1.4.72
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
|
@@ -77401,6 +77401,7 @@ class Dictation {
|
|
|
77401
77401
|
localStorage.setItem('_mic', '0'); // make mic disable by default
|
|
77402
77402
|
}
|
|
77403
77403
|
|
|
77404
|
+
this.builder.isInProgress = false;
|
|
77404
77405
|
const commandInfo = this.builder.commandInfo;
|
|
77405
77406
|
let htmlList = '';
|
|
77406
77407
|
for (const key in commandInfo) {
|
|
@@ -77801,20 +77802,22 @@ class Dictation {
|
|
|
77801
77802
|
this.aborted = true;
|
|
77802
77803
|
}
|
|
77803
77804
|
startDictation() {
|
|
77804
|
-
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {
|
|
77805
|
-
|
|
77805
|
+
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window || 'mozSpeechRecognition' in window) {
|
|
77806
|
+
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition;
|
|
77806
77807
|
this.recognition = new SpeechRecognition();
|
|
77807
77808
|
this.recognition.continuous = true;
|
|
77808
77809
|
this.recognition.interimResults = true;
|
|
77809
77810
|
let lang = this.builder.speechRecognitionLang;
|
|
77810
77811
|
this.recognition.lang = lang;
|
|
77811
77812
|
this.recognition.start();
|
|
77812
|
-
|
|
77813
|
+
this.speechTimeout;
|
|
77814
|
+
this.builder.commandText = '';
|
|
77813
77815
|
this.recognition.onresult = event => {
|
|
77814
|
-
|
|
77815
|
-
|
|
77816
|
-
|
|
77817
|
-
|
|
77816
|
+
if (this.builder.isInProgress) {
|
|
77817
|
+
return;
|
|
77818
|
+
}
|
|
77819
|
+
let interimTranscripts = '';
|
|
77820
|
+
let finalTranscripts = '';
|
|
77818
77821
|
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
|
77819
77822
|
if (event.results[i].isFinal) {
|
|
77820
77823
|
finalTranscripts += event.results[i][0].transcript;
|
|
@@ -77831,13 +77834,15 @@ class Dictation {
|
|
|
77831
77834
|
|
|
77832
77835
|
const inpCommand = this.modalCommand.querySelector('.inp-command');
|
|
77833
77836
|
inpCommand.value = this.builder.commandText;
|
|
77834
|
-
|
|
77835
|
-
|
|
77837
|
+
clearTimeout(this.speechTimeout);
|
|
77838
|
+
this.speechTimeout = setTimeout(() => {
|
|
77839
|
+
this.builder.commandText = '';
|
|
77840
|
+
if (this.builder.autoSendCommand) {
|
|
77836
77841
|
if (inpCommand.value.trim() === '') return;
|
|
77837
77842
|
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
|
77838
77843
|
btnSend.click();
|
|
77839
|
-
}
|
|
77840
|
-
}
|
|
77844
|
+
}
|
|
77845
|
+
}, 3000);
|
|
77841
77846
|
};
|
|
77842
77847
|
this.recognition.onend = () => {
|
|
77843
77848
|
if (!this.aborted) this.startDictation();
|
|
@@ -77845,11 +77850,24 @@ class Dictation {
|
|
|
77845
77850
|
this.recognition.onstart = () => {
|
|
77846
77851
|
this.aborted = false;
|
|
77847
77852
|
};
|
|
77848
|
-
this.recognition.onerror =
|
|
77849
|
-
|
|
77853
|
+
this.recognition.onerror = e => {
|
|
77854
|
+
console.log(e.message);
|
|
77850
77855
|
};
|
|
77851
77856
|
} else {
|
|
77852
|
-
|
|
77857
|
+
// See btnDictation click
|
|
77858
|
+
setTimeout(() => {
|
|
77859
|
+
const btnDictation = this.builderStuff.querySelector('.cmd-enable-dictation');
|
|
77860
|
+
const btnClear = this.builderStuff.querySelector('.cmd-clear-command');
|
|
77861
|
+
const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
|
|
77862
|
+
this.stopDictation();
|
|
77863
|
+
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
|
|
77864
|
+
localStorage.setItem('_mic', '0');
|
|
77865
|
+
chkAutoSend.parentNode.style.display = 'none';
|
|
77866
|
+
btnClear.style.marginRight = '6px';
|
|
77867
|
+
}, 1); // to give delay from the btnDictation click
|
|
77868
|
+
|
|
77869
|
+
//Show info
|
|
77870
|
+
this.util.showMessage(this.util.out('Speech recognition not supported in this browser.'));
|
|
77853
77871
|
}
|
|
77854
77872
|
}
|
|
77855
77873
|
startSending() {
|
|
@@ -77864,24 +77882,12 @@ class Dictation {
|
|
|
77864
77882
|
ovl.style.display = 'flex';
|
|
77865
77883
|
this.builder.isInProgress = true;
|
|
77866
77884
|
}
|
|
77867
|
-
finish(
|
|
77885
|
+
finish() {
|
|
77886
|
+
this.builder.isInProgress = false;
|
|
77868
77887
|
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
|
77869
77888
|
btnSend.innerText = this.util.out('Send');
|
|
77870
77889
|
const ovl = this.builderStuff.querySelector('.page-command-overlay');
|
|
77871
77890
|
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
77891
|
}
|
|
77886
77892
|
}
|
|
77887
77893
|
|