jodit 4.0.0-beta.44 → 4.0.0-beta.49
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/README.md +4 -4
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.js +414 -333
- package/es2015/jodit.min.js +2 -2
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +781 -761
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es2018/jodit.css +1 -1
- package/es2018/jodit.js +412 -331
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.js +1 -1
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.js +781 -761
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.js +412 -331
- package/es2021/jodit.min.js +2 -2
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +780 -760
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.js +12 -11
- package/es2021.en/jodit.min.js +2 -2
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +3 -3
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es5/jodit.css +2 -2
- package/es5/jodit.js +1103 -1023
- package/es5/jodit.min.css +1 -1
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.js +2 -2
- package/es5/plugins/debug/debug.min.js +2 -2
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +798 -778
- package/es5/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/esm/config.js +2 -1
- package/esm/core/constants.js +1 -1
- package/esm/plugins/preview/preview.js +1 -1
- package/package.json +1 -1
- package/types/config.d.ts +2 -1
- package/types/tsconfig.json +2 -20
- package/esm/plugins/source/editor/engines/custom.js +0 -34
- package/esm/plugins/speech-recognize/config.js +0 -92
- package/esm/plugins/speech-recognize/constants.js +0 -11
- package/esm/plugins/speech-recognize/helpers/api.js +0 -7
- package/esm/plugins/speech-recognize/helpers/exec-spell-command.js +0 -9
- package/esm/plugins/speech-recognize/helpers/recognize-manager.js +0 -168
- package/esm/plugins/speech-recognize/helpers/sound.js +0 -30
- package/esm/plugins/speech-recognize/interface.js +0 -6
- package/esm/plugins/speech-recognize/langs/ar.js +0 -14
- package/esm/plugins/speech-recognize/langs/cs_cz.js +0 -14
- package/esm/plugins/speech-recognize/langs/de.js +0 -14
- package/esm/plugins/speech-recognize/langs/es.js +0 -14
- package/esm/plugins/speech-recognize/langs/fa.js +0 -14
- package/esm/plugins/speech-recognize/langs/fr.js +0 -14
- package/esm/plugins/speech-recognize/langs/he.js +0 -14
- package/esm/plugins/speech-recognize/langs/hu.js +0 -14
- package/esm/plugins/speech-recognize/langs/id.js +0 -14
- package/esm/plugins/speech-recognize/langs/index.js +0 -1
- package/esm/plugins/speech-recognize/langs/it.js +0 -14
- package/esm/plugins/speech-recognize/langs/ja.js +0 -14
- package/esm/plugins/speech-recognize/langs/ko.js +0 -14
- package/esm/plugins/speech-recognize/langs/mn.js +0 -14
- package/esm/plugins/speech-recognize/langs/nl.js +0 -14
- package/esm/plugins/speech-recognize/langs/pl.js +0 -14
- package/esm/plugins/speech-recognize/langs/pt_br.js +0 -14
- package/esm/plugins/speech-recognize/langs/ru.js +0 -14
- package/esm/plugins/speech-recognize/langs/tr.js +0 -14
- package/esm/plugins/speech-recognize/langs/zh_cn.js +0 -14
- package/esm/plugins/speech-recognize/langs/zh_tw.js +0 -14
- package/esm/plugins/speech-recognize/speech-recognize.js +0 -115
- package/esm/polyfills.js +0 -54
- package/types/plugins/source/editor/engines/custom.d.ts +0 -27
- package/types/polyfills.d.ts +0 -10
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.0.0-beta.
|
|
4
|
+
* Version: v4.0.0-beta.49
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[781],{29204:function(e,t,n){"use strict";n.r(t),n.d(t,{SpeechRecognizeNative:function(){return M}});var o={};n.r(o),n.d(o,{ar:function(){return l},cs_cz:function(){return d},de:function(){return h},es:function(){return f},fa:function(){return m},fr:function(){return g},he:function(){return R},hu:function(){return _},id:function(){return S},it:function(){return v},ja:function(){return w},ko:function(){return z},mn:function(){return y},nl:function(){return b},pl:function(){return x},pt_br:function(){return k},ru:function(){return T},tr:function(){return E},zh_cn:function(){return I},zh_tw:function(){return P}});var i=n(20255),s=n(7331),r=n(69082),c=n(87398),u=n(79102),a=n(9162),p=n(62294),l=n(5466),d=n(65226),h=n(87541),f=n(87104),m=n(53808),g=n(48954),R=n(14694),_=n(67381),S=n(99549),v=n(28428),w=n(25363),z=n(96929),y=n(26781),b=n(58499),x=n(59430),k=n(70297),T=n(98949),E=n(61232),I=n(56775),P=n(97957),j=n(37446),C=n(25920),q=n(88751),V=n(30052),A=n(3569),D=n(90283),H=function(e){function t(t,o){var i=e.call(this)||this;return i.async=t,i._continuous=!1,i._interimResults=!1,i.sound=!0,i._isEnabled=!1,i._restartTimeout=0,i._onSpeechStart=function(e){i._isEnabled&&(i.async.clearTimeout(i._restartTimeout),i._restartTimeout=i.async.setTimeout((function(){i.restart(),i.emit("pulse",!1),i._makeSound(940)}),5e3),i.emit("pulse",!0))},i._progressTimeout=0,i._api=o,n._instances.add(i),i}var n;return(0,i.ZT)(t,e),n=t,Object.defineProperty(t.prototype,"lang",{get:function(){return this._lang},set:function(e){this._lang=e,this._api.lang=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"continuous",{get:function(){return this._continuous},set:function(e){this._continuous=e,this._api.continuous=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"interimResults",{get:function(){return this._interimResults},set:function(e){this._interimResults=e,this._api.interimResults=e},enumerable:!1,configurable:!0}),t.prototype.destruct=function(){this.stop(),n._instances.delete(this),e.prototype.destruct.call(this)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},enumerable:!1,configurable:!0}),t.prototype.start=function(){var e=this;this._isEnabled||(this._isEnabled=!0,n._instances.forEach((function(t){t!==e&&t.stop()})),this._api.start(),this.__on("speechstart",this._onSpeechStart).__on("error",this._onError).__on("result",this._onResult))},t.prototype.stop=function(){if(this._isEnabled){try{this._api.abort(),this._api.stop()}catch(e){}this.__off("speechstart",this._onSpeechStart).__off("error",this._onError).__off("result",this._onResult),this.async.clearTimeout(this._restartTimeout),this._isEnabled=!1,this.emit("pulse",!1)}},t.prototype.toggle=function(){this._isEnabled?this.stop():this.start()},t.prototype.restart=function(){this.stop(),this.start()},t.prototype.__on=function(e,t){return this._api.addEventListener(e,t),this},t.prototype.__off=function(e,t){return this._api.removeEventListener(e,t),this},t.prototype._onResult=function(e){var t=this;if(this._isEnabled){this.async.clearTimeout(this._progressTimeout);var n=e.results.item(e.resultIndex),o=n.item(0).transcript,i=function(){try{t.async.clearTimeout(t._restartTimeout),t.emit("result",o)}catch(e){}t.restart(),t.emit("pulse",!1),t._makeSound(440)};if(!1===n.isFinal)return this.emit("progress",o),void(this._progressTimeout=this.async.setTimeout(i,500));i()}},t.prototype._onError=function(){this._isEnabled&&(this._makeSound(940),this.emit("pulse",!1),this.restart())},t.prototype._makeSound=function(e){this.sound&&function(e){var t=void 0===e?{}:e,n=t.sec,o=void 0===n?.1:n,i=t.frequency,s=void 0===i?440:i,r=t.gain,c=void 0===r?.1:r,u=t.type,a=void 0===u?"sine":u;if(void 0!==window.AudioContext||void 0!==window.webkitAudioContext){var p=new(window.AudioContext||window.webkitAudioContext),l=p.createGain(),d=p.createOscillator();d.type=a,d.frequency.value=s,d.connect(l),l.connect(p.destination),d.start(),d.stop(p.currentTime+o),l.gain.value=c}}({frequency:e})},t._instances=new Set,n=(0,i.gn)([D.autobind],t)}(A.a),O=window.SpeechRecognition||window.webkitSpeechRecognition,W=n(55106),L=n.n(W);j.D.prototype.speechRecognize={api:O,sound:!0,continuous:!0,interimResults:!0,commands:{"newline|enter":"enter","delete|remove word|delete word":"backspaceWordButton",comma:"inserthtml::,",underline:"inserthtml::_",hyphen:"inserthtml::-",space:"inserthtml:: ",question:"inserthtml::?",dot:"inserthtml::.","quote|quotes|open quote":"inserthtml::'","header|header h1":"formatblock::h1","select all":"selectall"}},V.J.set("speech-recognize",L()),j.D.prototype.controls.speechRecognize={isActive:function(e,t){var n=(0,C.q)(e,"speech");return Boolean(null==n?void 0:n.isEnabled)},isDisabled:function(e){return!e.o.speechRecognize.api},exec:function(e,t,n){var o=n.button,i=n.control,s=e.o.speechRecognize,r=s.api,c=s.lang,u=s.continuous,a=s.interimResults,p=s.sound;if(r){var l=(0,C.q)(e,"speech");if(!l){var d=new r;(l=new H(e.async,d)).lang=c,l.continuous=u,l.interimResults=a,l.sound=p,(0,C.q)(e,"speech",l),l.on("pulse",(function(e){o.setMod("pulse",e)})),l.on("result",(function(t){return e.e.fire("speechRecognizeResult",t)})),l.on("progress",(function(t){return e.e.fire("speechRecognizeProgressResult",t)})),o.hookStatus("beforeDestruct",(function(){l.destruct()}))}if(i.args){var h=i.args[0];if((0,q.j)(l[h]))return l[h]=!l[h],void(l.isEnabled&&l.restart())}l.toggle(),o.state.activated=l.isEnabled}else e.alert("Speech recognize API unsupported in your browser")},name:"speechRecognize",command:"toggleSpeechRecognize",tooltip:"Speech Recognize",list:{sound:"Sound",interimResults:"Interim Results"},childTemplate:function(e,t,n){var o,i=(0,C.q)(e,"speech"),s=null!==(o=null==i?void 0:i[t])&&void 0!==o?o:e.o.speechRecognize[t];return"<span class='jodit-speech-recognize__list-item'><input ".concat(s?"checked":""," class='jodit-checkbox' type='checkbox'> ").concat(n,"</span>")},mods:{stroke:!1}};var M=function(e){function t(t){var n=e.call(this,t)||this;return n._commandToWord={},t.o.speechRecognize.api&&t.registerButton({group:"state",name:"speechRecognize"}),n}return(0,i.ZT)(t,e),t.prototype.afterInit=function(e){var t=this,n=e.o.speechRecognize.commands;n&&((0,u.xl)(o),(0,c.XP)(n,!1).forEach((function(o){o.split("|").forEach((function(i){i=i.trim().toLowerCase(),t._commandToWord[i]=n[o];var s=e.i18n(i);s!==i&&s.split("|").forEach((function(e){t._commandToWord[e.trim().toLowerCase()]=n[o].trim()}))}))})))},t.prototype.beforeDestruct=function(e){},t.prototype.onSpeechRecognizeProgressResult=function(e){var t=this;this.messagePopup||(this.messagePopup=this.j.create.div("jodit-speech-recognize__popup")),this.j.workplace.appendChild(this.messagePopup),this.j.async.setTimeout((function(){a.i.safeRemove(t.messagePopup)}),{label:"onSpeechRecognizeProgressResult",timeout:1e3}),this.messagePopup.innerText=e+"|"},t.prototype.onSpeechRecognizeResult=function(e){var t=this.j,n=t.s;if(a.i.safeRemove(this.messagePopup),!this._checkCommand(e)){var o=n.range,i=n.current();if(n.isCollapsed()&&a.i.isText(i)&&a.i.isOrContains(t.editor,i)&&i.nodeValue){var s=i.nodeValue;i.nodeValue=s+(/[\u00A0 ]\uFEFF*$/.test(s)?"":" ")+e,o.setStartAfter(i),n.selectRange(o),t.synchronizeValues()}else n.insertHTML(e)}},t.prototype._checkCommand=function(e){return e=e.toLowerCase().replace(/\./g,""),!!this._commandToWord[e]&&(t=this.j,n=(0,i.CR)(this._commandToWord[e].split("::"),2),t.execCommand(n[0],null,n[1]),!0);var t,n},(0,i.gn)([(0,r.YP)(":speechRecognizeProgressResult"),(0,p.D)()],t.prototype,"onSpeechRecognizeProgressResult",null),(0,i.gn)([(0,r.YP)(":speechRecognizeResult")],t.prototype,"onSpeechRecognizeResult",null),t}(s.S);"undefined"!=typeof Jodit&&Jodit.plugins.add("speech-recognize",M)},5466:function(e){e.exports={newline:"الخط الجديد",delete:"حذف",space:"الفضاء","Speech Recognize":"التعرف على الكلام",Sound:"الصوت","Interim Results":"النتائج المؤقتة"}},65226:function(e){e.exports={newline:"řádek",delete:"odstranit",space:"prostora","Speech Recognize":"Rozpoznání Řeči",Sound:"Zvuk","Interim Results":"Průběžné Výsledky"}},87541:function(e){e.exports={newline:"Zeilenumbruch",delete:"löschen",space:"Raum","Speech Recognize":"Sprache Erkennen",Sound:"Sound","Interim Results":"Zwischenergebnis"}},87104:function(e){e.exports={newline:"nueva línea",delete:"eliminar",space:"espacio","Speech Recognize":"Reconocimiento de Voz",Sound:"Sonido","Interim Results":"Resultados Provisionales"}},53808:function(e){e.exports={newline:"خط جدید",delete:"حذف",space:"فضا","Speech Recognize":"گفتار را تشخیص دهید",Sound:"صدا","Interim Results":"نتایج موقت"}},48954:function(e){e.exports={newline:"nouvelle ligne",delete:"supprimer",space:"espace","Speech Recognize":"Reconnaissance Vocale",Sound:"Son","Interim Results":"Résultats Intermédiaires"}},14694:function(e){e.exports={newline:"חדשות",delete:"מחק",space:"שטח","Speech Recognize":"דיבור מזהה",Sound:"קול","Interim Results":"תוצאות ביניים"}},67381:function(e){e.exports={newline:"újsor",delete:"törlés",space:"tér","Speech Recognize":"A Beszéd Felismeri",Sound:"Hang","Interim Results":"Időközi Eredmények"}},99549:function(e){e.exports={newline:"newline",delete:"Hapus",space:"ruang","Speech Recognize":"Pidato Mengenali",Sound:"Suara","Interim Results":"Hasil Sementara"}},28428:function(e){e.exports={newline:"nuova riga",delete:"eliminare",space:"spazio","Speech Recognize":"Discorso Riconoscere",Sound:"Suono","Interim Results":"Risultati intermedi"}},25363:function(e){e.exports={newline:"改行",delete:"削除",space:"スペース","Speech Recognize":"音声認識",Sound:"音","Interim Results":"中間結果"}},96929:function(e){e.exports={newline:"줄 바꿈",delete:"삭제",space:"공간","Speech Recognize":"음성 인식",Sound:"소리","Interim Results":"중간 결과"}},26781:function(e){e.exports={newline:"Шинэ мөр",delete:"Устгах",space:"Зай","Speech Recognize":"Дуу хоолой таних",Sound:"Дуу","Interim Results":"Түр зуурын үр дүн"}},58499:function(e){e.exports={newline:"regel",delete:"verwijderen",space:"ruimte","Speech Recognize":"Spraak Herkennen",Sound:"Geluid","Interim Results":"Tussentijdse Resultaten"}},59430:function(e){e.exports={newline:"newline",delete:"usunąć",space:"przestrzeń","Speech Recognize":"Rozpoznawanie Mowy",Sound:"Dźwięk","Interim Results":"Wyniki Okresowe"}},70297:function(e){e.exports={newline:"linha",delete:"excluir",space:"espaco","Speech Recognize":"Discurso Reconhecer",Sound:"Som","Interim Results":"Resultados Provisórios"}},98949:function(e){e.exports={newline:"новая строка|перенос|энтер",delete:"удалить",space:"пробел","Speech Recognize":"Распознавание речи",Sound:"Звук","Interim Results":"Промежуточные результаты"}},61232:function(e){e.exports={newline:"yeni satır",delete:"silmek",space:"uzay","Speech Recognize":"Konuşma Tanıma",Sound:"Ses","Interim Results":"Ara Sonuçlar"}},56775:function(e){e.exports={newline:"新行",delete:"删除",space:"空间","Speech Recognize":"言语识别",Sound:"声音","Interim Results":"中期业绩"}},97957:function(e){e.exports={newline:"นิวไลน์",delete:"ลบ",space:"พื้นที่","Speech Recognize":"การรับรู้คำพูด",Sound:"เสียง","Interim Results":"ผลระหว่างกาล"}},55106:function(e){e.exports='<svg viewBox="0 0 16 16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <path d="M8,11c1.657,0,3-1.343,3-3V3c0-1.657-1.343-3-3-3S5,1.343,5,3v5C5,9.657,6.343,11,8,11z"/> <path d="M13,8V6h-1l0,1.844c0,1.92-1.282,3.688-3.164,4.071C6.266,12.438,4,10.479,4,8V6H3v2c0,2.414,1.721,4.434,4,4.899V15H5v1h6 v-1H9v-2.101C11.279,12.434,13,10.414,13,8z"/> </svg>'}},function(e){return e(e.s=29204)}])}));
|
|
10
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[781],{57998:function(e){"use strict";e.exports={newline:"الخط الجديد",delete:"حذف",space:"الفضاء","Speech Recognize":"التعرف على الكلام",Sound:"الصوت","Interim Results":"النتائج المؤقتة"}},90833:function(e){"use strict";e.exports={newline:"řádek",delete:"odstranit",space:"prostora","Speech Recognize":"Rozpoznání Řeči",Sound:"Zvuk","Interim Results":"Průběžné Výsledky"}},36373:function(e){"use strict";e.exports={newline:"Zeilenumbruch",delete:"löschen",space:"Raum","Speech Recognize":"Sprache Erkennen",Sound:"Sound","Interim Results":"Zwischenergebnis"}},97192:function(e){"use strict";e.exports={newline:"nueva línea",delete:"eliminar",space:"espacio","Speech Recognize":"Reconocimiento de Voz",Sound:"Sonido","Interim Results":"Resultados Provisionales"}},6043:function(e){"use strict";e.exports={newline:"خط جدید",delete:"حذف",space:"فضا","Speech Recognize":"گفتار را تشخیص دهید",Sound:"صدا","Interim Results":"نتایج موقت"}},76305:function(e){"use strict";e.exports={newline:"nouvelle ligne",delete:"supprimer",space:"espace","Speech Recognize":"Reconnaissance Vocale",Sound:"Son","Interim Results":"Résultats Intermédiaires"}},45834:function(e){"use strict";e.exports={newline:"חדשות",delete:"מחק",space:"שטח","Speech Recognize":"דיבור מזהה",Sound:"קול","Interim Results":"תוצאות ביניים"}},40509:function(e){"use strict";e.exports={newline:"újsor",delete:"törlés",space:"tér","Speech Recognize":"A Beszéd Felismeri",Sound:"Hang","Interim Results":"Időközi Eredmények"}},75720:function(e){"use strict";e.exports={newline:"newline",delete:"Hapus",space:"ruang","Speech Recognize":"Pidato Mengenali",Sound:"Suara","Interim Results":"Hasil Sementara"}},88369:function(e){"use strict";e.exports={newline:"nuova riga",delete:"eliminare",space:"spazio","Speech Recognize":"Discorso Riconoscere",Sound:"Suono","Interim Results":"Risultati intermedi"}},30878:function(e){"use strict";e.exports={newline:"改行",delete:"削除",space:"スペース","Speech Recognize":"音声認識",Sound:"音","Interim Results":"中間結果"}},37780:function(e){"use strict";e.exports={newline:"줄 바꿈",delete:"삭제",space:"공간","Speech Recognize":"음성 인식",Sound:"소리","Interim Results":"중간 결과"}},4105:function(e){"use strict";e.exports={newline:"Шинэ мөр",delete:"Устгах",space:"Зай","Speech Recognize":"Дуу хоолой таних",Sound:"Дуу","Interim Results":"Түр зуурын үр дүн"}},2589:function(e){"use strict";e.exports={newline:"regel",delete:"verwijderen",space:"ruimte","Speech Recognize":"Spraak Herkennen",Sound:"Geluid","Interim Results":"Tussentijdse Resultaten"}},72556:function(e){"use strict";e.exports={newline:"newline",delete:"usunąć",space:"przestrzeń","Speech Recognize":"Rozpoznawanie Mowy",Sound:"Dźwięk","Interim Results":"Wyniki Okresowe"}},11695:function(e){"use strict";e.exports={newline:"linha",delete:"excluir",space:"espaco","Speech Recognize":"Discurso Reconhecer",Sound:"Som","Interim Results":"Resultados Provisórios"}},52415:function(e){"use strict";e.exports={newline:"новая строка|перенос|энтер",delete:"удалить",space:"пробел","Speech Recognize":"Распознавание речи",Sound:"Звук","Interim Results":"Промежуточные результаты"}},14569:function(e){"use strict";e.exports={newline:"yeni satır",delete:"silmek",space:"uzay","Speech Recognize":"Konuşma Tanıma",Sound:"Ses","Interim Results":"Ara Sonuçlar"}},58649:function(e){"use strict";e.exports={newline:"新行",delete:"删除",space:"空间","Speech Recognize":"言语识别",Sound:"声音","Interim Results":"中期业绩"}},66040:function(e){"use strict";e.exports={newline:"นิวไลน์",delete:"ลบ",space:"พื้นที่","Speech Recognize":"การรับรู้คำพูด",Sound:"เสียง","Interim Results":"ผลระหว่างกาล"}},29204:function(e,t,n){"use strict";n.r(t),n.d(t,{SpeechRecognizeNative:function(){return M}});var i={};n.r(i),n.d(i,{ar:function(){return l},cs_cz:function(){return d},de:function(){return h},es:function(){return f},fa:function(){return m},fr:function(){return g},he:function(){return R},hu:function(){return _},id:function(){return S},it:function(){return v},ja:function(){return w},ko:function(){return z},mn:function(){return y},nl:function(){return b},pl:function(){return x},pt_br:function(){return k},ru:function(){return T},tr:function(){return E},zh_cn:function(){return I},zh_tw:function(){return P}});var o=n(85699),s=n(7331),r=n(69082),c=n(87398),u=n(79102),a=n(9162),p=n(62294),l=n(57998),d=n(90833),h=n(36373),f=n(97192),m=n(6043),g=n(76305),R=n(45834),_=n(40509),S=n(75720),v=n(88369),w=n(30878),z=n(37780),y=n(4105),b=n(2589),x=n(72556),k=n(11695),T=n(52415),E=n(14569),I=n(58649),P=n(66040),j=n(37446),C=n(25920),q=n(88751),V=n(30052),A=n(3569),D=n(98928),H=function(e){function t(t,i){var o=e.call(this)||this;return o.async=t,o._continuous=!1,o._interimResults=!1,o.sound=!0,o._isEnabled=!1,o._restartTimeout=0,o._onSpeechStart=function(e){o._isEnabled&&(o.async.clearTimeout(o._restartTimeout),o._restartTimeout=o.async.setTimeout((function(){o.restart(),o.emit("pulse",!1),o._makeSound(940)}),5e3),o.emit("pulse",!0))},o._progressTimeout=0,o._api=i,n._instances.add(o),o}var n;return(0,o.ZT)(t,e),n=t,Object.defineProperty(t.prototype,"lang",{get:function(){return this._lang},set:function(e){this._lang=e,this._api.lang=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"continuous",{get:function(){return this._continuous},set:function(e){this._continuous=e,this._api.continuous=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"interimResults",{get:function(){return this._interimResults},set:function(e){this._interimResults=e,this._api.interimResults=e},enumerable:!1,configurable:!0}),t.prototype.destruct=function(){this.stop(),n._instances.delete(this),e.prototype.destruct.call(this)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},enumerable:!1,configurable:!0}),t.prototype.start=function(){var e=this;this._isEnabled||(this._isEnabled=!0,n._instances.forEach((function(t){t!==e&&t.stop()})),this._api.start(),this.__on("speechstart",this._onSpeechStart).__on("error",this._onError).__on("result",this._onResult))},t.prototype.stop=function(){if(this._isEnabled){try{this._api.abort(),this._api.stop()}catch(e){}this.__off("speechstart",this._onSpeechStart).__off("error",this._onError).__off("result",this._onResult),this.async.clearTimeout(this._restartTimeout),this._isEnabled=!1,this.emit("pulse",!1)}},t.prototype.toggle=function(){this._isEnabled?this.stop():this.start()},t.prototype.restart=function(){this.stop(),this.start()},t.prototype.__on=function(e,t){return this._api.addEventListener(e,t),this},t.prototype.__off=function(e,t){return this._api.removeEventListener(e,t),this},t.prototype._onResult=function(e){var t=this;if(this._isEnabled){this.async.clearTimeout(this._progressTimeout);var n=e.results.item(e.resultIndex),i=n.item(0).transcript,o=function(){try{t.async.clearTimeout(t._restartTimeout),t.emit("result",i)}catch(e){}t.restart(),t.emit("pulse",!1),t._makeSound(440)};if(!1===n.isFinal)return this.emit("progress",i),void(this._progressTimeout=this.async.setTimeout(o,500));o()}},t.prototype._onError=function(){this._isEnabled&&(this._makeSound(940),this.emit("pulse",!1),this.restart())},t.prototype._makeSound=function(e){this.sound&&function(e){var t=void 0===e?{}:e,n=t.sec,i=void 0===n?.1:n,o=t.frequency,s=void 0===o?440:o,r=t.gain,c=void 0===r?.1:r,u=t.type,a=void 0===u?"sine":u;if(void 0!==window.AudioContext||void 0!==window.webkitAudioContext){var p=new(window.AudioContext||window.webkitAudioContext),l=p.createGain(),d=p.createOscillator();d.type=a,d.frequency.value=s,d.connect(l),l.connect(p.destination),d.start(),d.stop(p.currentTime+i),l.gain.value=c}}({frequency:e})},t._instances=new Set,n=(0,o.gn)([D.autobind],t)}(A.a),O=window.SpeechRecognition||window.webkitSpeechRecognition,W=n(55106),L=n.n(W);j.D.prototype.speechRecognize={api:O,sound:!0,continuous:!0,interimResults:!0,commands:{"newline|enter":"enter","delete|remove word|delete word":"backspaceWordButton",comma:"inserthtml::,",underline:"inserthtml::_",hyphen:"inserthtml::-",space:"inserthtml:: ",question:"inserthtml::?",dot:"inserthtml::.","quote|quotes|open quote":"inserthtml::'","header|header h1":"formatblock::h1","select all":"selectall"}},V.J.set("speech-recognize",L()),j.D.prototype.controls.speechRecognize={isActive:function(e,t){var n=(0,C.q)(e,"speech");return Boolean(null==n?void 0:n.isEnabled)},isDisabled:function(e){return!e.o.speechRecognize.api},exec:function(e,t,n){var i=n.button,o=n.control,s=e.o.speechRecognize,r=s.api,c=s.lang,u=s.continuous,a=s.interimResults,p=s.sound;if(r){var l=(0,C.q)(e,"speech");if(!l){var d=new r;(l=new H(e.async,d)).lang=c,l.continuous=u,l.interimResults=a,l.sound=p,(0,C.q)(e,"speech",l),l.on("pulse",(function(e){i.setMod("pulse",e)})),l.on("result",(function(t){return e.e.fire("speechRecognizeResult",t)})),l.on("progress",(function(t){return e.e.fire("speechRecognizeProgressResult",t)})),i.hookStatus("beforeDestruct",(function(){l.destruct()}))}if(o.args){var h=o.args[0];if((0,q.j)(l[h]))return l[h]=!l[h],void(l.isEnabled&&l.restart())}l.toggle(),i.state.activated=l.isEnabled}else e.alert("Speech recognize API unsupported in your browser")},name:"speechRecognize",command:"toggleSpeechRecognize",tooltip:"Speech Recognize",list:{sound:"Sound",interimResults:"Interim Results"},childTemplate:function(e,t,n){var i,o=(0,C.q)(e,"speech"),s=null!==(i=null==o?void 0:o[t])&&void 0!==i?i:e.o.speechRecognize[t];return"<span class='jodit-speech-recognize__list-item'><input ".concat(s?"checked":""," class='jodit-checkbox' type='checkbox'> ").concat(n,"</span>")},mods:{stroke:!1}};var M=function(e){function t(t){var n=e.call(this,t)||this;return n._commandToWord={},t.o.speechRecognize.api&&t.registerButton({group:"state",name:"speechRecognize"}),n}return(0,o.ZT)(t,e),t.prototype.afterInit=function(e){var t=this,n=e.o.speechRecognize.commands;n&&((0,u.xl)(i),(0,c.XP)(n,!1).forEach((function(i){i.split("|").forEach((function(o){o=o.trim().toLowerCase(),t._commandToWord[o]=n[i];var s=e.i18n(o);s!==o&&s.split("|").forEach((function(e){t._commandToWord[e.trim().toLowerCase()]=n[i].trim()}))}))})))},t.prototype.beforeDestruct=function(e){},t.prototype.onSpeechRecognizeProgressResult=function(e){var t=this;this.messagePopup||(this.messagePopup=this.j.create.div("jodit-speech-recognize__popup")),this.j.workplace.appendChild(this.messagePopup),this.j.async.setTimeout((function(){a.i.safeRemove(t.messagePopup)}),{label:"onSpeechRecognizeProgressResult",timeout:1e3}),this.messagePopup.innerText=e+"|"},t.prototype.onSpeechRecognizeResult=function(e){var t=this.j,n=t.s;if(a.i.safeRemove(this.messagePopup),!this._checkCommand(e)){var i=n.range,o=n.current();if(n.isCollapsed()&&a.i.isText(o)&&a.i.isOrContains(t.editor,o)&&o.nodeValue){var s=o.nodeValue;o.nodeValue=s+(/[\u00A0 ]\uFEFF*$/.test(s)?"":" ")+e,i.setStartAfter(o),n.selectRange(i),t.synchronizeValues()}else n.insertHTML(e)}},t.prototype._checkCommand=function(e){return e=e.toLowerCase().replace(/\./g,""),!!this._commandToWord[e]&&(t=this.j,n=(0,o.CR)(this._commandToWord[e].split("::"),2),t.execCommand(n[0],null,n[1]),!0);var t,n},(0,o.gn)([(0,r.YP)(":speechRecognizeProgressResult"),(0,p.D)()],t.prototype,"onSpeechRecognizeProgressResult",null),(0,o.gn)([(0,r.YP)(":speechRecognizeResult")],t.prototype,"onSpeechRecognizeResult",null),t}(s.S);"undefined"!=typeof Jodit&&Jodit.plugins.add("speech-recognize",M)},55106:function(e){e.exports='<svg viewBox="0 0 16 16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <path d="M8,11c1.657,0,3-1.343,3-3V3c0-1.657-1.343-3-3-3S5,1.343,5,3v5C5,9.657,6.343,11,8,11z"/> <path d="M13,8V6h-1l0,1.844c0,1.92-1.282,3.688-3.164,4.071C6.266,12.438,4,10.479,4,8V6H3v2c0,2.414,1.721,4.434,4,4.899V15H5v1h6 v-1H9v-2.101C11.279,12.434,13,10.414,13,8z"/> </svg>'}},function(e){return e(e.s=29204)}])}));
|
package/esm/config.js
CHANGED
|
@@ -8,7 +8,7 @@ import { INSERT_AS_HTML } from "./core/constants.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Default Editor's Configuration
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
class Config {
|
|
12
12
|
constructor() {
|
|
13
13
|
/**
|
|
14
14
|
* Use cache for heavy methods
|
|
@@ -896,3 +896,4 @@ export class Config {
|
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
898
|
Config.prototype.controls = {};
|
|
899
|
+
export { Config };
|
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.0.0-beta.
|
|
6
|
+
export const APP_VERSION = "4.0.0-beta.49";
|
|
7
7
|
// eslint-disable-next-line prettier/prettier
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
* @module plugins/preview
|
|
10
10
|
*/
|
|
11
|
-
import { Config } from "../../config.js";
|
|
12
11
|
import { MODE_SOURCE, MODE_WYSIWYG } from "../../core/constants.js";
|
|
13
12
|
import { previewBox } from "../../core/helpers/utils/print.js";
|
|
14
13
|
import { pluginSystem } from "../../core/global.js";
|
|
14
|
+
import { Config } from "../../config.js";
|
|
15
15
|
Config.prototype.controls.preview = {
|
|
16
16
|
icon: 'eye',
|
|
17
17
|
command: 'preview',
|
package/package.json
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { IExtraPlugin, IDictionary, IViewOptions, NodeFunction, Attributes,
|
|
|
10
10
|
/**
|
|
11
11
|
* Default Editor's Configuration
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
declare class Config implements IViewOptions {
|
|
14
14
|
/**
|
|
15
15
|
* Use cache for heavy methods
|
|
16
16
|
*/
|
|
@@ -635,3 +635,4 @@ export declare class Config implements IViewOptions {
|
|
|
635
635
|
private static __defaultOptions;
|
|
636
636
|
static get defaultOptions(): Config;
|
|
637
637
|
}
|
|
638
|
+
export { Config };
|
package/types/tsconfig.json
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ts-node": {
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"resolveJsonModule": true
|
|
7
|
-
}
|
|
8
|
-
},
|
|
9
2
|
"compilerOptions": {
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"declarationDir": "types",
|
|
12
|
-
"outDir": "types",
|
|
13
3
|
"target": "es5",
|
|
14
4
|
"module": "ESNext",
|
|
15
5
|
"moduleResolution": "node",
|
|
@@ -51,14 +41,6 @@
|
|
|
51
41
|
"jodit/*": ["./src/*"]
|
|
52
42
|
}
|
|
53
43
|
},
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"./index.d.ts",
|
|
57
|
-
"./src/index.ts",
|
|
58
|
-
"./src/typings.d.ts",
|
|
59
|
-
"./src/types/index.d.ts",
|
|
60
|
-
"./src/polyfills.ts",
|
|
61
|
-
"./src/plugins/speech-recognize/speech-recognize.ts",
|
|
62
|
-
"./src/plugins/source/editor/engines/custom.ts"
|
|
63
|
-
]
|
|
44
|
+
"exclude": ["tools/**/*"],
|
|
45
|
+
"include": ["./src/index.ts", "./src/typings.d.ts", "./index.d.ts"]
|
|
64
46
|
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
import { SourceEditor } from "../sourceEditor.js";
|
|
7
|
-
export class CustomEditor extends SourceEditor {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.isFocused = false;
|
|
11
|
-
}
|
|
12
|
-
blur() { }
|
|
13
|
-
init() {
|
|
14
|
-
this.onReady();
|
|
15
|
-
}
|
|
16
|
-
destruct() { }
|
|
17
|
-
getValue() {
|
|
18
|
-
return '';
|
|
19
|
-
}
|
|
20
|
-
setValue(raw) { }
|
|
21
|
-
insertRaw(raw) { }
|
|
22
|
-
getSelectionStart() {
|
|
23
|
-
return 0;
|
|
24
|
-
}
|
|
25
|
-
getSelectionEnd() {
|
|
26
|
-
return 0;
|
|
27
|
-
}
|
|
28
|
-
setSelectionRange(start, end) { }
|
|
29
|
-
focus() { }
|
|
30
|
-
setPlaceHolder(title) { }
|
|
31
|
-
setReadOnly(isReadOnly) { }
|
|
32
|
-
selectAll() { }
|
|
33
|
-
replaceUndoManager() { }
|
|
34
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
import { Config } from "../../config.js";
|
|
7
|
-
import { dataBind } from "../../core/helpers/utils/data-bind.js";
|
|
8
|
-
import { isBoolean } from "../../core/helpers/checker/is-boolean.js";
|
|
9
|
-
import { Icon } from "../../core/ui/icon.js";
|
|
10
|
-
import { RecognizeManager } from "./helpers/recognize-manager.js";
|
|
11
|
-
import { SpeechRecognition } from "./helpers/api.js";
|
|
12
|
-
import speechRecognizeIcon from "./speech-recognize.svg.js";
|
|
13
|
-
Config.prototype.speechRecognize = {
|
|
14
|
-
api: SpeechRecognition,
|
|
15
|
-
sound: true,
|
|
16
|
-
continuous: true,
|
|
17
|
-
interimResults: true,
|
|
18
|
-
commands: {
|
|
19
|
-
'newline|enter': 'enter',
|
|
20
|
-
'delete|remove word|delete word': 'backspaceWordButton',
|
|
21
|
-
comma: 'inserthtml::,',
|
|
22
|
-
underline: 'inserthtml::_',
|
|
23
|
-
hyphen: 'inserthtml::-',
|
|
24
|
-
space: 'inserthtml:: ',
|
|
25
|
-
question: 'inserthtml::?',
|
|
26
|
-
dot: 'inserthtml::.',
|
|
27
|
-
'quote|quotes|open quote': "inserthtml::'",
|
|
28
|
-
'header|header h1': 'formatblock::h1',
|
|
29
|
-
'select all': 'selectall'
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
Icon.set('speech-recognize', speechRecognizeIcon);
|
|
33
|
-
Config.prototype.controls.speechRecognize = {
|
|
34
|
-
isActive(jodit, _) {
|
|
35
|
-
const api = dataBind(jodit, 'speech');
|
|
36
|
-
return Boolean(api?.isEnabled);
|
|
37
|
-
},
|
|
38
|
-
isDisabled(jodit) {
|
|
39
|
-
return !jodit.o.speechRecognize.api;
|
|
40
|
-
},
|
|
41
|
-
exec(jodit, current, { button, control }) {
|
|
42
|
-
const { api: Api, lang, continuous, interimResults, sound } = jodit.o.speechRecognize;
|
|
43
|
-
if (!Api) {
|
|
44
|
-
jodit.alert('Speech recognize API unsupported in your browser');
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
let api = dataBind(jodit, 'speech');
|
|
48
|
-
if (!api) {
|
|
49
|
-
const nativeApi = new Api();
|
|
50
|
-
api = new RecognizeManager(jodit.async, nativeApi);
|
|
51
|
-
api.lang = lang;
|
|
52
|
-
api.continuous = continuous;
|
|
53
|
-
api.interimResults = interimResults;
|
|
54
|
-
api.sound = sound;
|
|
55
|
-
dataBind(jodit, 'speech', api);
|
|
56
|
-
api.on('pulse', (enable) => {
|
|
57
|
-
button.setMod('pulse', enable);
|
|
58
|
-
});
|
|
59
|
-
api.on('result', (text) => jodit.e.fire('speechRecognizeResult', text));
|
|
60
|
-
api.on('progress', (text) => jodit.e.fire('speechRecognizeProgressResult', text));
|
|
61
|
-
button.hookStatus('beforeDestruct', () => {
|
|
62
|
-
api.destruct();
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if (control.args) {
|
|
66
|
-
const key = control.args[0];
|
|
67
|
-
if (isBoolean(api[key])) {
|
|
68
|
-
api[key] = !api[key];
|
|
69
|
-
if (api.isEnabled) {
|
|
70
|
-
api.restart();
|
|
71
|
-
}
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
api.toggle();
|
|
76
|
-
button.state.activated = api.isEnabled;
|
|
77
|
-
},
|
|
78
|
-
name: 'speechRecognize',
|
|
79
|
-
command: 'toggleSpeechRecognize',
|
|
80
|
-
tooltip: 'Speech Recognize',
|
|
81
|
-
list: {
|
|
82
|
-
sound: 'Sound',
|
|
83
|
-
interimResults: 'Interim Results'
|
|
84
|
-
},
|
|
85
|
-
childTemplate(jodit, key, value) {
|
|
86
|
-
const api = dataBind(jodit, 'speech'), checked = api?.[key] ?? jodit.o.speechRecognize[key];
|
|
87
|
-
return `<span class='jodit-speech-recognize__list-item'><input ${checked ? 'checked' : ''} class='jodit-checkbox' type='checkbox'> ${value}</span>`;
|
|
88
|
-
},
|
|
89
|
-
mods: {
|
|
90
|
-
stroke: false
|
|
91
|
-
}
|
|
92
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @module plugins/speech-recognize
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export const PII = 440;
|
|
11
|
-
export const WARN = 940;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
export const SpeechRecognition = window.SpeechRecognition ||
|
|
7
|
-
window.webkitSpeechRecognition;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
export function execSpellCommand(jodit, commandSentence) {
|
|
7
|
-
const [command, value] = commandSentence.split('::');
|
|
8
|
-
jodit.execCommand(command, null, value);
|
|
9
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
10
|
-
else
|
|
11
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
12
|
-
if (d = decorators[i])
|
|
13
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
-
};
|
|
16
|
-
var RecognizeManager_1;
|
|
17
|
-
import { Eventify } from "../../../core/event-emitter/eventify.js";
|
|
18
|
-
import { autobind } from "../../../core/decorators/index.js";
|
|
19
|
-
import { PII, WARN } from "../constants.js";
|
|
20
|
-
import { sound } from "./sound.js";
|
|
21
|
-
let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends Eventify {
|
|
22
|
-
set lang(v) {
|
|
23
|
-
this._lang = v;
|
|
24
|
-
this._api.lang = v;
|
|
25
|
-
}
|
|
26
|
-
get lang() {
|
|
27
|
-
return this._lang;
|
|
28
|
-
}
|
|
29
|
-
set continuous(v) {
|
|
30
|
-
this._continuous = v;
|
|
31
|
-
this._api.continuous = v;
|
|
32
|
-
}
|
|
33
|
-
get continuous() {
|
|
34
|
-
return this._continuous;
|
|
35
|
-
}
|
|
36
|
-
set interimResults(v) {
|
|
37
|
-
this._interimResults = v;
|
|
38
|
-
this._api.interimResults = v;
|
|
39
|
-
}
|
|
40
|
-
get interimResults() {
|
|
41
|
-
return this._interimResults;
|
|
42
|
-
}
|
|
43
|
-
constructor(async, api) {
|
|
44
|
-
super();
|
|
45
|
-
this.async = async;
|
|
46
|
-
this._continuous = false;
|
|
47
|
-
this._interimResults = false;
|
|
48
|
-
this.sound = true;
|
|
49
|
-
this._isEnabled = false;
|
|
50
|
-
this._restartTimeout = 0;
|
|
51
|
-
this._onSpeechStart = (e) => {
|
|
52
|
-
if (!this._isEnabled) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
this.async.clearTimeout(this._restartTimeout);
|
|
56
|
-
this._restartTimeout = this.async.setTimeout(() => {
|
|
57
|
-
this.restart();
|
|
58
|
-
this.emit('pulse', false);
|
|
59
|
-
this._makeSound(WARN);
|
|
60
|
-
}, 5000);
|
|
61
|
-
this.emit('pulse', true);
|
|
62
|
-
};
|
|
63
|
-
this._progressTimeout = 0;
|
|
64
|
-
this._api = api;
|
|
65
|
-
RecognizeManager_1._instances.add(this);
|
|
66
|
-
}
|
|
67
|
-
destruct() {
|
|
68
|
-
this.stop();
|
|
69
|
-
RecognizeManager_1._instances.delete(this);
|
|
70
|
-
super.destruct();
|
|
71
|
-
}
|
|
72
|
-
get isEnabled() {
|
|
73
|
-
return this._isEnabled;
|
|
74
|
-
}
|
|
75
|
-
start() {
|
|
76
|
-
if (this._isEnabled) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
this._isEnabled = true;
|
|
80
|
-
RecognizeManager_1._instances.forEach(instance => {
|
|
81
|
-
if (instance !== this) {
|
|
82
|
-
instance.stop();
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
this._api.start();
|
|
86
|
-
this.__on('speechstart', this._onSpeechStart)
|
|
87
|
-
.__on('error', this._onError)
|
|
88
|
-
.__on('result', this._onResult);
|
|
89
|
-
}
|
|
90
|
-
stop() {
|
|
91
|
-
if (!this._isEnabled) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
this._api.abort();
|
|
96
|
-
this._api.stop();
|
|
97
|
-
}
|
|
98
|
-
catch { }
|
|
99
|
-
this.__off('speechstart', this._onSpeechStart)
|
|
100
|
-
.__off('error', this._onError)
|
|
101
|
-
.__off('result', this._onResult);
|
|
102
|
-
this.async.clearTimeout(this._restartTimeout);
|
|
103
|
-
this._isEnabled = false;
|
|
104
|
-
this.emit('pulse', false);
|
|
105
|
-
}
|
|
106
|
-
toggle() {
|
|
107
|
-
if (!this._isEnabled) {
|
|
108
|
-
this.start();
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
this.stop();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
restart() {
|
|
115
|
-
this.stop();
|
|
116
|
-
this.start();
|
|
117
|
-
}
|
|
118
|
-
__on(event, callback) {
|
|
119
|
-
this._api.addEventListener(event, callback);
|
|
120
|
-
return this;
|
|
121
|
-
}
|
|
122
|
-
__off(event, callback) {
|
|
123
|
-
this._api.removeEventListener(event, callback);
|
|
124
|
-
return this;
|
|
125
|
-
}
|
|
126
|
-
_onResult(e) {
|
|
127
|
-
if (!this._isEnabled) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
this.async.clearTimeout(this._progressTimeout);
|
|
131
|
-
const resultItem = e.results.item(e.resultIndex);
|
|
132
|
-
const { transcript } = resultItem.item(0);
|
|
133
|
-
const resultHandler = () => {
|
|
134
|
-
try {
|
|
135
|
-
this.async.clearTimeout(this._restartTimeout);
|
|
136
|
-
this.emit('result', transcript);
|
|
137
|
-
}
|
|
138
|
-
catch { }
|
|
139
|
-
this.restart();
|
|
140
|
-
this.emit('pulse', false);
|
|
141
|
-
this._makeSound(PII);
|
|
142
|
-
};
|
|
143
|
-
if (resultItem.isFinal === false) {
|
|
144
|
-
this.emit('progress', transcript);
|
|
145
|
-
this._progressTimeout = this.async.setTimeout(resultHandler, 500);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
resultHandler();
|
|
149
|
-
}
|
|
150
|
-
_onError() {
|
|
151
|
-
if (!this._isEnabled) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
this._makeSound(WARN);
|
|
155
|
-
this.emit('pulse', false);
|
|
156
|
-
this.restart();
|
|
157
|
-
}
|
|
158
|
-
_makeSound(frequency) {
|
|
159
|
-
if (this.sound) {
|
|
160
|
-
sound({ frequency });
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
RecognizeManager._instances = new Set();
|
|
165
|
-
RecognizeManager = RecognizeManager_1 = __decorate([
|
|
166
|
-
autobind
|
|
167
|
-
], RecognizeManager);
|
|
168
|
-
export { RecognizeManager };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @module plugins/speech-recognize
|
|
8
|
-
*/
|
|
9
|
-
import { PII } from "../constants.js";
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export function sound({ sec = 0.1, frequency = PII, gain = 0.1, type = 'sine' } = {}) {
|
|
14
|
-
if (typeof window.AudioContext === 'undefined' &&
|
|
15
|
-
typeof window.webkitAudioContext === 'undefined') {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
// one context per document
|
|
19
|
-
const context = new (window.AudioContext ||
|
|
20
|
-
window.webkitAudioContext)();
|
|
21
|
-
const vol = context.createGain();
|
|
22
|
-
const osc = context.createOscillator();
|
|
23
|
-
osc.type = type;
|
|
24
|
-
osc.frequency.value = frequency; // Hz
|
|
25
|
-
osc.connect(vol);
|
|
26
|
-
vol.connect(context.destination);
|
|
27
|
-
osc.start(); // start the oscillator
|
|
28
|
-
osc.stop(context.currentTime + sec);
|
|
29
|
-
vol.gain.value = gain;
|
|
30
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
4
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
5
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
newline: 'الخط الجديد',
|
|
9
|
-
delete: 'حذف',
|
|
10
|
-
space: 'الفضاء',
|
|
11
|
-
'Speech Recognize': 'التعرف على الكلام',
|
|
12
|
-
Sound: 'الصوت',
|
|
13
|
-
'Interim Results': 'النتائج المؤقتة'
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
4
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
5
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
newline: 'řádek',
|
|
9
|
-
delete: 'odstranit',
|
|
10
|
-
space: 'prostora',
|
|
11
|
-
'Speech Recognize': 'Rozpoznání Řeči',
|
|
12
|
-
Sound: 'Zvuk',
|
|
13
|
-
'Interim Results': 'Průběžné Výsledky'
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
4
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
5
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
newline: 'Zeilenumbruch',
|
|
9
|
-
delete: 'löschen',
|
|
10
|
-
space: 'Raum',
|
|
11
|
-
'Speech Recognize': 'Sprache Erkennen',
|
|
12
|
-
Sound: 'Sound',
|
|
13
|
-
'Interim Results': 'Zwischenergebnis'
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
4
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
5
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
newline: 'nueva línea',
|
|
9
|
-
delete: 'eliminar',
|
|
10
|
-
space: 'espacio',
|
|
11
|
-
'Speech Recognize': 'Reconocimiento de Voz',
|
|
12
|
-
Sound: 'Sonido',
|
|
13
|
-
'Interim Results': 'Resultados Provisionales'
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
4
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
5
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
newline: 'خط جدید',
|
|
9
|
-
delete: 'حذف',
|
|
10
|
-
space: 'فضا',
|
|
11
|
-
'Speech Recognize': 'گفتار را تشخیص دهید',
|
|
12
|
-
Sound: 'صدا',
|
|
13
|
-
'Interim Results': 'نتایج موقت'
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
4
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
5
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
newline: 'nouvelle ligne',
|
|
9
|
-
delete: 'supprimer',
|
|
10
|
-
space: 'espace',
|
|
11
|
-
'Speech Recognize': 'Reconnaissance Vocale',
|
|
12
|
-
Sound: 'Son',
|
|
13
|
-
'Interim Results': 'Résultats Intermédiaires'
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
4
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
5
|
-
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
newline: 'חדשות',
|
|
9
|
-
delete: 'מחק',
|
|
10
|
-
space: 'שטח',
|
|
11
|
-
'Speech Recognize': 'דיבור מזהה',
|
|
12
|
-
Sound: 'קול',
|
|
13
|
-
'Interim Results': 'תוצאות ביניים'
|
|
14
|
-
};
|