jodit 4.2.21 → 4.2.24
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 +125 -95
- 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 +125 -95
- 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 +124 -95
- 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 +124 -95
- 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 +126 -97
- 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 +18 -6
- package/esm/plugins/speech-recognize/helpers/recognize-manager.d.ts +3 -2
- package/esm/plugins/speech-recognize/helpers/recognize-manager.js +47 -31
- package/esm/plugins/speech-recognize/interface.d.ts +2 -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 +2 -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.24
|
|
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.24
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -22,14 +22,16 @@ return (self["webpackChunkjodit"] = self["webpackChunkjodit"] || []).push([[882]
|
|
|
22
22
|
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
23
23
|
|
|
24
24
|
"use strict";
|
|
25
|
-
/* harmony import */ var
|
|
26
|
-
/* harmony import */ var
|
|
27
|
-
/* harmony import */ var
|
|
28
|
-
/* harmony import */ var
|
|
29
|
-
/* harmony import */ var
|
|
30
|
-
/* harmony import */ var
|
|
31
|
-
/* harmony import */ var
|
|
32
|
-
/* harmony import */ var
|
|
25
|
+
/* harmony import */ var jodit_core_helpers_checker_is_boolean__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9810);
|
|
26
|
+
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(98253);
|
|
27
|
+
/* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
|
|
28
|
+
/* harmony import */ var jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72197);
|
|
29
|
+
/* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(931);
|
|
30
|
+
/* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(36115);
|
|
31
|
+
/* harmony import */ var _helpers_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71722);
|
|
32
|
+
/* harmony import */ var _helpers_recognize_manager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(93676);
|
|
33
|
+
/* harmony import */ var _speech_recognize_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(22227);
|
|
34
|
+
/* harmony import */ var _speech_recognize_svg__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_speech_recognize_svg__WEBPACK_IMPORTED_MODULE_6__);
|
|
33
35
|
/*!
|
|
34
36
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
35
37
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -42,10 +44,12 @@ return (self["webpackChunkjodit"] = self["webpackChunkjodit"] || []).push([[882]
|
|
|
42
44
|
|
|
43
45
|
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
jodit_config__WEBPACK_IMPORTED_MODULE_3__/* .Config */ .T.prototype.speechRecognize = {
|
|
50
|
+
api: typeof _helpers_api__WEBPACK_IMPORTED_MODULE_4__/* .SpeechRecognition */ .o !== 'undefined' ? _helpers_api__WEBPACK_IMPORTED_MODULE_4__/* .SpeechRecognition */ .o : null,
|
|
47
51
|
sound: true,
|
|
48
|
-
continuous:
|
|
52
|
+
continuous: false,
|
|
49
53
|
interimResults: true,
|
|
50
54
|
commands: {
|
|
51
55
|
'newline|enter': 'enter',
|
|
@@ -61,42 +65,50 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.speechRecogn
|
|
|
61
65
|
'select all': 'selectall'
|
|
62
66
|
}
|
|
63
67
|
};
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__/* .Icon */ .I.set('speech-recognize', (_speech_recognize_svg__WEBPACK_IMPORTED_MODULE_6___default()));
|
|
69
|
+
jodit_config__WEBPACK_IMPORTED_MODULE_3__/* .Config */ .T.prototype.controls.speechRecognize = {
|
|
70
|
+
isVisible(j) {
|
|
71
|
+
return Boolean(j.o.speechRecognize.api);
|
|
72
|
+
},
|
|
66
73
|
isActive(jodit, _) {
|
|
67
|
-
const api = (0,
|
|
74
|
+
const api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__/* .dataBind */ .m)(jodit, 'speech');
|
|
68
75
|
return Boolean(api === null || api === void 0 ? void 0 : api.isEnabled);
|
|
69
76
|
},
|
|
70
77
|
isDisabled(jodit) {
|
|
71
78
|
return !jodit.o.speechRecognize.api;
|
|
72
79
|
},
|
|
73
80
|
exec(jodit, current, { button, control }) {
|
|
74
|
-
|
|
75
|
-
|
|
81
|
+
var _a;
|
|
82
|
+
const { api: ApiConstructor, lang, continuous, interimResults, sound } = jodit.o.speechRecognize;
|
|
83
|
+
if (!ApiConstructor) {
|
|
76
84
|
jodit.alert('Speech recognize API unsupported in your browser');
|
|
77
85
|
return;
|
|
78
86
|
}
|
|
79
|
-
let api = (0,
|
|
87
|
+
let api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__/* .dataBind */ .m)(jodit, 'speech');
|
|
80
88
|
if (!api) {
|
|
81
|
-
const nativeApi = new
|
|
82
|
-
api = new
|
|
83
|
-
api.lang = lang
|
|
89
|
+
const nativeApi = new ApiConstructor();
|
|
90
|
+
api = new _helpers_recognize_manager__WEBPACK_IMPORTED_MODULE_5__/* .RecognizeManager */ .g(jodit.async, nativeApi);
|
|
91
|
+
api.lang = (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_7__/* .isString */ .K)(lang)
|
|
92
|
+
? lang
|
|
93
|
+
: (_a = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(jodit.od.documentElement, 'lang')) !== null && _a !== void 0 ? _a : undefined;
|
|
84
94
|
api.continuous = continuous;
|
|
85
95
|
api.interimResults = interimResults;
|
|
86
96
|
api.sound = sound;
|
|
87
|
-
(0,
|
|
97
|
+
(0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__/* .dataBind */ .m)(jodit, 'speech', api);
|
|
88
98
|
api.on('pulse', (enable) => {
|
|
89
99
|
button.setMod('pulse', enable);
|
|
90
100
|
});
|
|
91
101
|
api.on('result', (text) => jodit.e.fire('speechRecognizeResult', text));
|
|
92
102
|
api.on('progress', (text) => jodit.e.fire('speechRecognizeProgressResult', text));
|
|
103
|
+
api.on('error', (text) => jodit.message.error(text));
|
|
93
104
|
button.hookStatus('beforeDestruct', () => {
|
|
105
|
+
(0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__/* .dataBind */ .m)(jodit, 'speech', null);
|
|
94
106
|
api.destruct();
|
|
95
107
|
});
|
|
96
108
|
}
|
|
97
109
|
if (control.args) {
|
|
98
110
|
const key = control.args[0];
|
|
99
|
-
if ((0,
|
|
111
|
+
if ((0,jodit_core_helpers_checker_is_boolean__WEBPACK_IMPORTED_MODULE_8__/* .isBoolean */ .L)(api[key])) {
|
|
100
112
|
api[key] = !api[key];
|
|
101
113
|
if (api.isEnabled) {
|
|
102
114
|
api.restart();
|
|
@@ -105,6 +117,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
api.toggle();
|
|
120
|
+
if (api.isEnabled) {
|
|
121
|
+
button.setMod('pulse', true);
|
|
122
|
+
}
|
|
108
123
|
button.state.activated = api.isEnabled;
|
|
109
124
|
},
|
|
110
125
|
name: 'speechRecognize',
|
|
@@ -116,7 +131,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
116
131
|
},
|
|
117
132
|
childTemplate(jodit, key, value) {
|
|
118
133
|
var _a;
|
|
119
|
-
const api = (0,
|
|
134
|
+
const api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__/* .dataBind */ .m)(jodit, 'speech'), checked = (_a = api === null || api === void 0 ? void 0 : api[key]) !== null && _a !== void 0 ? _a : jodit.o.speechRecognize[key];
|
|
120
135
|
return `<span class='jodit-speech-recognize__list-item'><input ${checked ? 'checked' : ''} class='jodit-checkbox' type='checkbox'> ${value}</span>`;
|
|
121
136
|
},
|
|
122
137
|
mods: {
|
|
@@ -253,7 +268,7 @@ let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends jodit
|
|
|
253
268
|
}, 5000);
|
|
254
269
|
this.emit('pulse', true);
|
|
255
270
|
};
|
|
256
|
-
this.
|
|
271
|
+
this.__interimResults = '';
|
|
257
272
|
this._api = api;
|
|
258
273
|
RecognizeManager_1._instances.add(this);
|
|
259
274
|
}
|
|
@@ -275,23 +290,29 @@ let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends jodit
|
|
|
275
290
|
instance.stop();
|
|
276
291
|
}
|
|
277
292
|
});
|
|
278
|
-
|
|
293
|
+
try {
|
|
294
|
+
this._api.start();
|
|
295
|
+
}
|
|
296
|
+
catch (e) {
|
|
297
|
+
this._onError(e);
|
|
298
|
+
this.stop();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
279
301
|
this.__on('speechstart', this._onSpeechStart)
|
|
280
302
|
.__on('error', this._onError)
|
|
281
|
-
.__on('result', this.
|
|
303
|
+
.__on('result', this._onProgress)
|
|
304
|
+
.__on('end', this._onResults);
|
|
282
305
|
}
|
|
283
306
|
stop() {
|
|
284
307
|
if (!this._isEnabled) {
|
|
285
308
|
return;
|
|
286
309
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
this._api.stop();
|
|
290
|
-
}
|
|
291
|
-
catch (_a) { }
|
|
310
|
+
this._api.abort();
|
|
311
|
+
this._api.stop();
|
|
292
312
|
this.__off('speechstart', this._onSpeechStart)
|
|
293
313
|
.__off('error', this._onError)
|
|
294
|
-
.__off('result', this.
|
|
314
|
+
.__off('result', this._onProgress)
|
|
315
|
+
.__off('end', this._onResults);
|
|
295
316
|
this.async.clearTimeout(this._restartTimeout);
|
|
296
317
|
this._isEnabled = false;
|
|
297
318
|
this.emit('pulse', false);
|
|
@@ -316,37 +337,47 @@ let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends jodit
|
|
|
316
337
|
this._api.removeEventListener(event, callback);
|
|
317
338
|
return this;
|
|
318
339
|
}
|
|
319
|
-
|
|
340
|
+
_onResults(e) {
|
|
341
|
+
this.emit('pulse', false);
|
|
342
|
+
this.emit('result', this.__interimResults);
|
|
343
|
+
this.__interimResults = '';
|
|
344
|
+
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_2__/* .PII */ .N);
|
|
345
|
+
this.restart();
|
|
346
|
+
}
|
|
347
|
+
_onProgress(e) {
|
|
320
348
|
if (!this._isEnabled) {
|
|
321
349
|
return;
|
|
322
350
|
}
|
|
323
|
-
this.
|
|
324
|
-
|
|
325
|
-
const { transcript } = resultItem.item(0);
|
|
326
|
-
const resultHandler = () => {
|
|
327
|
-
try {
|
|
328
|
-
this.async.clearTimeout(this._restartTimeout);
|
|
329
|
-
this.emit('result', transcript);
|
|
330
|
-
}
|
|
331
|
-
catch (_a) { }
|
|
332
|
-
this.restart();
|
|
333
|
-
this.emit('pulse', false);
|
|
334
|
-
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_2__/* .PII */ .N);
|
|
335
|
-
};
|
|
336
|
-
if (resultItem.isFinal === false) {
|
|
337
|
-
this.emit('progress', transcript);
|
|
338
|
-
this._progressTimeout = this.async.setTimeout(resultHandler, 500);
|
|
351
|
+
this.__interimResults = '';
|
|
352
|
+
if (!e.results) {
|
|
339
353
|
return;
|
|
340
354
|
}
|
|
341
|
-
|
|
355
|
+
for (let i = 0; i < e.results.length; i++) {
|
|
356
|
+
const resultItem = e.results.item(i);
|
|
357
|
+
if (resultItem.length) {
|
|
358
|
+
const { transcript } = resultItem.item(0);
|
|
359
|
+
this.__interimResults += transcript;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
if (this.__interimResults) {
|
|
363
|
+
this.emit('progress', this.__interimResults);
|
|
364
|
+
}
|
|
342
365
|
}
|
|
343
|
-
_onError() {
|
|
344
|
-
if (
|
|
345
|
-
|
|
366
|
+
_onError(e) {
|
|
367
|
+
if (e.error === 'voice-unavailable') {
|
|
368
|
+
this.emit('error', 'Voice unavailable');
|
|
369
|
+
}
|
|
370
|
+
if (e.error === 'not-allowed') {
|
|
371
|
+
this.emit('error', 'Not allowed');
|
|
372
|
+
}
|
|
373
|
+
if (e.error === 'language-unavailable' ||
|
|
374
|
+
// @ts-ignore
|
|
375
|
+
e.error === 'language-not-supported') {
|
|
376
|
+
this.emit('error', 'Language unavailable');
|
|
346
377
|
}
|
|
347
378
|
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_2__/* .WARN */ .Z);
|
|
348
379
|
this.emit('pulse', false);
|
|
349
|
-
this.
|
|
380
|
+
this.stop();
|
|
350
381
|
}
|
|
351
382
|
_makeSound(frequency) {
|
|
352
383
|
if (this.sound) {
|
|
@@ -977,17 +1008,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
977
1008
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
978
1009
|
/* harmony export */ SpeechRecognizeNative: function() { return /* binding */ SpeechRecognizeNative; }
|
|
979
1010
|
/* harmony export */ });
|
|
980
|
-
/* harmony import */ var
|
|
981
|
-
/* harmony import */ var
|
|
982
|
-
/* harmony import */ var
|
|
983
|
-
/* harmony import */ var
|
|
984
|
-
/* harmony import */ var
|
|
985
|
-
/* harmony import */ var
|
|
986
|
-
/* harmony import */ var
|
|
987
|
-
/* harmony import */ var
|
|
988
|
-
/* harmony import */ var
|
|
989
|
-
/* harmony import */ var
|
|
990
|
-
/* harmony import */ var _langs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(25202);
|
|
1011
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(31635);
|
|
1012
|
+
/* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66927);
|
|
1013
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55186);
|
|
1014
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
|
|
1015
|
+
/* harmony import */ var jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84976);
|
|
1016
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71005);
|
|
1017
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(71096);
|
|
1018
|
+
/* harmony import */ var _jodit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46173);
|
|
1019
|
+
/* harmony import */ var _helpers_exec_spell_command__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(50834);
|
|
1020
|
+
/* harmony import */ var _langs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(25202);
|
|
991
1021
|
/*!
|
|
992
1022
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
993
1023
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -1004,23 +1034,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1004
1034
|
|
|
1005
1035
|
|
|
1006
1036
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
if (j.o.speechRecognize.api) {
|
|
1013
|
-
j.registerButton({
|
|
1037
|
+
class SpeechRecognizeNative extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .k {
|
|
1038
|
+
constructor() {
|
|
1039
|
+
super(...arguments);
|
|
1040
|
+
this.buttons = [
|
|
1041
|
+
{
|
|
1014
1042
|
group: 'state',
|
|
1015
1043
|
name: 'speechRecognize'
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1044
|
+
}
|
|
1045
|
+
];
|
|
1046
|
+
this._commandToWord = {};
|
|
1018
1047
|
}
|
|
1019
1048
|
afterInit(jodit) {
|
|
1020
1049
|
const { commands } = jodit.o.speechRecognize;
|
|
1021
1050
|
if (commands) {
|
|
1022
|
-
(0,
|
|
1023
|
-
(0,
|
|
1051
|
+
(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .extendLang */ .JW)(_langs__WEBPACK_IMPORTED_MODULE_7__);
|
|
1052
|
+
(0,jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_3__/* .keys */ .HP)(commands, false).forEach(words => {
|
|
1024
1053
|
const keys = words.split('|');
|
|
1025
1054
|
keys.forEach(key => {
|
|
1026
1055
|
key = key.trim().toLowerCase();
|
|
@@ -1035,28 +1064,30 @@ class SpeechRecognizeNative extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5
|
|
|
1035
1064
|
});
|
|
1036
1065
|
}
|
|
1037
1066
|
}
|
|
1038
|
-
beforeDestruct(jodit) {
|
|
1067
|
+
beforeDestruct(jodit) {
|
|
1068
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
1069
|
+
}
|
|
1039
1070
|
onSpeechRecognizeProgressResult(text) {
|
|
1040
1071
|
if (!this.messagePopup) {
|
|
1041
1072
|
this.messagePopup = this.j.create.div('jodit-speech-recognize__popup');
|
|
1042
1073
|
}
|
|
1043
1074
|
this.j.workplace.appendChild(this.messagePopup);
|
|
1044
|
-
this.j.async.
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
timeout: 1000
|
|
1049
|
-
});
|
|
1075
|
+
this.j.async.clearTimeout(this.__hidePopupTimeout);
|
|
1076
|
+
this.__hidePopupTimeout = this.j.async.setTimeout(() => {
|
|
1077
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
1078
|
+
}, 1000);
|
|
1050
1079
|
this.messagePopup.innerText = text + '|';
|
|
1051
1080
|
}
|
|
1052
1081
|
onSpeechRecognizeResult(text) {
|
|
1053
|
-
|
|
1054
|
-
|
|
1082
|
+
this.j.async.clearTimeout(this.__hidePopupTimeout);
|
|
1083
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
1084
|
+
const { j } = this;
|
|
1085
|
+
const { s } = j;
|
|
1055
1086
|
if (!this._checkCommand(text)) {
|
|
1056
1087
|
const { range } = s, node = s.current();
|
|
1057
1088
|
if (s.isCollapsed() &&
|
|
1058
|
-
|
|
1059
|
-
|
|
1089
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(node) &&
|
|
1090
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(j.editor, node) &&
|
|
1060
1091
|
node.nodeValue) {
|
|
1061
1092
|
const sentence = node.nodeValue;
|
|
1062
1093
|
node.nodeValue =
|
|
@@ -1075,20 +1106,19 @@ class SpeechRecognizeNative extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5
|
|
|
1075
1106
|
_checkCommand(command) {
|
|
1076
1107
|
command = command.toLowerCase().replace(/\./g, '');
|
|
1077
1108
|
if (this._commandToWord[command]) {
|
|
1078
|
-
(0,
|
|
1109
|
+
(0,_helpers_exec_spell_command__WEBPACK_IMPORTED_MODULE_8__/* .execSpellCommand */ .F)(this.j, this._commandToWord[command]);
|
|
1079
1110
|
return true;
|
|
1080
1111
|
}
|
|
1081
1112
|
return false;
|
|
1082
1113
|
}
|
|
1083
1114
|
}
|
|
1084
|
-
(0,
|
|
1085
|
-
(0,
|
|
1086
|
-
(0,jodit_core_decorators_debounce_debounce__WEBPACK_IMPORTED_MODULE_0__/* .debounce */ .s)()
|
|
1115
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_9__/* .__decorate */ .Cg)([
|
|
1116
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__/* .watch */ .w)(':speechRecognizeProgressResult')
|
|
1087
1117
|
], SpeechRecognizeNative.prototype, "onSpeechRecognizeProgressResult", null);
|
|
1088
|
-
(0,
|
|
1089
|
-
(0,
|
|
1118
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_9__/* .__decorate */ .Cg)([
|
|
1119
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__/* .watch */ .w)(':speechRecognizeResult')
|
|
1090
1120
|
], SpeechRecognizeNative.prototype, "onSpeechRecognizeResult", null);
|
|
1091
|
-
|
|
1121
|
+
_jodit__WEBPACK_IMPORTED_MODULE_6__/* .Jodit */ .x.plugins.add('speech-recognize', SpeechRecognizeNative);
|
|
1092
1122
|
|
|
1093
1123
|
|
|
1094
1124
|
/***/ }),
|
|
@@ -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.24
|
|
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 s in n)("object"==typeof exports?exports:e)[s]=n[s]}}(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[882],{71096:function(e,t,n){"use strict";var s=n(9810),i=n(72197),o=n(931),r=n(36115),c=n(71722),u=n(93676),a=n(22227),l=n.n(a);r.T.prototype.speechRecognize={api:c.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"}},o.I.set("speech-recognize",l()),r.T.prototype.controls.speechRecognize={isActive(e,t){const n=(0,i.m)(e,"speech");return Boolean(null==n?void 0:n.isEnabled)},isDisabled(e){return!e.o.speechRecognize.api},exec(e,t,{button:n,control:o}){const{api:r,lang:c,continuous:a,interimResults:l,sound:p}=e.o.speechRecognize;if(!r)return void e.alert("Speech recognize API unsupported in your browser");let h=(0,i.m)(e,"speech");if(!h){const t=new r;h=new u.g(e.async,t),h.lang=c,h.continuous=a,h.interimResults=l,h.sound=p,(0,i.m)(e,"speech",h),h.on("pulse",(e=>{n.setMod("pulse",e)})),h.on("result",(t=>e.e.fire("speechRecognizeResult",t))),h.on("progress",(t=>e.e.fire("speechRecognizeProgressResult",t))),n.hookStatus("beforeDestruct",(()=>{h.destruct()}))}if(o.args){const e=o.args[0];if((0,s.L)(h[e]))return h[e]=!h[e],void(h.isEnabled&&h.restart())}h.toggle(),n.state.activated=h.isEnabled},name:"speechRecognize",command:"toggleSpeechRecognize",tooltip:"Speech Recognize",list:{sound:"Sound",interimResults:"Interim Results"},childTemplate(e,t,n){var s;const o=(0,i.m)(e,"speech");return`<span class='jodit-speech-recognize__list-item'><input ${(null!==(s=null==o?void 0:o[t])&&void 0!==s?s:e.o.speechRecognize[t])?"checked":""} class='jodit-checkbox' type='checkbox'> ${n}</span>`},mods:{stroke:!1}}},81629:function(e,t,n){"use strict";n.d(t,{N:function(){return s},Z:function(){return i}});const s=440,i=940},71722:function(e,t,n){"use strict";n.d(t,{o:function(){return s}});const s=window.SpeechRecognition||window.webkitSpeechRecognition},50834:function(e,t,n){"use strict";function s(e,t){const[n,s]=t.split("::");e.execCommand(n,null,s)}n.d(t,{F:function(){return s}})},93676:function(e,t,n){"use strict";n.d(t,{g:function(){return a}});var s,i=n(31635),o=n(22664),r=n(43431),c=n(95473),u=n(81629);let a=s=class e extends r.h{set lang(e){this._lang=e,this._api.lang=e}get lang(){return this._lang}set continuous(e){this._continuous=e,this._api.continuous=e}get continuous(){return this._continuous}set interimResults(e){this._interimResults=e,this._api.interimResults=e}get interimResults(){return this._interimResults}constructor(e,t){super(),this.async=e,this._continuous=!1,this._interimResults=!1,this.sound=!0,this._isEnabled=!1,this._restartTimeout=0,this._onSpeechStart=e=>{this._isEnabled&&(this.async.clearTimeout(this._restartTimeout),this._restartTimeout=this.async.setTimeout((()=>{this.restart(),this.emit("pulse",!1),this._makeSound(u.Z)}),5e3),this.emit("pulse",!0))},this._progressTimeout=0,this._api=t,s._instances.add(this)}destruct(){this.stop(),s._instances.delete(this),super.destruct()}get isEnabled(){return this._isEnabled}start(){this._isEnabled||(this._isEnabled=!0,s._instances.forEach((e=>{e!==this&&e.stop()})),this._api.start(),this.__on("speechstart",this._onSpeechStart).__on("error",this._onError).__on("result",this._onResult))}stop(){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)}}toggle(){this._isEnabled?this.stop():this.start()}restart(){this.stop(),this.start()}__on(e,t){return this._api.addEventListener(e,t),this}__off(e,t){return this._api.removeEventListener(e,t),this}_onResult(e){if(!this._isEnabled)return;this.async.clearTimeout(this._progressTimeout);const t=e.results.item(e.resultIndex),{transcript:n}=t.item(0),s=()=>{try{this.async.clearTimeout(this._restartTimeout),this.emit("result",n)}catch(e){}this.restart(),this.emit("pulse",!1),this._makeSound(u.N)};if(!1===t.isFinal)return this.emit("progress",n),void(this._progressTimeout=this.async.setTimeout(s,500));s()}_onError(){this._isEnabled&&(this._makeSound(u.Z),this.emit("pulse",!1),this.restart())}_makeSound(e){this.sound&&(0,c.s)({frequency:e})}};a._instances=new Set,a=s=(0,i.Cg)([o.autobind],a)},95473:function(e,t,n){"use strict";n.d(t,{s:function(){return i}});var s=n(81629);function i({sec:e=.1,frequency:t=s.N,gain:n=.1,type:i="sine"}={}){if(void 0===window.AudioContext&&void 0===window.webkitAudioContext)return;const o=new(window.AudioContext||window.webkitAudioContext),r=o.createGain(),c=o.createOscillator();c.type=i,c.frequency.value=t,c.connect(r),r.connect(o.destination),c.start(),c.stop(o.currentTime+e),r.gain.value=n}},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 s},cs_cz:function(){return i},de:function(){return o},es:function(){return r},fa:function(){return c},fi:function(){return u},fr:function(){return a},he:function(){return l},hu:function(){return p},id:function(){return h},it:function(){return d},ja:function(){return m},ko:function(){return f},mn:function(){return g},nl:function(){return R},pl:function(){return _},pt_br:function(){return S},ru:function(){return w},tr:function(){return z},zh_cn:function(){return v},zh_tw:function(){return x}});var s=n(61593),i=n(64458),o=n(89601),r=n(87710),c=n(15603),u=n(84059),a=n(13958),l=n(18717),p=n(14765),h=n(77995),d=n(92315),m=n(54711),f=n(68632),g=n(76769),R=n(3424),_=n(85454),S=n(64149),w=n(16491),z=n(48948),v=n(84370),x=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 d}});var s=n(31635),i=n(37075),o=n(66927),r=n(55186),c=n(56298),u=n(84976),a=n(71005),l=(n(71096),n(46173)),p=n(50834),h=n(25202);class d extends a.k{constructor(e){super(e),this._commandToWord={},e.o.speechRecognize.api&&e.registerButton({group:"state",name:"speechRecognize"})}afterInit(e){const{commands:t}=e.o.speechRecognize;t&&((0,c.JW)(h),(0,u.HP)(t,!1).forEach((n=>{n.split("|").forEach((s=>{s=s.trim().toLowerCase(),this._commandToWord[s]=t[n];const i=e.i18n(s);i!==s&&i.split("|").forEach((e=>{this._commandToWord[e.trim().toLowerCase()]=t[n].trim()}))}))})))}beforeDestruct(e){}onSpeechRecognizeProgressResult(e){this.messagePopup||(this.messagePopup=this.j.create.div("jodit-speech-recognize__popup")),this.j.workplace.appendChild(this.messagePopup),this.j.async.setTimeout((()=>{r.J.safeRemove(this.messagePopup)}),{label:"onSpeechRecognizeProgressResult",timeout:1e3}),this.messagePopup.innerText=e+"|"}onSpeechRecognizeResult(e){const{j:t}=this,{s:n}=t;if(r.J.safeRemove(this.messagePopup),!this._checkCommand(e)){const{range:s}=n,i=n.current();if(n.isCollapsed()&&r.J.isText(i)&&r.J.isOrContains(t.editor,i)&&i.nodeValue){const o=i.nodeValue;i.nodeValue=o+(/[\u00A0 ]\uFEFF*$/.test(o)?"":" ")+e,s.setStartAfter(i),n.selectRange(s),t.synchronizeValues()}else n.insertHTML(e)}}_checkCommand(e){return e=e.toLowerCase().replace(/\./g,""),!!this._commandToWord[e]&&((0,p.F)(this.j,this._commandToWord[e]),!0)}}(0,s.Cg)([(0,o.w)(":speechRecognizeProgressResult"),(0,i.s)()],d.prototype,"onSpeechRecognizeProgressResult",null),(0,s.Cg)([(0,o.w)(":speechRecognizeResult")],d.prototype,"onSpeechRecognizeResult",null),l.x.plugins.add("speech-recognize",d)},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 s in n)("object"==typeof exports?exports:e)[s]=n[s]}}(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[882],{71096:function(e,t,n){"use strict";var s=n(9810),i=n(98253),o=n(26150),r=n(72197),u=n(931),c=n(36115),a=n(71722),l=n(93676),p=n(22227),h=n.n(p);c.T.prototype.speechRecognize={api:void 0!==a.o?a.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"}},u.I.set("speech-recognize",h()),c.T.prototype.controls.speechRecognize={isVisible(e){return Boolean(e.o.speechRecognize.api)},isActive(e,t){const n=(0,r.m)(e,"speech");return Boolean(null==n?void 0:n.isEnabled)},isDisabled(e){return!e.o.speechRecognize.api},exec(e,t,{button:n,control:u}){var c;const{api:a,lang:p,continuous:h,interimResults:d,sound:m}=e.o.speechRecognize;if(!a)return void e.alert("Speech recognize API unsupported in your browser");let f=(0,r.m)(e,"speech");if(!f){const t=new a;f=new l.g(e.async,t),f.lang=(0,i.K)(p)?p:null!==(c=(0,o.C)(e.od.documentElement,"lang"))&&void 0!==c?c:void 0,f.continuous=h,f.interimResults=d,f.sound=m,(0,r.m)(e,"speech",f),f.on("pulse",(e=>{n.setMod("pulse",e)})),f.on("result",(t=>e.e.fire("speechRecognizeResult",t))),f.on("progress",(t=>e.e.fire("speechRecognizeProgressResult",t))),f.on("error",(t=>e.message.error(t))),n.hookStatus("beforeDestruct",(()=>{(0,r.m)(e,"speech",null),f.destruct()}))}if(u.args){const e=u.args[0];if((0,s.L)(f[e]))return f[e]=!f[e],void(f.isEnabled&&f.restart())}f.toggle(),f.isEnabled&&n.setMod("pulse",!0),n.state.activated=f.isEnabled},name:"speechRecognize",command:"toggleSpeechRecognize",tooltip:"Speech Recognize",list:{sound:"Sound",interimResults:"Interim Results"},childTemplate(e,t,n){var s;const i=(0,r.m)(e,"speech");return`<span class='jodit-speech-recognize__list-item'><input ${(null!==(s=null==i?void 0:i[t])&&void 0!==s?s:e.o.speechRecognize[t])?"checked":""} class='jodit-checkbox' type='checkbox'> ${n}</span>`},mods:{stroke:!1}}},81629:function(e,t,n){"use strict";n.d(t,{N:function(){return s},Z:function(){return i}});const s=440,i=940},71722:function(e,t,n){"use strict";n.d(t,{o:function(){return s}});const s=window.SpeechRecognition||window.webkitSpeechRecognition},50834:function(e,t,n){"use strict";function s(e,t){const[n,s]=t.split("::");e.execCommand(n,null,s)}n.d(t,{F:function(){return s}})},93676:function(e,t,n){"use strict";n.d(t,{g:function(){return a}});var s,i=n(31635),o=n(22664),r=n(43431),u=n(95473),c=n(81629);let a=s=class e extends r.h{set lang(e){this._lang=e,this._api.lang=e}get lang(){return this._lang}set continuous(e){this._continuous=e,this._api.continuous=e}get continuous(){return this._continuous}set interimResults(e){this._interimResults=e,this._api.interimResults=e}get interimResults(){return this._interimResults}constructor(e,t){super(),this.async=e,this._continuous=!1,this._interimResults=!1,this.sound=!0,this._isEnabled=!1,this._restartTimeout=0,this._onSpeechStart=e=>{this._isEnabled&&(this.async.clearTimeout(this._restartTimeout),this._restartTimeout=this.async.setTimeout((()=>{this.restart(),this.emit("pulse",!1),this._makeSound(c.Z)}),5e3),this.emit("pulse",!0))},this.__interimResults="",this._api=t,s._instances.add(this)}destruct(){this.stop(),s._instances.delete(this),super.destruct()}get isEnabled(){return this._isEnabled}start(){if(!this._isEnabled){this._isEnabled=!0,s._instances.forEach((e=>{e!==this&&e.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)}}stop(){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))}toggle(){this._isEnabled?this.stop():this.start()}restart(){this.stop(),this.start()}__on(e,t){return this._api.addEventListener(e,t),this}__off(e,t){return this._api.removeEventListener(e,t),this}_onResults(e){this.emit("pulse",!1),this.emit("result",this.__interimResults),this.__interimResults="",this._makeSound(c.N),this.restart()}_onProgress(e){if(this._isEnabled&&(this.__interimResults="",e.results)){for(let t=0;e.results.length>t;t++){const n=e.results.item(t);if(n.length){const{transcript:e}=n.item(0);this.__interimResults+=e}}this.__interimResults&&this.emit("progress",this.__interimResults)}}_onError(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(c.Z),this.emit("pulse",!1),this.stop()}_makeSound(e){this.sound&&(0,u.s)({frequency:e})}};a._instances=new Set,a=s=(0,i.Cg)([o.autobind],a)},95473:function(e,t,n){"use strict";n.d(t,{s:function(){return i}});var s=n(81629);function i({sec:e=.1,frequency:t=s.N,gain:n=.1,type:i="sine"}={}){if(void 0===window.AudioContext&&void 0===window.webkitAudioContext)return;const o=new(window.AudioContext||window.webkitAudioContext),r=o.createGain(),u=o.createOscillator();u.type=i,u.frequency.value=t,u.connect(r),r.connect(o.destination),u.start(),u.stop(o.currentTime+e),r.gain.value=n}},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 s},cs_cz:function(){return i},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 m},ko:function(){return f},mn:function(){return g},nl:function(){return R},pl:function(){return _},pt_br:function(){return S},ru:function(){return w},tr:function(){return z},zh_cn:function(){return v},zh_tw:function(){return b}});var s=n(61593),i=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),m=n(54711),f=n(68632),g=n(76769),R=n(3424),_=n(85454),S=n(64149),w=n(16491),z=n(48948),v=n(84370),b=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 s=n(31635),i=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);class h extends c.k{constructor(){super(...arguments),this.buttons=[{group:"state",name:"speechRecognize"}],this._commandToWord={}}afterInit(e){const{commands:t}=e.o.speechRecognize;t&&((0,r.JW)(p),(0,u.HP)(t,!1).forEach((n=>{n.split("|").forEach((s=>{s=s.trim().toLowerCase(),this._commandToWord[s]=t[n];const i=e.i18n(s);i!==s&&i.split("|").forEach((e=>{this._commandToWord[e.trim().toLowerCase()]=t[n].trim()}))}))})))}beforeDestruct(e){o.J.safeRemove(this.messagePopup)}onSpeechRecognizeProgressResult(e){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((()=>{o.J.safeRemove(this.messagePopup)}),1e3),this.messagePopup.innerText=e+"|"}onSpeechRecognizeResult(e){this.j.async.clearTimeout(this.__hidePopupTimeout),o.J.safeRemove(this.messagePopup);const{j:t}=this,{s:n}=t;if(!this._checkCommand(e)){const{range:s}=n,i=n.current();if(n.isCollapsed()&&o.J.isText(i)&&o.J.isOrContains(t.editor,i)&&i.nodeValue){const o=i.nodeValue;i.nodeValue=o+(/[\u00A0 ]\uFEFF*$/.test(o)?"":" ")+e,s.setStartAfter(i),n.selectRange(s),t.synchronizeValues()}else n.insertHTML(e)}}_checkCommand(e){return e=e.toLowerCase().replace(/\./g,""),!!this._commandToWord[e]&&((0,l.F)(this.j,this._commandToWord[e]),!0)}}(0,s.Cg)([(0,i.w)(":speechRecognizeProgressResult")],h.prototype,"onSpeechRecognizeProgressResult",null),(0,s.Cg)([(0,i.w)(":speechRecognizeResult")],h.prototype,"onSpeechRecognizeResult",null),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/es2021/jodit.css
CHANGED