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,49 @@ 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?.isEnabled);
|
|
69
76
|
},
|
|
70
77
|
isDisabled(jodit) {
|
|
71
78
|
return !jodit.o.speechRecognize.api;
|
|
72
79
|
},
|
|
73
80
|
exec(jodit, current, { button, control }) {
|
|
74
|
-
const { api:
|
|
75
|
-
if (!
|
|
81
|
+
const { api: ApiConstructor, lang, continuous, interimResults, sound } = jodit.o.speechRecognize;
|
|
82
|
+
if (!ApiConstructor) {
|
|
76
83
|
jodit.alert('Speech recognize API unsupported in your browser');
|
|
77
84
|
return;
|
|
78
85
|
}
|
|
79
|
-
let api = (0,
|
|
86
|
+
let api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__/* .dataBind */ .m)(jodit, 'speech');
|
|
80
87
|
if (!api) {
|
|
81
|
-
const nativeApi = new
|
|
82
|
-
api = new
|
|
83
|
-
api.lang = lang
|
|
88
|
+
const nativeApi = new ApiConstructor();
|
|
89
|
+
api = new _helpers_recognize_manager__WEBPACK_IMPORTED_MODULE_5__/* .RecognizeManager */ .g(jodit.async, nativeApi);
|
|
90
|
+
api.lang = (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_7__/* .isString */ .K)(lang)
|
|
91
|
+
? lang
|
|
92
|
+
: (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(jodit.od.documentElement, 'lang') ?? undefined;
|
|
84
93
|
api.continuous = continuous;
|
|
85
94
|
api.interimResults = interimResults;
|
|
86
95
|
api.sound = sound;
|
|
87
|
-
(0,
|
|
96
|
+
(0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__/* .dataBind */ .m)(jodit, 'speech', api);
|
|
88
97
|
api.on('pulse', (enable) => {
|
|
89
98
|
button.setMod('pulse', enable);
|
|
90
99
|
});
|
|
91
100
|
api.on('result', (text) => jodit.e.fire('speechRecognizeResult', text));
|
|
92
101
|
api.on('progress', (text) => jodit.e.fire('speechRecognizeProgressResult', text));
|
|
102
|
+
api.on('error', (text) => jodit.message.error(text));
|
|
93
103
|
button.hookStatus('beforeDestruct', () => {
|
|
104
|
+
(0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__/* .dataBind */ .m)(jodit, 'speech', null);
|
|
94
105
|
api.destruct();
|
|
95
106
|
});
|
|
96
107
|
}
|
|
97
108
|
if (control.args) {
|
|
98
109
|
const key = control.args[0];
|
|
99
|
-
if ((0,
|
|
110
|
+
if ((0,jodit_core_helpers_checker_is_boolean__WEBPACK_IMPORTED_MODULE_8__/* .isBoolean */ .L)(api[key])) {
|
|
100
111
|
api[key] = !api[key];
|
|
101
112
|
if (api.isEnabled) {
|
|
102
113
|
api.restart();
|
|
@@ -105,6 +116,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
105
116
|
}
|
|
106
117
|
}
|
|
107
118
|
api.toggle();
|
|
119
|
+
if (api.isEnabled) {
|
|
120
|
+
button.setMod('pulse', true);
|
|
121
|
+
}
|
|
108
122
|
button.state.activated = api.isEnabled;
|
|
109
123
|
},
|
|
110
124
|
name: 'speechRecognize',
|
|
@@ -115,7 +129,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
115
129
|
interimResults: 'Interim Results'
|
|
116
130
|
},
|
|
117
131
|
childTemplate(jodit, key, value) {
|
|
118
|
-
const api = (0,
|
|
132
|
+
const api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_1__/* .dataBind */ .m)(jodit, 'speech'), checked = api?.[key] ?? jodit.o.speechRecognize[key];
|
|
119
133
|
return `<span class='jodit-speech-recognize__list-item'><input ${checked ? 'checked' : ''} class='jodit-checkbox' type='checkbox'> ${value}</span>`;
|
|
120
134
|
},
|
|
121
135
|
mods: {
|
|
@@ -252,7 +266,7 @@ let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends jodit
|
|
|
252
266
|
}, 5000);
|
|
253
267
|
this.emit('pulse', true);
|
|
254
268
|
};
|
|
255
|
-
this.
|
|
269
|
+
this.__interimResults = '';
|
|
256
270
|
this._api = api;
|
|
257
271
|
RecognizeManager_1._instances.add(this);
|
|
258
272
|
}
|
|
@@ -274,23 +288,29 @@ let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends jodit
|
|
|
274
288
|
instance.stop();
|
|
275
289
|
}
|
|
276
290
|
});
|
|
277
|
-
|
|
291
|
+
try {
|
|
292
|
+
this._api.start();
|
|
293
|
+
}
|
|
294
|
+
catch (e) {
|
|
295
|
+
this._onError(e);
|
|
296
|
+
this.stop();
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
278
299
|
this.__on('speechstart', this._onSpeechStart)
|
|
279
300
|
.__on('error', this._onError)
|
|
280
|
-
.__on('result', this.
|
|
301
|
+
.__on('result', this._onProgress)
|
|
302
|
+
.__on('end', this._onResults);
|
|
281
303
|
}
|
|
282
304
|
stop() {
|
|
283
305
|
if (!this._isEnabled) {
|
|
284
306
|
return;
|
|
285
307
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this._api.stop();
|
|
289
|
-
}
|
|
290
|
-
catch { }
|
|
308
|
+
this._api.abort();
|
|
309
|
+
this._api.stop();
|
|
291
310
|
this.__off('speechstart', this._onSpeechStart)
|
|
292
311
|
.__off('error', this._onError)
|
|
293
|
-
.__off('result', this.
|
|
312
|
+
.__off('result', this._onProgress)
|
|
313
|
+
.__off('end', this._onResults);
|
|
294
314
|
this.async.clearTimeout(this._restartTimeout);
|
|
295
315
|
this._isEnabled = false;
|
|
296
316
|
this.emit('pulse', false);
|
|
@@ -315,37 +335,47 @@ let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends jodit
|
|
|
315
335
|
this._api.removeEventListener(event, callback);
|
|
316
336
|
return this;
|
|
317
337
|
}
|
|
318
|
-
|
|
338
|
+
_onResults(e) {
|
|
339
|
+
this.emit('pulse', false);
|
|
340
|
+
this.emit('result', this.__interimResults);
|
|
341
|
+
this.__interimResults = '';
|
|
342
|
+
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_2__/* .PII */ .N);
|
|
343
|
+
this.restart();
|
|
344
|
+
}
|
|
345
|
+
_onProgress(e) {
|
|
319
346
|
if (!this._isEnabled) {
|
|
320
347
|
return;
|
|
321
348
|
}
|
|
322
|
-
this.
|
|
323
|
-
|
|
324
|
-
const { transcript } = resultItem.item(0);
|
|
325
|
-
const resultHandler = () => {
|
|
326
|
-
try {
|
|
327
|
-
this.async.clearTimeout(this._restartTimeout);
|
|
328
|
-
this.emit('result', transcript);
|
|
329
|
-
}
|
|
330
|
-
catch { }
|
|
331
|
-
this.restart();
|
|
332
|
-
this.emit('pulse', false);
|
|
333
|
-
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_2__/* .PII */ .N);
|
|
334
|
-
};
|
|
335
|
-
if (resultItem.isFinal === false) {
|
|
336
|
-
this.emit('progress', transcript);
|
|
337
|
-
this._progressTimeout = this.async.setTimeout(resultHandler, 500);
|
|
349
|
+
this.__interimResults = '';
|
|
350
|
+
if (!e.results) {
|
|
338
351
|
return;
|
|
339
352
|
}
|
|
340
|
-
|
|
353
|
+
for (let i = 0; i < e.results.length; i++) {
|
|
354
|
+
const resultItem = e.results.item(i);
|
|
355
|
+
if (resultItem.length) {
|
|
356
|
+
const { transcript } = resultItem.item(0);
|
|
357
|
+
this.__interimResults += transcript;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (this.__interimResults) {
|
|
361
|
+
this.emit('progress', this.__interimResults);
|
|
362
|
+
}
|
|
341
363
|
}
|
|
342
|
-
_onError() {
|
|
343
|
-
if (
|
|
344
|
-
|
|
364
|
+
_onError(e) {
|
|
365
|
+
if (e.error === 'voice-unavailable') {
|
|
366
|
+
this.emit('error', 'Voice unavailable');
|
|
367
|
+
}
|
|
368
|
+
if (e.error === 'not-allowed') {
|
|
369
|
+
this.emit('error', 'Not allowed');
|
|
370
|
+
}
|
|
371
|
+
if (e.error === 'language-unavailable' ||
|
|
372
|
+
// @ts-ignore
|
|
373
|
+
e.error === 'language-not-supported') {
|
|
374
|
+
this.emit('error', 'Language unavailable');
|
|
345
375
|
}
|
|
346
376
|
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_2__/* .WARN */ .Z);
|
|
347
377
|
this.emit('pulse', false);
|
|
348
|
-
this.
|
|
378
|
+
this.stop();
|
|
349
379
|
}
|
|
350
380
|
_makeSound(frequency) {
|
|
351
381
|
if (this.sound) {
|
|
@@ -474,17 +504,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
474
504
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
475
505
|
/* harmony export */ SpeechRecognizeNative: function() { return /* binding */ SpeechRecognizeNative; }
|
|
476
506
|
/* harmony export */ });
|
|
477
|
-
/* harmony import */ var
|
|
478
|
-
/* harmony import */ var
|
|
479
|
-
/* harmony import */ var
|
|
480
|
-
/* harmony import */ var
|
|
481
|
-
/* harmony import */ var
|
|
482
|
-
/* harmony import */ var
|
|
483
|
-
/* harmony import */ var
|
|
484
|
-
/* harmony import */ var
|
|
485
|
-
/* harmony import */ var
|
|
486
|
-
/* harmony import */ var
|
|
487
|
-
/* harmony import */ var _langs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(25202);
|
|
507
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(31635);
|
|
508
|
+
/* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66927);
|
|
509
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55186);
|
|
510
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
|
|
511
|
+
/* harmony import */ var jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84976);
|
|
512
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71005);
|
|
513
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(71096);
|
|
514
|
+
/* harmony import */ var _jodit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46173);
|
|
515
|
+
/* harmony import */ var _helpers_exec_spell_command__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(50834);
|
|
516
|
+
/* harmony import */ var _langs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(25202);
|
|
488
517
|
/*!
|
|
489
518
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
490
519
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -501,23 +530,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
501
530
|
|
|
502
531
|
|
|
503
532
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
if (j.o.speechRecognize.api) {
|
|
510
|
-
j.registerButton({
|
|
533
|
+
class SpeechRecognizeNative extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .k {
|
|
534
|
+
constructor() {
|
|
535
|
+
super(...arguments);
|
|
536
|
+
this.buttons = [
|
|
537
|
+
{
|
|
511
538
|
group: 'state',
|
|
512
539
|
name: 'speechRecognize'
|
|
513
|
-
}
|
|
514
|
-
|
|
540
|
+
}
|
|
541
|
+
];
|
|
542
|
+
this._commandToWord = {};
|
|
515
543
|
}
|
|
516
544
|
afterInit(jodit) {
|
|
517
545
|
const { commands } = jodit.o.speechRecognize;
|
|
518
546
|
if (commands) {
|
|
519
|
-
(0,
|
|
520
|
-
(0,
|
|
547
|
+
(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .extendLang */ .JW)(_langs__WEBPACK_IMPORTED_MODULE_7__);
|
|
548
|
+
(0,jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_3__/* .keys */ .HP)(commands, false).forEach(words => {
|
|
521
549
|
const keys = words.split('|');
|
|
522
550
|
keys.forEach(key => {
|
|
523
551
|
key = key.trim().toLowerCase();
|
|
@@ -532,28 +560,30 @@ class SpeechRecognizeNative extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5
|
|
|
532
560
|
});
|
|
533
561
|
}
|
|
534
562
|
}
|
|
535
|
-
beforeDestruct(jodit) {
|
|
563
|
+
beforeDestruct(jodit) {
|
|
564
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
565
|
+
}
|
|
536
566
|
onSpeechRecognizeProgressResult(text) {
|
|
537
567
|
if (!this.messagePopup) {
|
|
538
568
|
this.messagePopup = this.j.create.div('jodit-speech-recognize__popup');
|
|
539
569
|
}
|
|
540
570
|
this.j.workplace.appendChild(this.messagePopup);
|
|
541
|
-
this.j.async.
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
timeout: 1000
|
|
546
|
-
});
|
|
571
|
+
this.j.async.clearTimeout(this.__hidePopupTimeout);
|
|
572
|
+
this.__hidePopupTimeout = this.j.async.setTimeout(() => {
|
|
573
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
574
|
+
}, 1000);
|
|
547
575
|
this.messagePopup.innerText = text + '|';
|
|
548
576
|
}
|
|
549
577
|
onSpeechRecognizeResult(text) {
|
|
550
|
-
|
|
551
|
-
|
|
578
|
+
this.j.async.clearTimeout(this.__hidePopupTimeout);
|
|
579
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
580
|
+
const { j } = this;
|
|
581
|
+
const { s } = j;
|
|
552
582
|
if (!this._checkCommand(text)) {
|
|
553
583
|
const { range } = s, node = s.current();
|
|
554
584
|
if (s.isCollapsed() &&
|
|
555
|
-
|
|
556
|
-
|
|
585
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(node) &&
|
|
586
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(j.editor, node) &&
|
|
557
587
|
node.nodeValue) {
|
|
558
588
|
const sentence = node.nodeValue;
|
|
559
589
|
node.nodeValue =
|
|
@@ -572,20 +602,19 @@ class SpeechRecognizeNative extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5
|
|
|
572
602
|
_checkCommand(command) {
|
|
573
603
|
command = command.toLowerCase().replace(/\./g, '');
|
|
574
604
|
if (this._commandToWord[command]) {
|
|
575
|
-
(0,
|
|
605
|
+
(0,_helpers_exec_spell_command__WEBPACK_IMPORTED_MODULE_8__/* .execSpellCommand */ .F)(this.j, this._commandToWord[command]);
|
|
576
606
|
return true;
|
|
577
607
|
}
|
|
578
608
|
return false;
|
|
579
609
|
}
|
|
580
610
|
}
|
|
581
|
-
(0,
|
|
582
|
-
(0,
|
|
583
|
-
(0,jodit_core_decorators_debounce_debounce__WEBPACK_IMPORTED_MODULE_0__/* .debounce */ .s)()
|
|
611
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_9__/* .__decorate */ .Cg)([
|
|
612
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__/* .watch */ .w)(':speechRecognizeProgressResult')
|
|
584
613
|
], SpeechRecognizeNative.prototype, "onSpeechRecognizeProgressResult", null);
|
|
585
|
-
(0,
|
|
586
|
-
(0,
|
|
614
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_9__/* .__decorate */ .Cg)([
|
|
615
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__/* .watch */ .w)(':speechRecognizeResult')
|
|
587
616
|
], SpeechRecognizeNative.prototype, "onSpeechRecognizeResult", null);
|
|
588
|
-
|
|
617
|
+
_jodit__WEBPACK_IMPORTED_MODULE_6__/* .Jodit */ .x.plugins.add('speech-recognize', SpeechRecognizeNative);
|
|
589
618
|
|
|
590
619
|
|
|
591
620
|
/***/ }),
|
|
@@ -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
|
-
((e,t)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}})(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[882],{71096(e,t,s){"use strict";var i=s(9810),n=s(
|
|
10
|
+
((e,t)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}})(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[882],{71096(e,t,s){"use strict";var i=s(9810),n=s(98253),r=s(26150),o=s(72197),u=s(931),c=s(36115),a=s(71722),h=s(93676),l=s(22227),p=s.n(l);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",p()),c.T.prototype.controls.speechRecognize={isVisible:e=>!!e.o.speechRecognize.api,isActive(e,t){const s=(0,o.m)(e,"speech");return!!s?.isEnabled},isDisabled:e=>!e.o.speechRecognize.api,exec(e,t,{button:s,control:u}){const{api:c,lang:a,continuous:l,interimResults:p,sound:d}=e.o.speechRecognize;if(!c)return void e.alert("Speech recognize API unsupported in your browser");let m=(0,o.m)(e,"speech");if(!m){const t=new c;m=new h.g(e.async,t),m.lang=(0,n.K)(a)?a:(0,r.C)(e.od.documentElement,"lang")??void 0,m.continuous=l,m.interimResults=p,m.sound=d,(0,o.m)(e,"speech",m),m.on("pulse",(e=>{s.setMod("pulse",e)})),m.on("result",(t=>e.e.fire("speechRecognizeResult",t))),m.on("progress",(t=>e.e.fire("speechRecognizeProgressResult",t))),m.on("error",(t=>e.message.error(t))),s.hookStatus("beforeDestruct",(()=>{(0,o.m)(e,"speech",null),m.destruct()}))}if(u.args){const e=u.args[0];if((0,i.L)(m[e]))return m[e]=!m[e],void(m.isEnabled&&m.restart())}m.toggle(),m.isEnabled&&s.setMod("pulse",!0),s.state.activated=m.isEnabled},name:"speechRecognize",command:"toggleSpeechRecognize",tooltip:"Speech Recognize",list:{sound:"Sound",interimResults:"Interim Results"},childTemplate(e,t,s){const i=(0,o.m)(e,"speech");return`<span class='jodit-speech-recognize__list-item'><input ${i?.[t]??e.o.speechRecognize[t]?"checked":""} class='jodit-checkbox' type='checkbox'> ${s}</span>`},mods:{stroke:!1}}},81629(e,t,s){"use strict";s.d(t,{N(){return i},Z(){return n}});const i=440,n=940},71722(e,t,s){"use strict";s.d(t,{o(){return i}});const i=window.SpeechRecognition||window.webkitSpeechRecognition},50834(e,t,s){"use strict";function i(e,t){const[s,i]=t.split("::");e.execCommand(s,null,i)}s.d(t,{F(){return i}})},93676(e,t,s){"use strict";s.d(t,{g(){return a}});var i,n=s(31635),r=s(22664),o=s(43431),u=s(95473),c=s(81629);let a=i=class e extends o.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,i._instances.add(this)}destruct(){this.stop(),i._instances.delete(this),super.destruct()}get isEnabled(){return this._isEnabled}start(){if(!this._isEnabled){this._isEnabled=!0,i._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 s=e.results.item(t);if(s.length){const{transcript:e}=s.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=i=(0,n.Cg)([r.autobind],a)},95473(e,t,s){"use strict";s.d(t,{s(){return n}});var i=s(81629);function n({sec:e=.1,frequency:t=i.N,gain:s=.1,type:n="sine"}={}){if(void 0===window.AudioContext&&void 0===window.webkitAudioContext)return;const r=new(window.AudioContext||window.webkitAudioContext),o=r.createGain(),u=r.createOscillator();u.type=n,u.frequency.value=t,u.connect(o),o.connect(r.destination),u.start(),u.stop(r.currentTime+e),o.gain.value=s}},25202(e,t,s){"use strict";s.r(t),s.d(t,{ar(){return i},cs_cz(){return i},de(){return i},es(){return i},fa(){return i},fi(){return i},fr(){return i},he(){return i},hu(){return i},id(){return i},it(){return i},ja(){return i},ko(){return i},mn(){return i},nl(){return i},pl(){return i},pt_br(){return i},ru(){return i},tr(){return i},zh_cn(){return i},zh_tw(){return i}});var i=s(41324)},37873(e,t,s){"use strict";s.r(t),s.d(t,{SpeechRecognizeNative(){return p}});var i=s(31635),n=s(66927),r=s(55186),o=s(56298),u=s(84976),c=s(71005),a=(s(71096),s(46173)),h=s(50834),l=s(25202);class p extends c.k{constructor(){super(...arguments),this.buttons=[{group:"state",name:"speechRecognize"}],this._commandToWord={}}afterInit(e){const{commands:t}=e.o.speechRecognize;t&&((0,o.JW)(l),(0,u.HP)(t,!1).forEach((s=>{s.split("|").forEach((i=>{i=i.trim().toLowerCase(),this._commandToWord[i]=t[s];const n=e.i18n(i);n!==i&&n.split("|").forEach((e=>{this._commandToWord[e.trim().toLowerCase()]=t[s].trim()}))}))})))}beforeDestruct(e){r.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((()=>{r.J.safeRemove(this.messagePopup)}),1e3),this.messagePopup.innerText=e+"|"}onSpeechRecognizeResult(e){this.j.async.clearTimeout(this.__hidePopupTimeout),r.J.safeRemove(this.messagePopup);const{j:t}=this,{s}=t;if(!this._checkCommand(e)){const{range:i}=s,n=s.current();if(s.isCollapsed()&&r.J.isText(n)&&r.J.isOrContains(t.editor,n)&&n.nodeValue){const r=n.nodeValue;n.nodeValue=r+(/[\u00A0 ]\uFEFF*$/.test(r)?"":" ")+e,i.setStartAfter(n),s.selectRange(i),t.synchronizeValues()}else s.insertHTML(e)}}_checkCommand(e){return e=e.toLowerCase().replace(/\./g,""),!!this._commandToWord[e]&&((0,h.F)(this.j,this._commandToWord[e]),!0)}}(0,i.Cg)([(0,n.w)(":speechRecognizeProgressResult")],p.prototype,"onSpeechRecognizeProgressResult",null),(0,i.Cg)([(0,n.w)(":speechRecognizeResult")],p.prototype,"onSpeechRecognizeResult",null),a.x.plugins.add("speech-recognize",p)},22227(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>'}},e=>e(e.s=37873)])}));
|
package/es5/jodit.css
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
10
10
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
11
|
-
* Version: v4.2.
|
|
11
|
+
* Version: v4.2.24
|
|
12
12
|
* Url: https://xdsoft.net/jodit/
|
|
13
13
|
* License(s): MIT
|
|
14
14
|
*/
|