@innovastudio/contentbuilder 1.4.70 → 1.4.72
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -3947,14 +3947,15 @@ class Util {
|
|
3947
3947
|
dom.appendHtml(builderStuff, html);
|
3948
3948
|
modalMessage = builderStuff.querySelector('.modalmessage');
|
3949
3949
|
}
|
3950
|
-
this.showModal(modalMessage,
|
3951
|
-
|
3950
|
+
this.showModal(modalMessage, false, () => {
|
3951
|
+
modalMessage.parentNode.removeChild(modalMessage);
|
3952
|
+
});
|
3953
|
+
let buttonok = modalMessage.querySelector('.modalmessage .input-ok');
|
3952
3954
|
dom.addEventListener(buttonok, 'click', () => {
|
3953
3955
|
this.hideModal(modalMessage);
|
3954
|
-
modalMessage.parentNode.removeChild(modalMessage);
|
3956
|
+
modalMessage.parentNode.removeChild(modalMessage);
|
3955
3957
|
});
|
3956
3958
|
}
|
3957
|
-
|
3958
3959
|
showChoice(message, yestext, callback) {
|
3959
3960
|
const dom = this.dom;
|
3960
3961
|
let html = '';
|
@@ -77400,6 +77401,7 @@ class Dictation {
|
|
77400
77401
|
localStorage.setItem('_mic', '0'); // make mic disable by default
|
77401
77402
|
}
|
77402
77403
|
|
77404
|
+
this.builder.isInProgress = false;
|
77403
77405
|
const commandInfo = this.builder.commandInfo;
|
77404
77406
|
let htmlList = '';
|
77405
77407
|
for (const key in commandInfo) {
|
@@ -77800,20 +77802,22 @@ class Dictation {
|
|
77800
77802
|
this.aborted = true;
|
77801
77803
|
}
|
77802
77804
|
startDictation() {
|
77803
|
-
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {
|
77804
|
-
|
77805
|
+
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window || 'mozSpeechRecognition' in window) {
|
77806
|
+
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition;
|
77805
77807
|
this.recognition = new SpeechRecognition();
|
77806
77808
|
this.recognition.continuous = true;
|
77807
77809
|
this.recognition.interimResults = true;
|
77808
77810
|
let lang = this.builder.speechRecognitionLang;
|
77809
77811
|
this.recognition.lang = lang;
|
77810
77812
|
this.recognition.start();
|
77811
|
-
|
77813
|
+
this.speechTimeout;
|
77814
|
+
this.builder.commandText = '';
|
77812
77815
|
this.recognition.onresult = event => {
|
77813
|
-
|
77814
|
-
|
77815
|
-
|
77816
|
-
|
77816
|
+
if (this.builder.isInProgress) {
|
77817
|
+
return;
|
77818
|
+
}
|
77819
|
+
let interimTranscripts = '';
|
77820
|
+
let finalTranscripts = '';
|
77817
77821
|
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
77818
77822
|
if (event.results[i].isFinal) {
|
77819
77823
|
finalTranscripts += event.results[i][0].transcript;
|
@@ -77830,13 +77834,15 @@ class Dictation {
|
|
77830
77834
|
|
77831
77835
|
const inpCommand = this.modalCommand.querySelector('.inp-command');
|
77832
77836
|
inpCommand.value = this.builder.commandText;
|
77833
|
-
|
77834
|
-
|
77837
|
+
clearTimeout(this.speechTimeout);
|
77838
|
+
this.speechTimeout = setTimeout(() => {
|
77839
|
+
this.builder.commandText = '';
|
77840
|
+
if (this.builder.autoSendCommand) {
|
77835
77841
|
if (inpCommand.value.trim() === '') return;
|
77836
77842
|
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
77837
77843
|
btnSend.click();
|
77838
|
-
}
|
77839
|
-
}
|
77844
|
+
}
|
77845
|
+
}, 3000);
|
77840
77846
|
};
|
77841
77847
|
this.recognition.onend = () => {
|
77842
77848
|
if (!this.aborted) this.startDictation();
|
@@ -77844,11 +77850,24 @@ class Dictation {
|
|
77844
77850
|
this.recognition.onstart = () => {
|
77845
77851
|
this.aborted = false;
|
77846
77852
|
};
|
77847
|
-
this.recognition.onerror =
|
77848
|
-
|
77853
|
+
this.recognition.onerror = e => {
|
77854
|
+
console.log(e.message);
|
77849
77855
|
};
|
77850
77856
|
} else {
|
77851
|
-
|
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.'));
|
77852
77871
|
}
|
77853
77872
|
}
|
77854
77873
|
startSending() {
|
@@ -77863,24 +77882,12 @@ class Dictation {
|
|
77863
77882
|
ovl.style.display = 'flex';
|
77864
77883
|
this.builder.isInProgress = true;
|
77865
77884
|
}
|
77866
|
-
finish(
|
77885
|
+
finish() {
|
77886
|
+
this.builder.isInProgress = false;
|
77867
77887
|
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
77868
77888
|
btnSend.innerText = this.util.out('Send');
|
77869
77889
|
const ovl = this.builderStuff.querySelector('.page-command-overlay');
|
77870
77890
|
ovl.style.display = 'none';
|
77871
|
-
this.builder.isInProgress = false;
|
77872
|
-
if (this.checkMic() === false) {
|
77873
|
-
// Do not clear inpCommand text
|
77874
|
-
return;
|
77875
|
-
}
|
77876
|
-
if (this.builder.autoSendCommand) {
|
77877
|
-
// Clear
|
77878
|
-
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
77879
|
-
if (doNotClear) ; else {
|
77880
|
-
this.builder.commandText = '';
|
77881
|
-
inpCommand.value = '';
|
77882
|
-
}
|
77883
|
-
}
|
77884
77891
|
}
|
77885
77892
|
}
|
77886
77893
|
|