jodit 4.2.21 → 4.2.22
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/CHANGELOG.md +9 -5
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +2 -2
- 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 +3 -2
- package/es2015/plugins/speech-recognize/speech-recognize.js +98 -77
- package/es2015/plugins/speech-recognize/speech-recognize.min.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es2018/jodit.css +1 -1
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +2 -2
- 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 +3 -2
- package/es2018/plugins/speech-recognize/speech-recognize.js +98 -77
- package/es2018/plugins/speech-recognize/speech-recognize.min.css +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +2 -2
- 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 +3 -2
- package/es2021/plugins/speech-recognize/speech-recognize.js +98 -77
- package/es2021/plugins/speech-recognize/speech-recognize.min.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +2 -2
- 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 +3 -2
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +98 -77
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +2 -2
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +3 -2
- package/es5/plugins/speech-recognize/speech-recognize.js +99 -79
- package/es5/plugins/speech-recognize/speech-recognize.min.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/esm/core/constants.js +1 -1
- package/esm/plugins/speech-recognize/config.d.ts +1 -1
- package/esm/plugins/speech-recognize/config.js +13 -5
- package/esm/plugins/speech-recognize/helpers/recognize-manager.d.ts +3 -2
- package/esm/plugins/speech-recognize/helpers/recognize-manager.js +45 -31
- package/esm/plugins/speech-recognize/interface.d.ts +1 -0
- package/esm/plugins/speech-recognize/speech-recognize.d.ts +5 -1
- package/esm/plugins/speech-recognize/speech-recognize.js +17 -17
- package/package.json +1 -1
- package/types/plugins/speech-recognize/config.d.ts +1 -1
- package/types/plugins/speech-recognize/helpers/recognize-manager.d.ts +3 -2
- package/types/plugins/speech-recognize/interface.d.ts +1 -0
- package/types/plugins/speech-recognize/speech-recognize.d.ts +5 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.2.
|
|
4
|
+
* Version: v4.2.22
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -33,10 +33,11 @@ svg.jodit-icon_speechRecognize {
|
|
|
33
33
|
position: absolute;
|
|
34
34
|
top: 50%;
|
|
35
35
|
left: 50%;
|
|
36
|
-
padding:
|
|
36
|
+
padding: 8px 16px;
|
|
37
37
|
border-radius: 8px;
|
|
38
38
|
background-color: rgba(240, 240, 240, 0.4);
|
|
39
39
|
font-size: 32px;
|
|
40
|
+
line-height: 1.5;
|
|
40
41
|
transform: translate(-50%, -50%);
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.2.
|
|
4
|
+
* Version: v4.2.22
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -43,9 +43,9 @@ return (self["webpackChunkjodit"] = self["webpackChunkjodit"] || []).push([[882]
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.speechRecognize = {
|
|
46
|
-
api: _helpers_api__WEBPACK_IMPORTED_MODULE_3__/* .SpeechRecognition */ .o,
|
|
46
|
+
api: typeof _helpers_api__WEBPACK_IMPORTED_MODULE_3__/* .SpeechRecognition */ .o !== 'undefined' ? _helpers_api__WEBPACK_IMPORTED_MODULE_3__/* .SpeechRecognition */ .o : null,
|
|
47
47
|
sound: true,
|
|
48
|
-
continuous:
|
|
48
|
+
continuous: false,
|
|
49
49
|
interimResults: true,
|
|
50
50
|
commands: {
|
|
51
51
|
'newline|enter': 'enter',
|
|
@@ -63,6 +63,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.speechRecogn
|
|
|
63
63
|
};
|
|
64
64
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__/* .Icon */ .I.set('speech-recognize', (_speech_recognize_svg__WEBPACK_IMPORTED_MODULE_5___default()));
|
|
65
65
|
jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.speechRecognize = {
|
|
66
|
+
isVisible: function (j) {
|
|
67
|
+
return Boolean(j.o.speechRecognize.api);
|
|
68
|
+
},
|
|
66
69
|
isActive: function (jodit, _) {
|
|
67
70
|
var api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_0__/* .dataBind */ .m)(jodit, 'speech');
|
|
68
71
|
return Boolean(api === null || api === void 0 ? void 0 : api.isEnabled);
|
|
@@ -72,14 +75,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
72
75
|
},
|
|
73
76
|
exec: function (jodit, current, _a) {
|
|
74
77
|
var button = _a.button, control = _a.control;
|
|
75
|
-
var _b = jodit.o.speechRecognize,
|
|
76
|
-
if (!
|
|
78
|
+
var _b = jodit.o.speechRecognize, ApiConstructor = _b.api, lang = _b.lang, continuous = _b.continuous, interimResults = _b.interimResults, sound = _b.sound;
|
|
79
|
+
if (!ApiConstructor) {
|
|
77
80
|
jodit.alert('Speech recognize API unsupported in your browser');
|
|
78
81
|
return;
|
|
79
82
|
}
|
|
80
83
|
var api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_0__/* .dataBind */ .m)(jodit, 'speech');
|
|
81
84
|
if (!api) {
|
|
82
|
-
var nativeApi = new
|
|
85
|
+
var nativeApi = new ApiConstructor();
|
|
83
86
|
api = new _helpers_recognize_manager__WEBPACK_IMPORTED_MODULE_4__/* .RecognizeManager */ .g(jodit.async, nativeApi);
|
|
84
87
|
api.lang = lang;
|
|
85
88
|
api.continuous = continuous;
|
|
@@ -95,7 +98,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
95
98
|
api.on('progress', function (text) {
|
|
96
99
|
return jodit.e.fire('speechRecognizeProgressResult', text);
|
|
97
100
|
});
|
|
101
|
+
api.on('error', function (text) { return jodit.message.error(text); });
|
|
98
102
|
button.hookStatus('beforeDestruct', function () {
|
|
103
|
+
(0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_0__/* .dataBind */ .m)(jodit, 'speech', null);
|
|
99
104
|
api.destruct();
|
|
100
105
|
});
|
|
101
106
|
}
|
|
@@ -110,6 +115,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
api.toggle();
|
|
118
|
+
if (api.isEnabled) {
|
|
119
|
+
button.setMod('pulse', true);
|
|
120
|
+
}
|
|
113
121
|
button.state.activated = api.isEnabled;
|
|
114
122
|
},
|
|
115
123
|
name: 'speechRecognize',
|
|
@@ -239,7 +247,7 @@ var RecognizeManager = /** @class */ (function (_super) {
|
|
|
239
247
|
}, 5000);
|
|
240
248
|
_this.emit('pulse', true);
|
|
241
249
|
};
|
|
242
|
-
_this.
|
|
250
|
+
_this.__interimResults = '';
|
|
243
251
|
_this._api = api;
|
|
244
252
|
RecognizeManager_1._instances.add(_this);
|
|
245
253
|
return _this;
|
|
@@ -301,23 +309,29 @@ var RecognizeManager = /** @class */ (function (_super) {
|
|
|
301
309
|
instance.stop();
|
|
302
310
|
}
|
|
303
311
|
});
|
|
304
|
-
|
|
312
|
+
try {
|
|
313
|
+
this._api.start();
|
|
314
|
+
}
|
|
315
|
+
catch (e) {
|
|
316
|
+
this._onError(e);
|
|
317
|
+
this.stop();
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
305
320
|
this.__on('speechstart', this._onSpeechStart)
|
|
306
321
|
.__on('error', this._onError)
|
|
307
|
-
.__on('result', this.
|
|
322
|
+
.__on('result', this._onProgress)
|
|
323
|
+
.__on('end', this._onResults);
|
|
308
324
|
};
|
|
309
325
|
RecognizeManager.prototype.stop = function () {
|
|
310
326
|
if (!this._isEnabled) {
|
|
311
327
|
return;
|
|
312
328
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
this._api.stop();
|
|
316
|
-
}
|
|
317
|
-
catch (_a) { }
|
|
329
|
+
this._api.abort();
|
|
330
|
+
this._api.stop();
|
|
318
331
|
this.__off('speechstart', this._onSpeechStart)
|
|
319
332
|
.__off('error', this._onError)
|
|
320
|
-
.__off('result', this.
|
|
333
|
+
.__off('result', this._onProgress)
|
|
334
|
+
.__off('end', this._onResults);
|
|
321
335
|
this.async.clearTimeout(this._restartTimeout);
|
|
322
336
|
this._isEnabled = false;
|
|
323
337
|
this.emit('pulse', false);
|
|
@@ -342,38 +356,45 @@ var RecognizeManager = /** @class */ (function (_super) {
|
|
|
342
356
|
this._api.removeEventListener(event, callback);
|
|
343
357
|
return this;
|
|
344
358
|
};
|
|
345
|
-
RecognizeManager.prototype.
|
|
346
|
-
|
|
359
|
+
RecognizeManager.prototype._onResults = function (e) {
|
|
360
|
+
this.emit('pulse', false);
|
|
361
|
+
this.emit('result', this.__interimResults);
|
|
362
|
+
this.__interimResults = '';
|
|
363
|
+
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_3__/* .PII */ .N);
|
|
364
|
+
this.restart();
|
|
365
|
+
};
|
|
366
|
+
RecognizeManager.prototype._onProgress = function (e) {
|
|
347
367
|
if (!this._isEnabled) {
|
|
348
368
|
return;
|
|
349
369
|
}
|
|
350
|
-
this.
|
|
351
|
-
|
|
352
|
-
var transcript = resultItem.item(0).transcript;
|
|
353
|
-
var resultHandler = function () {
|
|
354
|
-
try {
|
|
355
|
-
_this.async.clearTimeout(_this._restartTimeout);
|
|
356
|
-
_this.emit('result', transcript);
|
|
357
|
-
}
|
|
358
|
-
catch (_a) { }
|
|
359
|
-
_this.restart();
|
|
360
|
-
_this.emit('pulse', false);
|
|
361
|
-
_this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_3__/* .PII */ .N);
|
|
362
|
-
};
|
|
363
|
-
if (resultItem.isFinal === false) {
|
|
364
|
-
this.emit('progress', transcript);
|
|
365
|
-
this._progressTimeout = this.async.setTimeout(resultHandler, 500);
|
|
370
|
+
this.__interimResults = '';
|
|
371
|
+
if (!e.results) {
|
|
366
372
|
return;
|
|
367
373
|
}
|
|
368
|
-
|
|
374
|
+
for (var i = 0; i < e.results.length; i++) {
|
|
375
|
+
var resultItem = e.results.item(i);
|
|
376
|
+
var transcript = resultItem.item(0).transcript;
|
|
377
|
+
this.__interimResults += transcript;
|
|
378
|
+
}
|
|
379
|
+
if (this.__interimResults) {
|
|
380
|
+
this.emit('progress', this.__interimResults);
|
|
381
|
+
}
|
|
369
382
|
};
|
|
370
|
-
RecognizeManager.prototype._onError = function () {
|
|
371
|
-
if (
|
|
372
|
-
|
|
383
|
+
RecognizeManager.prototype._onError = function (e) {
|
|
384
|
+
if (e.error === 'voice-unavailable') {
|
|
385
|
+
this.emit('error', 'Voice unavailable');
|
|
386
|
+
}
|
|
387
|
+
if (e.error === 'not-allowed') {
|
|
388
|
+
this.emit('error', 'Not allowed');
|
|
389
|
+
}
|
|
390
|
+
if (e.error === 'language-unavailable' ||
|
|
391
|
+
// @ts-ignore
|
|
392
|
+
e.error === 'language-not-supported') {
|
|
393
|
+
this.emit('error', 'Language unavailable');
|
|
373
394
|
}
|
|
374
395
|
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_3__/* .WARN */ .Z);
|
|
375
396
|
this.emit('pulse', false);
|
|
376
|
-
this.
|
|
397
|
+
this.stop();
|
|
377
398
|
};
|
|
378
399
|
RecognizeManager.prototype._makeSound = function (frequency) {
|
|
379
400
|
if (this.sound) {
|
|
@@ -1007,17 +1028,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1007
1028
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1008
1029
|
/* harmony export */ SpeechRecognizeNative: function() { return /* binding */ SpeechRecognizeNative; }
|
|
1009
1030
|
/* harmony export */ });
|
|
1010
|
-
/* harmony import */ var
|
|
1011
|
-
/* harmony import */ var
|
|
1012
|
-
/* harmony import */ var
|
|
1013
|
-
/* harmony import */ var
|
|
1014
|
-
/* harmony import */ var
|
|
1015
|
-
/* harmony import */ var
|
|
1016
|
-
/* harmony import */ var
|
|
1017
|
-
/* harmony import */ var
|
|
1018
|
-
/* harmony import */ var
|
|
1019
|
-
/* harmony import */ var
|
|
1020
|
-
/* harmony import */ var _langs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(25202);
|
|
1031
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(31635);
|
|
1032
|
+
/* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66927);
|
|
1033
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55186);
|
|
1034
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
|
|
1035
|
+
/* harmony import */ var jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84976);
|
|
1036
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71005);
|
|
1037
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(71096);
|
|
1038
|
+
/* harmony import */ var _jodit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46173);
|
|
1039
|
+
/* harmony import */ var _helpers_exec_spell_command__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(50834);
|
|
1040
|
+
/* harmony import */ var _langs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(25202);
|
|
1021
1041
|
/*!
|
|
1022
1042
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
1023
1043
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -1034,26 +1054,25 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1034
1054
|
|
|
1035
1055
|
|
|
1036
1056
|
|
|
1037
|
-
|
|
1038
1057
|
var SpeechRecognizeNative = /** @class */ (function (_super) {
|
|
1039
|
-
(0,
|
|
1040
|
-
function SpeechRecognizeNative(
|
|
1041
|
-
var _this = _super.
|
|
1042
|
-
_this.
|
|
1043
|
-
|
|
1044
|
-
j.registerButton({
|
|
1058
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__extends */ .C6)(SpeechRecognizeNative, _super);
|
|
1059
|
+
function SpeechRecognizeNative() {
|
|
1060
|
+
var _this = _super.apply(this, (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__spreadArray */ .fX)([], (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__read */ .zs)(arguments), false)) || this;
|
|
1061
|
+
_this.buttons = [
|
|
1062
|
+
{
|
|
1045
1063
|
group: 'state',
|
|
1046
1064
|
name: 'speechRecognize'
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1065
|
+
}
|
|
1066
|
+
];
|
|
1067
|
+
_this._commandToWord = {};
|
|
1049
1068
|
return _this;
|
|
1050
1069
|
}
|
|
1051
1070
|
SpeechRecognizeNative.prototype.afterInit = function (jodit) {
|
|
1052
1071
|
var _this = this;
|
|
1053
1072
|
var commands = jodit.o.speechRecognize.commands;
|
|
1054
1073
|
if (commands) {
|
|
1055
|
-
(0,
|
|
1056
|
-
(0,
|
|
1074
|
+
(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .extendLang */ .JW)(_langs__WEBPACK_IMPORTED_MODULE_7__);
|
|
1075
|
+
(0,jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_3__/* .keys */ .HP)(commands, false).forEach(function (words) {
|
|
1057
1076
|
var keys = words.split('|');
|
|
1058
1077
|
keys.forEach(function (key) {
|
|
1059
1078
|
key = key.trim().toLowerCase();
|
|
@@ -1068,29 +1087,31 @@ var SpeechRecognizeNative = /** @class */ (function (_super) {
|
|
|
1068
1087
|
});
|
|
1069
1088
|
}
|
|
1070
1089
|
};
|
|
1071
|
-
SpeechRecognizeNative.prototype.beforeDestruct = function (jodit) {
|
|
1090
|
+
SpeechRecognizeNative.prototype.beforeDestruct = function (jodit) {
|
|
1091
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
1092
|
+
};
|
|
1072
1093
|
SpeechRecognizeNative.prototype.onSpeechRecognizeProgressResult = function (text) {
|
|
1073
1094
|
var _this = this;
|
|
1074
1095
|
if (!this.messagePopup) {
|
|
1075
1096
|
this.messagePopup = this.j.create.div('jodit-speech-recognize__popup');
|
|
1076
1097
|
}
|
|
1077
1098
|
this.j.workplace.appendChild(this.messagePopup);
|
|
1078
|
-
this.j.async.
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
timeout: 1000
|
|
1083
|
-
});
|
|
1099
|
+
this.j.async.clearTimeout(this.__hidePopupTimeout);
|
|
1100
|
+
this.__hidePopupTimeout = this.j.async.setTimeout(function () {
|
|
1101
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(_this.messagePopup);
|
|
1102
|
+
}, 1000);
|
|
1084
1103
|
this.messagePopup.innerText = text + '|';
|
|
1085
1104
|
};
|
|
1086
1105
|
SpeechRecognizeNative.prototype.onSpeechRecognizeResult = function (text) {
|
|
1087
|
-
|
|
1088
|
-
|
|
1106
|
+
this.j.async.clearTimeout(this.__hidePopupTimeout);
|
|
1107
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
1108
|
+
var j = this.j;
|
|
1109
|
+
var s = j.s;
|
|
1089
1110
|
if (!this._checkCommand(text)) {
|
|
1090
1111
|
var range = s.range, node = s.current();
|
|
1091
1112
|
if (s.isCollapsed() &&
|
|
1092
|
-
|
|
1093
|
-
|
|
1113
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(node) &&
|
|
1114
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(j.editor, node) &&
|
|
1094
1115
|
node.nodeValue) {
|
|
1095
1116
|
var sentence = node.nodeValue;
|
|
1096
1117
|
node.nodeValue =
|
|
@@ -1109,22 +1130,21 @@ var SpeechRecognizeNative = /** @class */ (function (_super) {
|
|
|
1109
1130
|
SpeechRecognizeNative.prototype._checkCommand = function (command) {
|
|
1110
1131
|
command = command.toLowerCase().replace(/\./g, '');
|
|
1111
1132
|
if (this._commandToWord[command]) {
|
|
1112
|
-
(0,
|
|
1133
|
+
(0,_helpers_exec_spell_command__WEBPACK_IMPORTED_MODULE_9__/* .execSpellCommand */ .F)(this.j, this._commandToWord[command]);
|
|
1113
1134
|
return true;
|
|
1114
1135
|
}
|
|
1115
1136
|
return false;
|
|
1116
1137
|
};
|
|
1117
|
-
(0,
|
|
1118
|
-
(0,
|
|
1119
|
-
(0,jodit_core_decorators_debounce_debounce__WEBPACK_IMPORTED_MODULE_0__/* .debounce */ .s)()
|
|
1138
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
|
|
1139
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__/* .watch */ .w)(':speechRecognizeProgressResult')
|
|
1120
1140
|
], SpeechRecognizeNative.prototype, "onSpeechRecognizeProgressResult", null);
|
|
1121
|
-
(0,
|
|
1122
|
-
(0,
|
|
1141
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
|
|
1142
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__/* .watch */ .w)(':speechRecognizeResult')
|
|
1123
1143
|
], SpeechRecognizeNative.prototype, "onSpeechRecognizeResult", null);
|
|
1124
1144
|
return SpeechRecognizeNative;
|
|
1125
|
-
}(
|
|
1145
|
+
}(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .k));
|
|
1126
1146
|
|
|
1127
|
-
|
|
1147
|
+
_jodit__WEBPACK_IMPORTED_MODULE_6__/* .Jodit */ .x.plugins.add('speech-recognize', SpeechRecognizeNative);
|
|
1128
1148
|
|
|
1129
1149
|
|
|
1130
1150
|
/***/ }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@keyframes a{0%{fill:green;opacity:.3}to{fill:#4285f4}}svg.jodit-icon_speechRecognize{stroke:none!important}.jodit-toolbar-button_pulse_true svg{animation-duration:.7s;animation-iteration-count:infinite;animation-name:a}.jodit-speech-recognize__list-item{display:flex;padding:var(--jd-padding-default)}.jodit-speech-recognize__popup{background-color:hsla(0,0%,94%,.4);border-radius:8px;font-family:var(--jd-font-default);font-size:var(--jd-font-size-default);font-size:32px;left:50%;padding:
|
|
1
|
+
@keyframes a{0%{fill:green;opacity:.3}to{fill:#4285f4}}svg.jodit-icon_speechRecognize{stroke:none!important}.jodit-toolbar-button_pulse_true svg{animation-duration:.7s;animation-iteration-count:infinite;animation-name:a}.jodit-speech-recognize__list-item{display:flex;padding:var(--jd-padding-default)}.jodit-speech-recognize__popup{background-color:hsla(0,0%,94%,.4);border-radius:8px;font-family:var(--jd-font-default);font-size:var(--jd-font-size-default);font-size:32px;left:50%;line-height:1.5;padding:8px 16px;position:absolute;top:50%;transform:translate(-50%,-50%)}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.2.
|
|
4
|
+
* Version: v4.2.22
|
|
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 i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[882],{71096:function(e,t,n){"use strict";var i=n(9810),o=n(72197),s=n(931),r=n(36115),u=n(71722),c=n(93676),a=n(22227),p=n.n(a);r.T.prototype.speechRecognize={api:u.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"}},s.I.set("speech-recognize",p()),r.T.prototype.controls.speechRecognize={isActive:function(e,t){var n=(0,o.m)(e,"speech");return Boolean(null==n?void 0:n.isEnabled)},isDisabled:function(e){return!e.o.speechRecognize.api},exec:function(e,t,n){var s=n.button,r=n.control,u=e.o.speechRecognize,a=u.api,p=u.lang,l=u.continuous,d=u.interimResults,h=u.sound;if(a){var f=(0,o.m)(e,"speech");if(!f){var m=new a;(f=new c.g(e.async,m)).lang=p,f.continuous=l,f.interimResults=d,f.sound=h,(0,o.m)(e,"speech",f),f.on("pulse",(function(e){s.setMod("pulse",e)})),f.on("result",(function(t){return e.e.fire("speechRecognizeResult",t)})),f.on("progress",(function(t){return e.e.fire("speechRecognizeProgressResult",t)})),s.hookStatus("beforeDestruct",(function(){f.destruct()}))}if(r.args){var g=r.args[0];if((0,i.L)(f[g]))return f[g]=!f[g],void(f.isEnabled&&f.restart())}f.toggle(),s.state.activated=f.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,s=(0,o.m)(e,"speech"),r=null!==(i=null==s?void 0:s[t])&&void 0!==i?i:e.o.speechRecognize[t];return"<span class='jodit-speech-recognize__list-item'><input ".concat(r?"checked":""," class='jodit-checkbox' type='checkbox'> ").concat(n,"</span>")},mods:{stroke:!1}}},81629:function(e,t,n){"use strict";n.d(t,{N:function(){return i},Z:function(){return o}});var i=440,o=940},71722:function(e,t,n){"use strict";n.d(t,{o:function(){return i}});var i=window.SpeechRecognition||window.webkitSpeechRecognition},50834:function(e,t,n){"use strict";n.d(t,{F:function(){return o}});var i=n(31635);function o(e,t){var n=(0,i.zs)(t.split("::"),2);e.execCommand(n[0],null,n[1])}},93676:function(e,t,n){"use strict";n.d(t,{g:function(){return c}});var i=n(31635),o=n(22664),s=n(43431),r=n(95473),u=n(81629),c=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(u.Z)}),5e3),o.emit("pulse",!0))},o._progressTimeout=0,o._api=i,n._instances.add(o),o}var n;return(0,i.C6)(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(u.N)};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(u.Z),this.emit("pulse",!1),this.restart())},t.prototype._makeSound=function(e){this.sound&&(0,r.s)({frequency:e})},t._instances=new Set,n=(0,i.Cg)([o.autobind],t)}(s.h)},95473:function(e,t,n){"use strict";n.d(t,{s:function(){return o}});var i=n(81629);function o(e){var t=void 0===e?{}:e,n=t.sec,o=void 0===n?.1:n,s=t.frequency,r=void 0===s?i.N:s,u=t.gain,c=void 0===u?.1:u,a=t.type,p=void 0===a?"sine":a;if(void 0!==window.AudioContext||void 0!==window.webkitAudioContext){var l=new(window.AudioContext||window.webkitAudioContext),d=l.createGain(),h=l.createOscillator();h.type=p,h.frequency.value=r,h.connect(d),d.connect(l.destination),h.start(),h.stop(l.currentTime+o),d.gain.value=c}}},61593:function(e){"use strict";e.exports={newline:"الخط الجديد",delete:"حذف",space:"الفضاء","Speech Recognize":"التعرف على الكلام",Sound:"الصوت","Interim Results":"النتائج المؤقتة"}},64458: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"}},89601:function(e){"use strict";e.exports={newline:"Zeilenumbruch",delete:"löschen",space:"Raum","Speech Recognize":"Sprache Erkennen",Sound:"Sound","Interim Results":"Zwischenergebnis"}},87710: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"}},15603:function(e){"use strict";e.exports={newline:"خط جدید",delete:"حذف",space:"فضا","Speech Recognize":"گفتار را تشخیص دهید",Sound:"صدا","Interim Results":"نتایج موقت"}},84059:function(e){"use strict";e.exports={"Speech Recognize":"Puheentunnistus",newline:"uusi rivi",delete:"poistaa",space:"tilaa",Sound:"Ääni","Interim Results":"Välitulokset"}},13958: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"}},18717:function(e){"use strict";e.exports={newline:"חדשות",delete:"מחק",space:"שטח","Speech Recognize":"דיבור מזהה",Sound:"קול","Interim Results":"תוצאות ביניים"}},14765: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"}},77995:function(e){"use strict";e.exports={newline:"newline",delete:"Hapus",space:"ruang","Speech Recognize":"Pidato Mengenali",Sound:"Suara","Interim Results":"Hasil Sementara"}},25202:function(e,t,n){"use strict";n.r(t),n.d(t,{ar:function(){return i},cs_cz:function(){return o},de:function(){return s},es:function(){return r},fa:function(){return u},fi:function(){return c},fr:function(){return a},he:function(){return p},hu:function(){return l},id:function(){return d},it:function(){return h},ja:function(){return f},ko:function(){return m},mn:function(){return g},nl:function(){return R},pl:function(){return _},pt_br:function(){return S},ru:function(){return v},tr:function(){return w},zh_cn:function(){return z},zh_tw:function(){return y}});var i=n(61593),o=n(64458),s=n(89601),r=n(87710),u=n(15603),c=n(84059),a=n(13958),p=n(18717),l=n(14765),d=n(77995),h=n(92315),f=n(54711),m=n(68632),g=n(76769),R=n(3424),_=n(85454),S=n(64149),v=n(16491),w=n(48948),z=n(84370),y=n(56646)},92315:function(e){"use strict";e.exports={newline:"nuova riga",delete:"eliminare",space:"spazio","Speech Recognize":"Discorso Riconoscere",Sound:"Suono","Interim Results":"Risultati intermedi"}},54711:function(e){"use strict";e.exports={newline:"改行",delete:"削除",space:"スペース","Speech Recognize":"音声認識",Sound:"音","Interim Results":"中間結果"}},68632:function(e){"use strict";e.exports={newline:"줄 바꿈",delete:"삭제",space:"공간","Speech Recognize":"음성 인식",Sound:"소리","Interim Results":"중간 결과"}},76769:function(e){"use strict";e.exports={newline:"Шинэ мөр",delete:"Устгах",space:"Зай","Speech Recognize":"Дуу хоолой таних",Sound:"Дуу","Interim Results":"Түр зуурын үр дүн"}},3424:function(e){"use strict";e.exports={newline:"regel",delete:"verwijderen",space:"ruimte","Speech Recognize":"Spraak Herkennen",Sound:"Geluid","Interim Results":"Tussentijdse Resultaten"}},85454:function(e){"use strict";e.exports={newline:"newline",delete:"usunąć",space:"przestrzeń","Speech Recognize":"Rozpoznawanie Mowy",Sound:"Dźwięk","Interim Results":"Wyniki Okresowe"}},64149:function(e){"use strict";e.exports={newline:"linha",delete:"excluir",space:"espaco","Speech Recognize":"Discurso Reconhecer",Sound:"Som","Interim Results":"Resultados Provisórios"}},16491:function(e){"use strict";e.exports={newline:"новая строка|перенос|энтер",delete:"удалить",space:"пробел","Speech Recognize":"Распознавание речи",Sound:"Звук","Interim Results":"Промежуточные результаты"}},48948: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"}},84370:function(e){"use strict";e.exports={newline:"新行",delete:"删除",space:"空间","Speech Recognize":"言语识别",Sound:"声音","Interim Results":"中期业绩"}},56646:function(e){"use strict";e.exports={newline:"換行",delete:"刪除",space:"空白","Speech Recognize":"語音辨識",Sound:"聲音","Interim Results":"階段性辨識結果"}},37873:function(e,t,n){"use strict";n.r(t),n.d(t,{SpeechRecognizeNative:function(){return h}});var i=n(31635),o=n(37075),s=n(66927),r=n(55186),u=n(56298),c=n(84976),a=n(71005),p=(n(71096),n(46173)),l=n(50834),d=n(25202),h=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.C6)(t,e),t.prototype.afterInit=function(e){var t=this,n=e.o.speechRecognize.commands;n&&((0,u.JW)(d),(0,c.HP)(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(){r.J.safeRemove(t.messagePopup)}),{label:"onSpeechRecognizeProgressResult",timeout:1e3}),this.messagePopup.innerText=e+"|"},t.prototype.onSpeechRecognizeResult=function(e){var t=this.j,n=t.s;if(r.J.safeRemove(this.messagePopup),!this._checkCommand(e)){var i=n.range,o=n.current();if(n.isCollapsed()&&r.J.isText(o)&&r.J.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]&&((0,l.F)(this.j,this._commandToWord[e]),!0)},(0,i.Cg)([(0,s.w)(":speechRecognizeProgressResult"),(0,o.s)()],t.prototype,"onSpeechRecognizeProgressResult",null),(0,i.Cg)([(0,s.w)(":speechRecognizeResult")],t.prototype,"onSpeechRecognizeResult",null),t}(a.k);p.x.plugins.add("speech-recognize",h)},22227: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=37873)}])}));
|
|
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([[882],{71096:function(e,t,n){"use strict";var i=n(9810),s=n(72197),o=n(931),r=n(36115),u=n(71722),c=n(93676),a=n(22227),l=n.n(a);r.T.prototype.speechRecognize={api:void 0!==u.o?u.o:null,sound:!0,continuous:!1,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"}},o.I.set("speech-recognize",l()),r.T.prototype.controls.speechRecognize={isVisible:function(e){return Boolean(e.o.speechRecognize.api)},isActive:function(e,t){var n=(0,s.m)(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,r=n.control,u=e.o.speechRecognize,a=u.api,l=u.lang,p=u.continuous,h=u.interimResults,d=u.sound;if(a){var f=(0,s.m)(e,"speech");if(!f){var m=new a;(f=new c.g(e.async,m)).lang=l,f.continuous=p,f.interimResults=h,f.sound=d,(0,s.m)(e,"speech",f),f.on("pulse",(function(e){o.setMod("pulse",e)})),f.on("result",(function(t){return e.e.fire("speechRecognizeResult",t)})),f.on("progress",(function(t){return e.e.fire("speechRecognizeProgressResult",t)})),f.on("error",(function(t){return e.message.error(t)})),o.hookStatus("beforeDestruct",(function(){(0,s.m)(e,"speech",null),f.destruct()}))}if(r.args){var g=r.args[0];if((0,i.L)(f[g]))return f[g]=!f[g],void(f.isEnabled&&f.restart())}f.toggle(),f.isEnabled&&o.setMod("pulse",!0),o.state.activated=f.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,s.m)(e,"speech"),r=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(r?"checked":""," class='jodit-checkbox' type='checkbox'> ").concat(n,"</span>")},mods:{stroke:!1}}},81629:function(e,t,n){"use strict";n.d(t,{N:function(){return i},Z:function(){return s}});var i=440,s=940},71722:function(e,t,n){"use strict";n.d(t,{o:function(){return i}});var i=window.SpeechRecognition||window.webkitSpeechRecognition},50834:function(e,t,n){"use strict";n.d(t,{F:function(){return s}});var i=n(31635);function s(e,t){var n=(0,i.zs)(t.split("::"),2);e.execCommand(n[0],null,n[1])}},93676:function(e,t,n){"use strict";n.d(t,{g:function(){return c}});var i=n(31635),s=n(22664),o=n(43431),r=n(95473),u=n(81629),c=function(e){function t(t,i){var s=e.call(this)||this;return s.async=t,s._continuous=!1,s._interimResults=!1,s.sound=!0,s._isEnabled=!1,s._restartTimeout=0,s._onSpeechStart=function(e){s._isEnabled&&(s.async.clearTimeout(s._restartTimeout),s._restartTimeout=s.async.setTimeout((function(){s.restart(),s.emit("pulse",!1),s._makeSound(u.Z)}),5e3),s.emit("pulse",!0))},s.__interimResults="",s._api=i,n._instances.add(s),s}var n;return(0,i.C6)(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;if(!this._isEnabled){this._isEnabled=!0,n._instances.forEach((function(t){t!==e&&t.stop()}));try{this._api.start()}catch(e){return this._onError(e),void this.stop()}this.__on("speechstart",this._onSpeechStart).__on("error",this._onError).__on("result",this._onProgress).__on("end",this._onResults)}},t.prototype.stop=function(){this._isEnabled&&(this._api.abort(),this._api.stop(),this.__off("speechstart",this._onSpeechStart).__off("error",this._onError).__off("result",this._onProgress).__off("end",this._onResults),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._onResults=function(e){this.emit("pulse",!1),this.emit("result",this.__interimResults),this.__interimResults="",this._makeSound(u.N),this.restart()},t.prototype._onProgress=function(e){if(this._isEnabled&&(this.__interimResults="",e.results)){for(var t=0;e.results.length>t;t++){var n=e.results.item(t).item(0).transcript;this.__interimResults+=n}this.__interimResults&&this.emit("progress",this.__interimResults)}},t.prototype._onError=function(e){"voice-unavailable"===e.error&&this.emit("error","Voice unavailable"),"not-allowed"===e.error&&this.emit("error","Not allowed"),"language-unavailable"!==e.error&&"language-not-supported"!==e.error||this.emit("error","Language unavailable"),this._makeSound(u.Z),this.emit("pulse",!1),this.stop()},t.prototype._makeSound=function(e){this.sound&&(0,r.s)({frequency:e})},t._instances=new Set,n=(0,i.Cg)([s.autobind],t)}(o.h)},95473:function(e,t,n){"use strict";n.d(t,{s:function(){return s}});var i=n(81629);function s(e){var t=void 0===e?{}:e,n=t.sec,s=void 0===n?.1:n,o=t.frequency,r=void 0===o?i.N:o,u=t.gain,c=void 0===u?.1:u,a=t.type,l=void 0===a?"sine":a;if(void 0!==window.AudioContext||void 0!==window.webkitAudioContext){var p=new(window.AudioContext||window.webkitAudioContext),h=p.createGain(),d=p.createOscillator();d.type=l,d.frequency.value=r,d.connect(h),h.connect(p.destination),d.start(),d.stop(p.currentTime+s),h.gain.value=c}}},61593:function(e){"use strict";e.exports={newline:"الخط الجديد",delete:"حذف",space:"الفضاء","Speech Recognize":"التعرف على الكلام",Sound:"الصوت","Interim Results":"النتائج المؤقتة"}},64458: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"}},89601:function(e){"use strict";e.exports={newline:"Zeilenumbruch",delete:"löschen",space:"Raum","Speech Recognize":"Sprache Erkennen",Sound:"Sound","Interim Results":"Zwischenergebnis"}},87710: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"}},15603:function(e){"use strict";e.exports={newline:"خط جدید",delete:"حذف",space:"فضا","Speech Recognize":"گفتار را تشخیص دهید",Sound:"صدا","Interim Results":"نتایج موقت"}},84059:function(e){"use strict";e.exports={"Speech Recognize":"Puheentunnistus",newline:"uusi rivi",delete:"poistaa",space:"tilaa",Sound:"Ääni","Interim Results":"Välitulokset"}},13958: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"}},18717:function(e){"use strict";e.exports={newline:"חדשות",delete:"מחק",space:"שטח","Speech Recognize":"דיבור מזהה",Sound:"קול","Interim Results":"תוצאות ביניים"}},14765: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"}},77995:function(e){"use strict";e.exports={newline:"newline",delete:"Hapus",space:"ruang","Speech Recognize":"Pidato Mengenali",Sound:"Suara","Interim Results":"Hasil Sementara"}},25202:function(e,t,n){"use strict";n.r(t),n.d(t,{ar:function(){return i},cs_cz:function(){return s},de:function(){return o},es:function(){return r},fa:function(){return u},fi:function(){return c},fr:function(){return a},he:function(){return l},hu:function(){return p},id:function(){return h},it:function(){return d},ja:function(){return f},ko:function(){return m},mn:function(){return g},nl:function(){return R},pl:function(){return _},pt_br:function(){return v},ru:function(){return S},tr:function(){return w},zh_cn:function(){return z},zh_tw:function(){return y}});var i=n(61593),s=n(64458),o=n(89601),r=n(87710),u=n(15603),c=n(84059),a=n(13958),l=n(18717),p=n(14765),h=n(77995),d=n(92315),f=n(54711),m=n(68632),g=n(76769),R=n(3424),_=n(85454),v=n(64149),S=n(16491),w=n(48948),z=n(84370),y=n(56646)},92315:function(e){"use strict";e.exports={newline:"nuova riga",delete:"eliminare",space:"spazio","Speech Recognize":"Discorso Riconoscere",Sound:"Suono","Interim Results":"Risultati intermedi"}},54711:function(e){"use strict";e.exports={newline:"改行",delete:"削除",space:"スペース","Speech Recognize":"音声認識",Sound:"音","Interim Results":"中間結果"}},68632:function(e){"use strict";e.exports={newline:"줄 바꿈",delete:"삭제",space:"공간","Speech Recognize":"음성 인식",Sound:"소리","Interim Results":"중간 결과"}},76769:function(e){"use strict";e.exports={newline:"Шинэ мөр",delete:"Устгах",space:"Зай","Speech Recognize":"Дуу хоолой таних",Sound:"Дуу","Interim Results":"Түр зуурын үр дүн"}},3424:function(e){"use strict";e.exports={newline:"regel",delete:"verwijderen",space:"ruimte","Speech Recognize":"Spraak Herkennen",Sound:"Geluid","Interim Results":"Tussentijdse Resultaten"}},85454:function(e){"use strict";e.exports={newline:"newline",delete:"usunąć",space:"przestrzeń","Speech Recognize":"Rozpoznawanie Mowy",Sound:"Dźwięk","Interim Results":"Wyniki Okresowe"}},64149:function(e){"use strict";e.exports={newline:"linha",delete:"excluir",space:"espaco","Speech Recognize":"Discurso Reconhecer",Sound:"Som","Interim Results":"Resultados Provisórios"}},16491:function(e){"use strict";e.exports={newline:"новая строка|перенос|энтер",delete:"удалить",space:"пробел","Speech Recognize":"Распознавание речи",Sound:"Звук","Interim Results":"Промежуточные результаты"}},48948: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"}},84370:function(e){"use strict";e.exports={newline:"新行",delete:"删除",space:"空间","Speech Recognize":"言语识别",Sound:"声音","Interim Results":"中期业绩"}},56646:function(e){"use strict";e.exports={newline:"換行",delete:"刪除",space:"空白","Speech Recognize":"語音辨識",Sound:"聲音","Interim Results":"階段性辨識結果"}},37873:function(e,t,n){"use strict";n.r(t),n.d(t,{SpeechRecognizeNative:function(){return h}});var i=n(31635),s=n(66927),o=n(55186),r=n(56298),u=n(84976),c=n(71005),a=(n(71096),n(46173)),l=n(50834),p=n(25202),h=function(e){function t(){var t=e.apply(this,(0,i.fX)([],(0,i.zs)(arguments),!1))||this;return t.buttons=[{group:"state",name:"speechRecognize"}],t._commandToWord={},t}return(0,i.C6)(t,e),t.prototype.afterInit=function(e){var t=this,n=e.o.speechRecognize.commands;n&&((0,r.JW)(p),(0,u.HP)(n,!1).forEach((function(i){i.split("|").forEach((function(s){s=s.trim().toLowerCase(),t._commandToWord[s]=n[i];var o=e.i18n(s);o!==s&&o.split("|").forEach((function(e){t._commandToWord[e.trim().toLowerCase()]=n[i].trim()}))}))})))},t.prototype.beforeDestruct=function(e){o.J.safeRemove(this.messagePopup)},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.clearTimeout(this.__hidePopupTimeout),this.__hidePopupTimeout=this.j.async.setTimeout((function(){o.J.safeRemove(t.messagePopup)}),1e3),this.messagePopup.innerText=e+"|"},t.prototype.onSpeechRecognizeResult=function(e){this.j.async.clearTimeout(this.__hidePopupTimeout),o.J.safeRemove(this.messagePopup);var t=this.j,n=t.s;if(!this._checkCommand(e)){var i=n.range,s=n.current();if(n.isCollapsed()&&o.J.isText(s)&&o.J.isOrContains(t.editor,s)&&s.nodeValue){var r=s.nodeValue;s.nodeValue=r+(/[\u00A0 ]\uFEFF*$/.test(r)?"":" ")+e,i.setStartAfter(s),n.selectRange(i),t.synchronizeValues()}else n.insertHTML(e)}},t.prototype._checkCommand=function(e){return e=e.toLowerCase().replace(/\./g,""),!!this._commandToWord[e]&&((0,l.F)(this.j,this._commandToWord[e]),!0)},(0,i.Cg)([(0,s.w)(":speechRecognizeProgressResult")],t.prototype,"onSpeechRecognizeProgressResult",null),(0,i.Cg)([(0,s.w)(":speechRecognizeResult")],t.prototype,"onSpeechRecognizeResult",null),t}(c.k);a.x.plugins.add("speech-recognize",h)},22227: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=37873)}])}));
|
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-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.2.
|
|
6
|
+
export const APP_VERSION = "4.2.22";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -11,7 +11,7 @@ import type { ISpeechRecognizeConstructor } from "./interface";
|
|
|
11
11
|
declare module 'jodit/config' {
|
|
12
12
|
interface Config {
|
|
13
13
|
speechRecognize: {
|
|
14
|
-
readonly api: ISpeechRecognizeConstructor;
|
|
14
|
+
readonly api: ISpeechRecognizeConstructor | null;
|
|
15
15
|
/**
|
|
16
16
|
* Returns and sets the language of the current SpeechRecognition.
|
|
17
17
|
* If not specified, this defaults to the HTML lang attribute value, or
|
|
@@ -11,9 +11,9 @@ import { SpeechRecognition } from "./helpers/api.js";
|
|
|
11
11
|
import { RecognizeManager } from "./helpers/recognize-manager.js";
|
|
12
12
|
import speechRecognizeIcon from "./speech-recognize.svg.js";
|
|
13
13
|
Config.prototype.speechRecognize = {
|
|
14
|
-
api: SpeechRecognition,
|
|
14
|
+
api: typeof SpeechRecognition !== 'undefined' ? SpeechRecognition : null,
|
|
15
15
|
sound: true,
|
|
16
|
-
continuous:
|
|
16
|
+
continuous: false,
|
|
17
17
|
interimResults: true,
|
|
18
18
|
commands: {
|
|
19
19
|
'newline|enter': 'enter',
|
|
@@ -31,6 +31,9 @@ Config.prototype.speechRecognize = {
|
|
|
31
31
|
};
|
|
32
32
|
Icon.set('speech-recognize', speechRecognizeIcon);
|
|
33
33
|
Config.prototype.controls.speechRecognize = {
|
|
34
|
+
isVisible(j) {
|
|
35
|
+
return Boolean(j.o.speechRecognize.api);
|
|
36
|
+
},
|
|
34
37
|
isActive(jodit, _) {
|
|
35
38
|
const api = dataBind(jodit, 'speech');
|
|
36
39
|
return Boolean(api?.isEnabled);
|
|
@@ -39,14 +42,14 @@ Config.prototype.controls.speechRecognize = {
|
|
|
39
42
|
return !jodit.o.speechRecognize.api;
|
|
40
43
|
},
|
|
41
44
|
exec(jodit, current, { button, control }) {
|
|
42
|
-
const { api:
|
|
43
|
-
if (!
|
|
45
|
+
const { api: ApiConstructor, lang, continuous, interimResults, sound } = jodit.o.speechRecognize;
|
|
46
|
+
if (!ApiConstructor) {
|
|
44
47
|
jodit.alert('Speech recognize API unsupported in your browser');
|
|
45
48
|
return;
|
|
46
49
|
}
|
|
47
50
|
let api = dataBind(jodit, 'speech');
|
|
48
51
|
if (!api) {
|
|
49
|
-
const nativeApi = new
|
|
52
|
+
const nativeApi = new ApiConstructor();
|
|
50
53
|
api = new RecognizeManager(jodit.async, nativeApi);
|
|
51
54
|
api.lang = lang;
|
|
52
55
|
api.continuous = continuous;
|
|
@@ -58,7 +61,9 @@ Config.prototype.controls.speechRecognize = {
|
|
|
58
61
|
});
|
|
59
62
|
api.on('result', (text) => jodit.e.fire('speechRecognizeResult', text));
|
|
60
63
|
api.on('progress', (text) => jodit.e.fire('speechRecognizeProgressResult', text));
|
|
64
|
+
api.on('error', (text) => jodit.message.error(text));
|
|
61
65
|
button.hookStatus('beforeDestruct', () => {
|
|
66
|
+
dataBind(jodit, 'speech', null);
|
|
62
67
|
api.destruct();
|
|
63
68
|
});
|
|
64
69
|
}
|
|
@@ -73,6 +78,9 @@ Config.prototype.controls.speechRecognize = {
|
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
api.toggle();
|
|
81
|
+
if (api.isEnabled) {
|
|
82
|
+
button.setMod('pulse', true);
|
|
83
|
+
}
|
|
76
84
|
button.state.activated = api.isEnabled;
|
|
77
85
|
},
|
|
78
86
|
name: 'speechRecognize',
|
|
@@ -41,8 +41,9 @@ export declare class RecognizeManager extends Eventify<{
|
|
|
41
41
|
private readonly _api;
|
|
42
42
|
private __on;
|
|
43
43
|
private __off;
|
|
44
|
-
private
|
|
45
|
-
private
|
|
44
|
+
private _onResults;
|
|
45
|
+
private __interimResults;
|
|
46
|
+
private _onProgress;
|
|
46
47
|
private _onError;
|
|
47
48
|
private _makeSound;
|
|
48
49
|
}
|