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(j) {
|
|
67
|
+
return Boolean(j.o.speechRecognize.api);
|
|
68
|
+
},
|
|
66
69
|
isActive(jodit, _) {
|
|
67
70
|
const api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_0__/* .dataBind */ .m)(jodit, 'speech');
|
|
68
71
|
return Boolean(api?.isEnabled);
|
|
@@ -71,14 +74,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
71
74
|
return !jodit.o.speechRecognize.api;
|
|
72
75
|
},
|
|
73
76
|
exec(jodit, current, { button, control }) {
|
|
74
|
-
const { api:
|
|
75
|
-
if (!
|
|
77
|
+
const { api: ApiConstructor, lang, continuous, interimResults, sound } = jodit.o.speechRecognize;
|
|
78
|
+
if (!ApiConstructor) {
|
|
76
79
|
jodit.alert('Speech recognize API unsupported in your browser');
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
82
|
let api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_0__/* .dataBind */ .m)(jodit, 'speech');
|
|
80
83
|
if (!api) {
|
|
81
|
-
const nativeApi = new
|
|
84
|
+
const nativeApi = new ApiConstructor();
|
|
82
85
|
api = new _helpers_recognize_manager__WEBPACK_IMPORTED_MODULE_4__/* .RecognizeManager */ .g(jodit.async, nativeApi);
|
|
83
86
|
api.lang = lang;
|
|
84
87
|
api.continuous = continuous;
|
|
@@ -90,7 +93,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
90
93
|
});
|
|
91
94
|
api.on('result', (text) => jodit.e.fire('speechRecognizeResult', text));
|
|
92
95
|
api.on('progress', (text) => jodit.e.fire('speechRecognizeProgressResult', text));
|
|
96
|
+
api.on('error', (text) => jodit.message.error(text));
|
|
93
97
|
button.hookStatus('beforeDestruct', () => {
|
|
98
|
+
(0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_0__/* .dataBind */ .m)(jodit, 'speech', null);
|
|
94
99
|
api.destruct();
|
|
95
100
|
});
|
|
96
101
|
}
|
|
@@ -105,6 +110,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.spe
|
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
112
|
api.toggle();
|
|
113
|
+
if (api.isEnabled) {
|
|
114
|
+
button.setMod('pulse', true);
|
|
115
|
+
}
|
|
108
116
|
button.state.activated = api.isEnabled;
|
|
109
117
|
},
|
|
110
118
|
name: 'speechRecognize',
|
|
@@ -252,7 +260,7 @@ let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends jodit
|
|
|
252
260
|
}, 5000);
|
|
253
261
|
this.emit('pulse', true);
|
|
254
262
|
};
|
|
255
|
-
this.
|
|
263
|
+
this.__interimResults = '';
|
|
256
264
|
this._api = api;
|
|
257
265
|
RecognizeManager_1._instances.add(this);
|
|
258
266
|
}
|
|
@@ -274,23 +282,29 @@ let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends jodit
|
|
|
274
282
|
instance.stop();
|
|
275
283
|
}
|
|
276
284
|
});
|
|
277
|
-
|
|
285
|
+
try {
|
|
286
|
+
this._api.start();
|
|
287
|
+
}
|
|
288
|
+
catch (e) {
|
|
289
|
+
this._onError(e);
|
|
290
|
+
this.stop();
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
278
293
|
this.__on('speechstart', this._onSpeechStart)
|
|
279
294
|
.__on('error', this._onError)
|
|
280
|
-
.__on('result', this.
|
|
295
|
+
.__on('result', this._onProgress)
|
|
296
|
+
.__on('end', this._onResults);
|
|
281
297
|
}
|
|
282
298
|
stop() {
|
|
283
299
|
if (!this._isEnabled) {
|
|
284
300
|
return;
|
|
285
301
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this._api.stop();
|
|
289
|
-
}
|
|
290
|
-
catch { }
|
|
302
|
+
this._api.abort();
|
|
303
|
+
this._api.stop();
|
|
291
304
|
this.__off('speechstart', this._onSpeechStart)
|
|
292
305
|
.__off('error', this._onError)
|
|
293
|
-
.__off('result', this.
|
|
306
|
+
.__off('result', this._onProgress)
|
|
307
|
+
.__off('end', this._onResults);
|
|
294
308
|
this.async.clearTimeout(this._restartTimeout);
|
|
295
309
|
this._isEnabled = false;
|
|
296
310
|
this.emit('pulse', false);
|
|
@@ -315,37 +329,45 @@ let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends jodit
|
|
|
315
329
|
this._api.removeEventListener(event, callback);
|
|
316
330
|
return this;
|
|
317
331
|
}
|
|
318
|
-
|
|
332
|
+
_onResults(e) {
|
|
333
|
+
this.emit('pulse', false);
|
|
334
|
+
this.emit('result', this.__interimResults);
|
|
335
|
+
this.__interimResults = '';
|
|
336
|
+
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_2__/* .PII */ .N);
|
|
337
|
+
this.restart();
|
|
338
|
+
}
|
|
339
|
+
_onProgress(e) {
|
|
319
340
|
if (!this._isEnabled) {
|
|
320
341
|
return;
|
|
321
342
|
}
|
|
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);
|
|
343
|
+
this.__interimResults = '';
|
|
344
|
+
if (!e.results) {
|
|
338
345
|
return;
|
|
339
346
|
}
|
|
340
|
-
|
|
347
|
+
for (let i = 0; i < e.results.length; i++) {
|
|
348
|
+
const resultItem = e.results.item(i);
|
|
349
|
+
const { transcript } = resultItem.item(0);
|
|
350
|
+
this.__interimResults += transcript;
|
|
351
|
+
}
|
|
352
|
+
if (this.__interimResults) {
|
|
353
|
+
this.emit('progress', this.__interimResults);
|
|
354
|
+
}
|
|
341
355
|
}
|
|
342
|
-
_onError() {
|
|
343
|
-
if (
|
|
344
|
-
|
|
356
|
+
_onError(e) {
|
|
357
|
+
if (e.error === 'voice-unavailable') {
|
|
358
|
+
this.emit('error', 'Voice unavailable');
|
|
359
|
+
}
|
|
360
|
+
if (e.error === 'not-allowed') {
|
|
361
|
+
this.emit('error', 'Not allowed');
|
|
362
|
+
}
|
|
363
|
+
if (e.error === 'language-unavailable' ||
|
|
364
|
+
// @ts-ignore
|
|
365
|
+
e.error === 'language-not-supported') {
|
|
366
|
+
this.emit('error', 'Language unavailable');
|
|
345
367
|
}
|
|
346
368
|
this._makeSound(jodit_plugins_speech_recognize_constants__WEBPACK_IMPORTED_MODULE_2__/* .WARN */ .Z);
|
|
347
369
|
this.emit('pulse', false);
|
|
348
|
-
this.
|
|
370
|
+
this.stop();
|
|
349
371
|
}
|
|
350
372
|
_makeSound(frequency) {
|
|
351
373
|
if (this.sound) {
|
|
@@ -474,17 +496,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
474
496
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
475
497
|
/* harmony export */ SpeechRecognizeNative: function() { return /* binding */ SpeechRecognizeNative; }
|
|
476
498
|
/* 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);
|
|
499
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(31635);
|
|
500
|
+
/* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66927);
|
|
501
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55186);
|
|
502
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
|
|
503
|
+
/* harmony import */ var jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84976);
|
|
504
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71005);
|
|
505
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(71096);
|
|
506
|
+
/* harmony import */ var _jodit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46173);
|
|
507
|
+
/* harmony import */ var _helpers_exec_spell_command__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(50834);
|
|
508
|
+
/* harmony import */ var _langs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(25202);
|
|
488
509
|
/*!
|
|
489
510
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
490
511
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -501,23 +522,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
501
522
|
|
|
502
523
|
|
|
503
524
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
if (j.o.speechRecognize.api) {
|
|
510
|
-
j.registerButton({
|
|
525
|
+
class SpeechRecognizeNative extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .k {
|
|
526
|
+
constructor() {
|
|
527
|
+
super(...arguments);
|
|
528
|
+
this.buttons = [
|
|
529
|
+
{
|
|
511
530
|
group: 'state',
|
|
512
531
|
name: 'speechRecognize'
|
|
513
|
-
}
|
|
514
|
-
|
|
532
|
+
}
|
|
533
|
+
];
|
|
534
|
+
this._commandToWord = {};
|
|
515
535
|
}
|
|
516
536
|
afterInit(jodit) {
|
|
517
537
|
const { commands } = jodit.o.speechRecognize;
|
|
518
538
|
if (commands) {
|
|
519
|
-
(0,
|
|
520
|
-
(0,
|
|
539
|
+
(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .extendLang */ .JW)(_langs__WEBPACK_IMPORTED_MODULE_7__);
|
|
540
|
+
(0,jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_3__/* .keys */ .HP)(commands, false).forEach(words => {
|
|
521
541
|
const keys = words.split('|');
|
|
522
542
|
keys.forEach(key => {
|
|
523
543
|
key = key.trim().toLowerCase();
|
|
@@ -532,28 +552,30 @@ class SpeechRecognizeNative extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5
|
|
|
532
552
|
});
|
|
533
553
|
}
|
|
534
554
|
}
|
|
535
|
-
beforeDestruct(jodit) {
|
|
555
|
+
beforeDestruct(jodit) {
|
|
556
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
557
|
+
}
|
|
536
558
|
onSpeechRecognizeProgressResult(text) {
|
|
537
559
|
if (!this.messagePopup) {
|
|
538
560
|
this.messagePopup = this.j.create.div('jodit-speech-recognize__popup');
|
|
539
561
|
}
|
|
540
562
|
this.j.workplace.appendChild(this.messagePopup);
|
|
541
|
-
this.j.async.
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
timeout: 1000
|
|
546
|
-
});
|
|
563
|
+
this.j.async.clearTimeout(this.__hidePopupTimeout);
|
|
564
|
+
this.__hidePopupTimeout = this.j.async.setTimeout(() => {
|
|
565
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
566
|
+
}, 1000);
|
|
547
567
|
this.messagePopup.innerText = text + '|';
|
|
548
568
|
}
|
|
549
569
|
onSpeechRecognizeResult(text) {
|
|
550
|
-
|
|
551
|
-
|
|
570
|
+
this.j.async.clearTimeout(this.__hidePopupTimeout);
|
|
571
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.safeRemove(this.messagePopup);
|
|
572
|
+
const { j } = this;
|
|
573
|
+
const { s } = j;
|
|
552
574
|
if (!this._checkCommand(text)) {
|
|
553
575
|
const { range } = s, node = s.current();
|
|
554
576
|
if (s.isCollapsed() &&
|
|
555
|
-
|
|
556
|
-
|
|
577
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(node) &&
|
|
578
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(j.editor, node) &&
|
|
557
579
|
node.nodeValue) {
|
|
558
580
|
const sentence = node.nodeValue;
|
|
559
581
|
node.nodeValue =
|
|
@@ -572,20 +594,19 @@ class SpeechRecognizeNative extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5
|
|
|
572
594
|
_checkCommand(command) {
|
|
573
595
|
command = command.toLowerCase().replace(/\./g, '');
|
|
574
596
|
if (this._commandToWord[command]) {
|
|
575
|
-
(0,
|
|
597
|
+
(0,_helpers_exec_spell_command__WEBPACK_IMPORTED_MODULE_8__/* .execSpellCommand */ .F)(this.j, this._commandToWord[command]);
|
|
576
598
|
return true;
|
|
577
599
|
}
|
|
578
600
|
return false;
|
|
579
601
|
}
|
|
580
602
|
}
|
|
581
|
-
(0,
|
|
582
|
-
(0,
|
|
583
|
-
(0,jodit_core_decorators_debounce_debounce__WEBPACK_IMPORTED_MODULE_0__/* .debounce */ .s)()
|
|
603
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_9__/* .__decorate */ .Cg)([
|
|
604
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__/* .watch */ .w)(':speechRecognizeProgressResult')
|
|
584
605
|
], SpeechRecognizeNative.prototype, "onSpeechRecognizeProgressResult", null);
|
|
585
|
-
(0,
|
|
586
|
-
(0,
|
|
606
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_9__/* .__decorate */ .Cg)([
|
|
607
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_0__/* .watch */ .w)(':speechRecognizeResult')
|
|
587
608
|
], SpeechRecognizeNative.prototype, "onSpeechRecognizeResult", null);
|
|
588
|
-
|
|
609
|
+
_jodit__WEBPACK_IMPORTED_MODULE_6__/* .Jodit */ .x.plugins.add('speech-recognize', SpeechRecognizeNative);
|
|
589
610
|
|
|
590
611
|
|
|
591
612
|
/***/ }),
|
|
@@ -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
|
-
((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),
|
|
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),r=s(72197),n=s(931),o=s(36115),u=s(71722),c=s(93676),a=s(22227),h=s.n(a);o.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"}},n.I.set("speech-recognize",h()),o.T.prototype.controls.speechRecognize={isVisible:e=>!!e.o.speechRecognize.api,isActive(e,t){const s=(0,r.m)(e,"speech");return!!s?.isEnabled},isDisabled:e=>!e.o.speechRecognize.api,exec(e,t,{button:s,control:n}){const{api:o,lang:u,continuous:a,interimResults:h,sound:l}=e.o.speechRecognize;if(!o)return void e.alert("Speech recognize API unsupported in your browser");let p=(0,r.m)(e,"speech");if(!p){const t=new o;p=new c.g(e.async,t),p.lang=u,p.continuous=a,p.interimResults=h,p.sound=l,(0,r.m)(e,"speech",p),p.on("pulse",(e=>{s.setMod("pulse",e)})),p.on("result",(t=>e.e.fire("speechRecognizeResult",t))),p.on("progress",(t=>e.e.fire("speechRecognizeProgressResult",t))),p.on("error",(t=>e.message.error(t))),s.hookStatus("beforeDestruct",(()=>{(0,r.m)(e,"speech",null),p.destruct()}))}if(n.args){const e=n.args[0];if((0,i.L)(p[e]))return p[e]=!p[e],void(p.isEnabled&&p.restart())}p.toggle(),p.isEnabled&&s.setMod("pulse",!0),s.state.activated=p.isEnabled},name:"speechRecognize",command:"toggleSpeechRecognize",tooltip:"Speech Recognize",list:{sound:"Sound",interimResults:"Interim Results"},childTemplate(e,t,s){const i=(0,r.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 r}});const i=440,r=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,r=s(31635),n=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),{transcript:i}=s.item(0);this.__interimResults+=i}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,r.Cg)([n.autobind],a)},95473(e,t,s){"use strict";s.d(t,{s(){return r}});var i=s(81629);function r({sec:e=.1,frequency:t=i.N,gain:s=.1,type:r="sine"}={}){if(void 0===window.AudioContext&&void 0===window.webkitAudioContext)return;const n=new(window.AudioContext||window.webkitAudioContext),o=n.createGain(),u=n.createOscillator();u.type=r,u.frequency.value=t,u.connect(o),o.connect(n.destination),u.start(),u.stop(n.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),r=s(66927),n=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 r=e.i18n(i);r!==i&&r.split("|").forEach((e=>{this._commandToWord[e.trim().toLowerCase()]=t[s].trim()}))}))})))}beforeDestruct(e){n.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((()=>{n.J.safeRemove(this.messagePopup)}),1e3),this.messagePopup.innerText=e+"|"}onSpeechRecognizeResult(e){this.j.async.clearTimeout(this.__hidePopupTimeout),n.J.safeRemove(this.messagePopup);const{j:t}=this,{s}=t;if(!this._checkCommand(e)){const{range:i}=s,r=s.current();if(s.isCollapsed()&&n.J.isText(r)&&n.J.isOrContains(t.editor,r)&&r.nodeValue){const n=r.nodeValue;r.nodeValue=n+(/[\u00A0 ]\uFEFF*$/.test(n)?"":" ")+e,i.setStartAfter(r),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,r.w)(":speechRecognizeProgressResult")],p.prototype,"onSpeechRecognizeProgressResult",null),(0,i.Cg)([(0,r.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.22
|
|
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.22
|
|
12
12
|
* Url: https://xdsoft.net/jodit/
|
|
13
13
|
* License(s): MIT
|
|
14
14
|
*/
|