jodit 3.19.4 → 3.20.2
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/build/jodit.css +45 -42
- package/build/jodit.es2018.css +38 -36
- package/build/jodit.es2018.en.css +38 -36
- package/build/jodit.es2018.en.js +22562 -25637
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +1 -1
- package/build/jodit.es2018.js +23105 -26181
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +1 -1
- package/build/jodit.js +797 -386
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +1 -1
- package/build/plugins/debug/debug.es2018.en.js +97 -0
- package/build/plugins/debug/debug.es2018.en.min.js +1 -0
- package/build/plugins/debug/debug.es2018.js +97 -0
- package/build/plugins/debug/debug.es2018.min.js +1 -0
- package/build/plugins/debug/debug.js +96 -0
- package/build/plugins/debug/debug.min.js +1 -0
- package/build/plugins/speech-recognize/speech-recognize.css +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.css +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.en.css +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.en.js +331 -398
- package/build/plugins/speech-recognize/speech-recognize.es2018.en.min.js +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.js +331 -398
- package/build/plugins/speech-recognize/speech-recognize.es2018.min.js +1 -1
- package/build/plugins/speech-recognize/speech-recognize.js +1 -1
- package/build/vdom.css +1 -1
- package/build/vdom.js +1 -1
- package/index.html +2 -2
- package/package.json +9 -4
- package/src/config.ts +4 -2
- package/src/core/constants.ts +7 -7
- package/src/core/decorators/derive/README.md +71 -0
- package/src/core/decorators/derive/derive.ts +48 -0
- package/src/core/decorators/index.ts +1 -0
- package/src/core/decorators/spy/spy.ts +5 -0
- package/src/core/dom/dom.test.js +0 -1
- package/src/core/dom/dom.ts +28 -13
- package/src/core/event-emitter/observable.ts +3 -3
- package/src/core/helpers/helpers.test.js +0 -170
- package/src/core/plugin/plugin-system.ts +20 -0
- package/src/core/selection/select.ts +27 -9
- package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +5 -1
- package/src/core/selection/style/api/wrap-ordered-list.ts +5 -1
- package/src/core/selection/style/api/wrap-unwrapped-text.ts +1 -1
- package/src/core/selection/style/style.test.js +1 -1
- package/src/core/{view/panel.ts → traits/dlgs.ts} +17 -9
- package/src/core/traits/elms.ts +4 -8
- package/src/core/traits/index.ts +1 -0
- package/src/core/traits/mods.ts +17 -10
- package/src/core/ui/button/index.ts +1 -0
- package/src/{plugins → core/ui/button}/tooltip/README.md +0 -0
- package/src/{plugins → core/ui/button}/tooltip/tooltip.less +4 -4
- package/src/{plugins → core/ui/button}/tooltip/tooltip.test.js +3 -2
- package/src/core/ui/button/tooltip/tooltip.ts +132 -0
- package/src/core/ui/element.ts +5 -27
- package/src/core/ui/group/group.test.js +44 -0
- package/src/core/ui/group/group.ts +4 -4
- package/src/core/view/view-with-toolbar.ts +2 -2
- package/src/core/view/view.ts +11 -33
- package/src/jodit.ts +20 -8
- package/src/langs/ar.js +1 -1
- package/src/langs/cs_cz.js +1 -1
- package/src/langs/de.js +1 -1
- package/src/langs/es.js +1 -1
- package/src/langs/fa.js +1 -1
- package/src/langs/fr.js +1 -1
- package/src/langs/he.js +1 -1
- package/src/langs/hu.js +1 -1
- package/src/langs/i18n.test.js +170 -0
- package/src/langs/id.js +1 -1
- package/src/langs/it.js +1 -1
- package/src/langs/ja.js +1 -1
- package/src/langs/ko.js +1 -1
- package/src/langs/nl.js +1 -1
- package/src/langs/pl.js +1 -1
- package/src/langs/pt_br.js +1 -1
- package/src/langs/ru.js +1 -1
- package/src/langs/tr.js +1 -1
- package/src/langs/zh_cn.js +1 -1
- package/src/langs/zh_tw.js +1 -1
- package/src/modules/dialog/dialog.less +2 -0
- package/src/modules/dialog/dialog.ts +27 -50
- package/src/modules/file-browser/README.md +10 -10
- package/src/modules/file-browser/__image_snapshots__/file-browser-test-screenshot-js-filebrowser-screenshot-testing-open-filebrowser-works-1-snap.png +0 -0
- package/src/modules/file-browser/builders/context-menu.ts +1 -1
- package/src/modules/file-browser/file-browser.test.js +26 -13
- package/src/modules/file-browser/file-browser.test.screenshot.js +23 -0
- package/src/modules/file-browser/file-browser.ts +9 -5
- package/src/modules/history/snapshot.ts +12 -3
- package/src/modules/image-editor/__image_snapshots__/image-editor-test-screenshot-js-image-editor-screenshot-testing-open-image-editor-works-1-snap.png +0 -0
- package/src/modules/image-editor/image-editor.test.screenshot.js +25 -0
- package/src/modules/image-editor/image-editor.ts +7 -6
- package/src/modules/status-bar/status-bar.ts +5 -16
- package/src/modules/table/table.test.js +2 -1
- package/src/modules/toolbar/collection/collection.ts +6 -1
- package/src/modules/uploader/README.md +1 -1
- package/src/modules/uploader/config.ts +1 -1
- package/src/modules/uploader/uploader.test.js +96 -46
- package/src/plugins/about/about.ts +1 -1
- package/src/plugins/add-new-line/add-new-line.ts +5 -4
- package/src/plugins/backspace/backspace.test.js +33 -39
- package/src/plugins/backspace/backspace.ts +10 -4
- package/src/plugins/backspace/cases/check-remove-char.ts +36 -14
- package/src/plugins/backspace/cases/check-remove-unbreakable-element.ts +8 -0
- package/src/plugins/backspace/config.ts +1 -1
- package/src/plugins/backspace/interface.d.ts +1 -1
- package/src/plugins/clean-html/clean-html.test.js +240 -164
- package/src/plugins/clean-html/config.ts +10 -2
- package/src/plugins/clean-html/helpers/remove-format/remove-format-for-collapsed-selection.ts +3 -2
- package/src/plugins/clean-html/helpers/remove-format/remove-format-for-selection.ts +2 -2
- package/src/plugins/clean-html/helpers/visitor/filters/index.ts +1 -0
- package/src/plugins/clean-html/helpers/visitor/filters/remove-empty-text-node.ts +35 -0
- package/src/plugins/clean-html/helpers/visitor/filters/remove-inv-text-nodes.ts +2 -6
- package/src/plugins/clean-html/helpers/visitor/visit-node-walker.ts +5 -0
- package/src/plugins/debug/debug.ts +68 -0
- package/src/plugins/drag-and-drop/drag-and-drop.ts +0 -1
- package/src/plugins/drag-and-drop-element/drag-and-drop-element.test.js +37 -34
- package/src/plugins/dtd/README.md +52 -0
- package/{types/plugins/tooltip/tooltip.d.ts → src/plugins/dtd/after-insert/index.ts} +5 -4
- package/src/plugins/dtd/after-insert/remove-extra-br.ts +39 -0
- package/src/plugins/dtd/before-insert/check-block-nesting.ts +40 -0
- package/src/plugins/dtd/before-insert/index.ts +12 -0
- package/src/plugins/dtd/config.ts +67 -0
- package/src/plugins/dtd/dtd.test.js +128 -0
- package/src/plugins/dtd/dtd.ts +48 -0
- package/src/plugins/enter/enter.test.js +89 -193
- package/src/plugins/enter/enter.ts +14 -11
- package/src/plugins/enter/helpers/check-br.ts +11 -1
- package/src/plugins/enter/helpers/index.ts +1 -0
- package/src/plugins/enter/helpers/move-cursor-out-from-specal-tags.ts +32 -0
- package/src/plugins/enter/helpers/split-fragment.ts +1 -0
- package/src/plugins/fullsize/config.ts +1 -1
- package/src/plugins/fullsize/fullsize.test.js +77 -12
- package/src/plugins/fullsize/fullsize.ts +12 -1
- package/src/plugins/iframe/config.ts +1 -1
- package/src/plugins/image-properties/README.md +7 -0
- package/src/plugins/image-properties/image-properties.ts +1 -1
- package/src/plugins/index.ts +1 -1
- package/src/plugins/limit/limit.test.js +27 -0
- package/src/plugins/limit/limit.ts +4 -2
- package/src/plugins/line-height/line-height.svg +1 -1
- package/src/plugins/link/README.md +5 -0
- package/src/plugins/link/link.test.js +11 -12
- package/src/plugins/link/link.ts +1 -1
- package/src/plugins/mobile/mobile.ts +1 -1
- package/src/plugins/ordered-list/ordered-list.test.js +3 -14
- package/src/plugins/paste/config.ts +0 -7
- package/src/plugins/paste/paste.test.js +3 -3
- package/src/plugins/paste-storage/paste-storage.ts +1 -1
- package/src/plugins/preview/preview.ts +1 -1
- package/src/plugins/search/search.ts +1 -1
- package/src/plugins/select/config.ts +1 -1
- package/src/plugins/spellcheck/config.ts +1 -1
- package/src/plugins/symbols/symbols.test.js +5 -4
- package/src/plugins/table/config.ts +4 -17
- package/src/plugins/table/table.test.js +2 -2
- package/src/plugins/wrap-nodes/wrap-nodes.test.js +34 -5
- package/src/plugins/wrap-nodes/wrap-nodes.ts +59 -16
- package/src/styles/variables.less +1 -1
- package/src/types/ajax.d.ts +2 -2
- package/src/types/file-browser.d.ts +4 -2
- package/src/types/jodit.d.ts +3 -2
- package/src/types/plugin.d.ts +1 -0
- package/src/types/toolbar.d.ts +12 -6
- package/src/types/traits.d.ts +30 -1
- package/src/types/types.d.ts +1 -0
- package/src/types/view.d.ts +9 -34
- package/src/typings.d.ts +1 -0
- package/types/config.d.ts +3 -2
- package/types/core/constants.d.ts +7 -7
- package/types/core/decorators/derive/derive.d.ts +6 -0
- package/types/core/decorators/index.d.ts +1 -0
- package/types/core/dom/dom.d.ts +5 -4
- package/types/core/plugin/plugin-system.d.ts +4 -0
- package/types/core/traits/dlgs.d.ts +15 -0
- package/types/core/traits/elms.d.ts +2 -4
- package/types/core/traits/index.d.ts +1 -0
- package/types/core/traits/mods.d.ts +5 -8
- package/types/core/ui/button/index.d.ts +1 -0
- package/types/core/ui/button/tooltip/tooltip.d.ts +29 -0
- package/types/core/ui/element.d.ts +3 -9
- package/types/core/ui/group/group.d.ts +2 -2
- package/types/core/view/view-with-toolbar.d.ts +2 -2
- package/types/core/view/view.d.ts +5 -10
- package/types/jodit.d.ts +7 -4
- package/types/modules/dialog/dialog.d.ts +8 -10
- package/types/modules/file-browser/file-browser.d.ts +5 -2
- package/types/modules/history/snapshot.d.ts +3 -2
- package/types/modules/image-editor/image-editor.d.ts +4 -4
- package/types/modules/status-bar/status-bar.d.ts +3 -4
- package/types/modules/toolbar/collection/collection.d.ts +1 -0
- package/types/plugins/clean-html/config.d.ts +7 -1
- package/types/plugins/clean-html/helpers/visitor/filters/index.d.ts +1 -0
- package/types/plugins/clean-html/helpers/visitor/filters/remove-empty-text-node.d.ts +13 -0
- package/types/plugins/dtd/after-insert/index.d.ts +10 -0
- package/types/plugins/dtd/after-insert/remove-extra-br.d.ts +16 -0
- package/types/plugins/dtd/before-insert/check-block-nesting.d.ts +16 -0
- package/types/plugins/dtd/before-insert/index.d.ts +10 -0
- package/types/plugins/dtd/config.d.ts +27 -0
- package/types/plugins/dtd/dtd.d.ts +6 -0
- package/types/plugins/enter/helpers/index.d.ts +1 -0
- package/types/plugins/enter/helpers/move-cursor-out-from-specal-tags.d.ts +13 -0
- package/types/plugins/iframe/config.d.ts +1 -1
- package/types/plugins/index.d.ts +1 -1
- package/types/plugins/paste/config.d.ts +0 -4
- package/types/plugins/spellcheck/config.d.ts +1 -1
- package/types/types/ajax.d.ts +2 -2
- package/types/types/file-browser.d.ts +4 -2
- package/types/types/jodit.d.ts +3 -2
- package/types/types/plugin.d.ts +1 -0
- package/types/types/toolbar.d.ts +12 -6
- package/types/types/traits.d.ts +30 -1
- package/types/types/types.d.ts +1 -0
- package/types/types/view.d.ts +9 -34
- package/src/plugins/tooltip/tooltip.ts +0 -114
- package/types/core/view/panel.d.ts +0 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/)
|
|
4
|
-
* Version: v3.
|
|
4
|
+
* Version: v3.20.2
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -25,279 +25,217 @@ module.exports = "<svg viewBox=\"0 0 16 16\" xml:space=\"preserve\" xmlns=\"http
|
|
|
25
25
|
|
|
26
26
|
/***/ }),
|
|
27
27
|
|
|
28
|
-
/***/
|
|
28
|
+
/***/ 86937:
|
|
29
29
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
30
30
|
|
|
31
31
|
"use strict";
|
|
32
32
|
__webpack_require__.r(__webpack_exports__);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
33
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
34
|
+
/* harmony export */ "ar": function() { return /* binding */ ar; },
|
|
35
|
+
/* harmony export */ "cs_cz": function() { return /* binding */ cs_cz; },
|
|
36
|
+
/* harmony export */ "de": function() { return /* binding */ de; },
|
|
37
|
+
/* harmony export */ "es": function() { return /* binding */ es; },
|
|
38
|
+
/* harmony export */ "fa": function() { return /* binding */ fa; },
|
|
39
|
+
/* harmony export */ "fr": function() { return /* binding */ fr; },
|
|
40
|
+
/* harmony export */ "he": function() { return /* binding */ he; },
|
|
41
|
+
/* harmony export */ "hu": function() { return /* binding */ hu; },
|
|
42
|
+
/* harmony export */ "id": function() { return /* binding */ id; },
|
|
43
|
+
/* harmony export */ "it": function() { return /* binding */ it; },
|
|
44
|
+
/* harmony export */ "ja": function() { return /* binding */ ja; },
|
|
45
|
+
/* harmony export */ "ko": function() { return /* binding */ ko; },
|
|
46
|
+
/* harmony export */ "nl": function() { return /* binding */ nl; },
|
|
47
|
+
/* harmony export */ "pl": function() { return /* binding */ pl; },
|
|
48
|
+
/* harmony export */ "pt_br": function() { return /* binding */ pt_br; },
|
|
49
|
+
/* harmony export */ "ru": function() { return /* binding */ ru; },
|
|
50
|
+
/* harmony export */ "tr": function() { return /* binding */ tr; },
|
|
51
|
+
/* harmony export */ "zh_cn": function() { return /* binding */ zh_cn; },
|
|
52
|
+
/* harmony export */ "zh_tw": function() { return /* binding */ zh_tw; }
|
|
53
|
+
/* harmony export */ });
|
|
43
54
|
/*!
|
|
44
55
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
45
56
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
46
57
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
47
58
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
dot: 'inserthtml::.',
|
|
69
|
-
'quote|quotes|open quote': "inserthtml::'",
|
|
70
|
-
'header|header h1': 'formatblock::h1',
|
|
71
|
-
'select all': 'selectall'
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
icon_1.Icon.set('speech-recognize', __webpack_require__(90327));
|
|
75
|
-
config_1.Config.prototype.controls.speechRecognize = {
|
|
76
|
-
isActive: function (jodit, _) {
|
|
77
|
-
var api = (0, data_bind_1.dataBind)(jodit, 'speech');
|
|
78
|
-
return Boolean(api === null || api === void 0 ? void 0 : api.isEnabled);
|
|
79
|
-
},
|
|
80
|
-
isDisabled: function (jodit) {
|
|
81
|
-
return !jodit.o.speechRecognize.api;
|
|
82
|
-
},
|
|
83
|
-
exec: function (jodit, current, _a) {
|
|
84
|
-
var button = _a.button, control = _a.control;
|
|
85
|
-
var _b = jodit.o.speechRecognize, Api = _b.api, lang = _b.lang, continuous = _b.continuous, interimResults = _b.interimResults, sound = _b.sound;
|
|
86
|
-
if (!Api) {
|
|
87
|
-
jodit.alert('Speech recognize API unsupported in your browser');
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
var api = (0, data_bind_1.dataBind)(jodit, 'speech');
|
|
91
|
-
if (!api) {
|
|
92
|
-
var nativeApi = new Api();
|
|
93
|
-
api = new recognize_manager_1.RecognizeManager(jodit.async, nativeApi);
|
|
94
|
-
api.lang = lang;
|
|
95
|
-
api.continuous = continuous;
|
|
96
|
-
api.interimResults = interimResults;
|
|
97
|
-
api.sound = sound;
|
|
98
|
-
(0, data_bind_1.dataBind)(jodit, 'speech', api);
|
|
99
|
-
api.on('pulse', function (enable) {
|
|
100
|
-
button.setMod('pulse', enable);
|
|
101
|
-
});
|
|
102
|
-
api.on('result', function (text) {
|
|
103
|
-
return jodit.e.fire('speechRecognizeResult', text);
|
|
104
|
-
});
|
|
105
|
-
api.on('progress', function (text) {
|
|
106
|
-
return jodit.e.fire('speechRecognizeProgressResult', text);
|
|
107
|
-
});
|
|
108
|
-
button.hookStatus('beforeDestruct', function () {
|
|
109
|
-
api.destruct();
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
if (control.args) {
|
|
113
|
-
var key = control.args[0];
|
|
114
|
-
if ((0, is_boolean_1.isBoolean)(api[key])) {
|
|
115
|
-
api[key] = !api[key];
|
|
116
|
-
if (api.isEnabled) {
|
|
117
|
-
api.restart();
|
|
118
|
-
}
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
api.toggle();
|
|
123
|
-
button.state.activated = api.isEnabled;
|
|
124
|
-
},
|
|
125
|
-
name: 'speechRecognize',
|
|
126
|
-
command: 'toggleSpeechRecognize',
|
|
127
|
-
tooltip: 'Speech Recognize',
|
|
128
|
-
list: {
|
|
129
|
-
sound: 'Sound',
|
|
130
|
-
interimResults: 'Interim Results'
|
|
131
|
-
},
|
|
132
|
-
childTemplate: function (jodit, key, value) {
|
|
133
|
-
var _a;
|
|
134
|
-
var api = (0, data_bind_1.dataBind)(jodit, 'speech'), checked = (_a = api === null || api === void 0 ? void 0 : api[key]) !== null && _a !== void 0 ? _a : jodit.o.speechRecognize[key];
|
|
135
|
-
return "<span class='jodit-speech-recognize__list-item'><input ".concat(checked ? 'checked' : '', " class='jodit-checkbox' type='checkbox'> ").concat(value, "</span>");
|
|
136
|
-
},
|
|
137
|
-
mods: {
|
|
138
|
-
stroke: false
|
|
139
|
-
}
|
|
140
|
-
};
|
|
59
|
+
const ar = __webpack_require__(5466);
|
|
60
|
+
const cs_cz = __webpack_require__(65226);
|
|
61
|
+
const de = __webpack_require__(87541);
|
|
62
|
+
const es = __webpack_require__(87104);
|
|
63
|
+
const fa = __webpack_require__(53808);
|
|
64
|
+
const fr = __webpack_require__(48954);
|
|
65
|
+
const he = __webpack_require__(14694);
|
|
66
|
+
const hu = __webpack_require__(67381);
|
|
67
|
+
const id = __webpack_require__(99549);
|
|
68
|
+
const it = __webpack_require__(28428);
|
|
69
|
+
const ja = __webpack_require__(25363);
|
|
70
|
+
const ko = __webpack_require__(96929);
|
|
71
|
+
const nl = __webpack_require__(58499);
|
|
72
|
+
const pl = __webpack_require__(59430);
|
|
73
|
+
const pt_br = __webpack_require__(70297);
|
|
74
|
+
const ru = __webpack_require__(98949);
|
|
75
|
+
const tr = __webpack_require__(61232);
|
|
76
|
+
const zh_cn = __webpack_require__(56775);
|
|
77
|
+
const zh_tw = __webpack_require__(97957);
|
|
78
|
+
|
|
141
79
|
|
|
142
80
|
|
|
143
81
|
/***/ }),
|
|
144
82
|
|
|
145
|
-
/***/
|
|
146
|
-
/***/ (function(__unused_webpack_module,
|
|
83
|
+
/***/ 56949:
|
|
84
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
147
85
|
|
|
148
86
|
"use strict";
|
|
87
|
+
// ESM COMPAT FLAG
|
|
88
|
+
__webpack_require__.r(__webpack_exports__);
|
|
149
89
|
|
|
90
|
+
// EXPORTS
|
|
91
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
92
|
+
"SpeechRecognizeNative": function() { return /* binding */ SpeechRecognizeNative; }
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// EXTERNAL MODULE: ./node_modules/tslib/tslib.es6.js
|
|
96
|
+
var tslib_es6 = __webpack_require__(20255);
|
|
97
|
+
// EXTERNAL MODULE: ./src/core/plugin/index.ts
|
|
98
|
+
var core_plugin = __webpack_require__(35570);
|
|
99
|
+
// EXTERNAL MODULE: ./src/core/decorators/watch/watch.ts
|
|
100
|
+
var watch = __webpack_require__(44101);
|
|
101
|
+
// EXTERNAL MODULE: ./src/core/helpers/utils/utils.ts
|
|
102
|
+
var utils = __webpack_require__(51976);
|
|
103
|
+
// EXTERNAL MODULE: ./src/core/global.ts
|
|
104
|
+
var global = __webpack_require__(58299);
|
|
105
|
+
// EXTERNAL MODULE: ./src/core/dom/dom.ts
|
|
106
|
+
var dom = __webpack_require__(43887);
|
|
107
|
+
// EXTERNAL MODULE: ./src/core/decorators/debounce/debounce.ts
|
|
108
|
+
var debounce = __webpack_require__(1509);
|
|
109
|
+
;// CONCATENATED MODULE: ./src/plugins/speech-recognize/helpers/exec-spell-command.ts
|
|
150
110
|
/*!
|
|
151
111
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
152
112
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
153
113
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
154
114
|
*/
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
/***/ }),
|
|
162
|
-
|
|
163
|
-
/***/ 43467:
|
|
164
|
-
/***/ (function(__unused_webpack_module, exports) {
|
|
165
|
-
|
|
166
|
-
"use strict";
|
|
115
|
+
function execSpellCommand(jodit, commandSentence) {
|
|
116
|
+
const [command, value] = commandSentence.split('::');
|
|
117
|
+
jodit.execCommand(command, null, value);
|
|
118
|
+
}
|
|
167
119
|
|
|
120
|
+
// EXTERNAL MODULE: ./src/config.ts
|
|
121
|
+
var config = __webpack_require__(27537);
|
|
122
|
+
// EXTERNAL MODULE: ./src/core/helpers/utils/data-bind.ts
|
|
123
|
+
var data_bind = __webpack_require__(70774);
|
|
124
|
+
// EXTERNAL MODULE: ./src/core/helpers/checker/is-boolean.ts
|
|
125
|
+
var is_boolean = __webpack_require__(65131);
|
|
126
|
+
// EXTERNAL MODULE: ./src/core/ui/icon.ts
|
|
127
|
+
var icon = __webpack_require__(76381);
|
|
128
|
+
// EXTERNAL MODULE: ./src/core/event-emitter/eventify.ts
|
|
129
|
+
var eventify = __webpack_require__(99437);
|
|
130
|
+
// EXTERNAL MODULE: ./src/core/decorators/index.ts + 8 modules
|
|
131
|
+
var decorators = __webpack_require__(63345);
|
|
132
|
+
;// CONCATENATED MODULE: ./src/plugins/speech-recognize/constants.ts
|
|
168
133
|
/*!
|
|
169
134
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
170
135
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
171
136
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
172
137
|
*/
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
exports.SpeechRecognition = window.SpeechRecognition ||
|
|
176
|
-
window.webkitSpeechRecognition;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
/***/ }),
|
|
180
|
-
|
|
181
|
-
/***/ 99829:
|
|
182
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
183
|
-
|
|
184
|
-
"use strict";
|
|
138
|
+
const PII = 440;
|
|
139
|
+
const WARN = 940;
|
|
185
140
|
|
|
141
|
+
;// CONCATENATED MODULE: ./src/plugins/speech-recognize/helpers/sound.ts
|
|
186
142
|
/*!
|
|
187
143
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
188
144
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
189
145
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
190
146
|
*/
|
|
191
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
192
|
-
exports.execSpellCommand = void 0;
|
|
193
|
-
var tslib_1 = __webpack_require__(20255);
|
|
194
|
-
function execSpellCommand(jodit, commandSentence) {
|
|
195
|
-
var _a = tslib_1.__read(commandSentence.split('::'), 2), command = _a[0], value = _a[1];
|
|
196
|
-
jodit.execCommand(command, null, value);
|
|
197
|
-
}
|
|
198
|
-
exports.execSpellCommand = execSpellCommand;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
/***/ }),
|
|
202
147
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
148
|
+
function sound({ sec = 0.1, frequency = PII, gain = 0.1, type = 'sine' } = {}) {
|
|
149
|
+
if (typeof window.AudioContext === 'undefined' &&
|
|
150
|
+
typeof window.webkitAudioContext === 'undefined') {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const context = new (window.AudioContext ||
|
|
154
|
+
window.webkitAudioContext)();
|
|
155
|
+
const vol = context.createGain();
|
|
156
|
+
const osc = context.createOscillator();
|
|
157
|
+
osc.type = type;
|
|
158
|
+
osc.frequency.value = frequency;
|
|
159
|
+
osc.connect(vol);
|
|
160
|
+
vol.connect(context.destination);
|
|
161
|
+
osc.start();
|
|
162
|
+
osc.stop(context.currentTime + sec);
|
|
163
|
+
vol.gain.value = gain;
|
|
164
|
+
}
|
|
207
165
|
|
|
166
|
+
;// CONCATENATED MODULE: ./src/plugins/speech-recognize/helpers/recognize-manager.ts
|
|
208
167
|
/*!
|
|
209
168
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
210
169
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
211
170
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
212
171
|
*/
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
_this._onSpeechStart = function (e) {
|
|
231
|
-
if (!_this._isEnabled) {
|
|
172
|
+
var RecognizeManager_1;
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
let RecognizeManager = RecognizeManager_1 = class RecognizeManager extends eventify/* Eventify */.a {
|
|
179
|
+
constructor(async, api) {
|
|
180
|
+
super();
|
|
181
|
+
this.async = async;
|
|
182
|
+
this._continuous = false;
|
|
183
|
+
this._interimResults = false;
|
|
184
|
+
this.sound = true;
|
|
185
|
+
this._isEnabled = false;
|
|
186
|
+
this._restartTimeout = 0;
|
|
187
|
+
this._onSpeechStart = (e) => {
|
|
188
|
+
if (!this._isEnabled) {
|
|
232
189
|
return;
|
|
233
190
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
191
|
+
this.async.clearTimeout(this._restartTimeout);
|
|
192
|
+
this._restartTimeout = this.async.setTimeout(() => {
|
|
193
|
+
this.restart();
|
|
194
|
+
this.emit('pulse', false);
|
|
195
|
+
this._makeSound(WARN);
|
|
239
196
|
}, 5000);
|
|
240
|
-
|
|
197
|
+
this.emit('pulse', true);
|
|
241
198
|
};
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
RecognizeManager_1._instances.add(
|
|
245
|
-
|
|
199
|
+
this._progressTimeout = 0;
|
|
200
|
+
this._api = api;
|
|
201
|
+
RecognizeManager_1._instances.add(this);
|
|
202
|
+
}
|
|
203
|
+
set lang(v) {
|
|
204
|
+
this._lang = v;
|
|
205
|
+
this._api.lang = v;
|
|
206
|
+
}
|
|
207
|
+
get lang() {
|
|
208
|
+
return this._lang;
|
|
209
|
+
}
|
|
210
|
+
set continuous(v) {
|
|
211
|
+
this._continuous = v;
|
|
212
|
+
this._api.continuous = v;
|
|
213
|
+
}
|
|
214
|
+
get continuous() {
|
|
215
|
+
return this._continuous;
|
|
246
216
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
},
|
|
256
|
-
enumerable: false,
|
|
257
|
-
configurable: true
|
|
258
|
-
});
|
|
259
|
-
Object.defineProperty(RecognizeManager.prototype, "continuous", {
|
|
260
|
-
get: function () {
|
|
261
|
-
return this._continuous;
|
|
262
|
-
},
|
|
263
|
-
set: function (v) {
|
|
264
|
-
this._continuous = v;
|
|
265
|
-
this._api.continuous = v;
|
|
266
|
-
},
|
|
267
|
-
enumerable: false,
|
|
268
|
-
configurable: true
|
|
269
|
-
});
|
|
270
|
-
Object.defineProperty(RecognizeManager.prototype, "interimResults", {
|
|
271
|
-
get: function () {
|
|
272
|
-
return this._interimResults;
|
|
273
|
-
},
|
|
274
|
-
set: function (v) {
|
|
275
|
-
this._interimResults = v;
|
|
276
|
-
this._api.interimResults = v;
|
|
277
|
-
},
|
|
278
|
-
enumerable: false,
|
|
279
|
-
configurable: true
|
|
280
|
-
});
|
|
281
|
-
RecognizeManager.prototype.destruct = function () {
|
|
217
|
+
set interimResults(v) {
|
|
218
|
+
this._interimResults = v;
|
|
219
|
+
this._api.interimResults = v;
|
|
220
|
+
}
|
|
221
|
+
get interimResults() {
|
|
222
|
+
return this._interimResults;
|
|
223
|
+
}
|
|
224
|
+
destruct() {
|
|
282
225
|
this.stop();
|
|
283
226
|
RecognizeManager_1._instances.delete(this);
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
enumerable: false,
|
|
291
|
-
configurable: true
|
|
292
|
-
});
|
|
293
|
-
RecognizeManager.prototype.start = function () {
|
|
294
|
-
var _this = this;
|
|
227
|
+
super.destruct();
|
|
228
|
+
}
|
|
229
|
+
get isEnabled() {
|
|
230
|
+
return this._isEnabled;
|
|
231
|
+
}
|
|
232
|
+
start() {
|
|
295
233
|
if (this._isEnabled) {
|
|
296
234
|
return;
|
|
297
235
|
}
|
|
298
236
|
this._isEnabled = true;
|
|
299
|
-
RecognizeManager_1._instances.forEach(
|
|
300
|
-
if (instance !==
|
|
237
|
+
RecognizeManager_1._instances.forEach(instance => {
|
|
238
|
+
if (instance !== this) {
|
|
301
239
|
instance.stop();
|
|
302
240
|
}
|
|
303
241
|
});
|
|
@@ -305,8 +243,8 @@ var RecognizeManager = (function (_super) {
|
|
|
305
243
|
this.__on('speechstart', this._onSpeechStart)
|
|
306
244
|
.__on('error', this._onError)
|
|
307
245
|
.__on('result', this._onResult);
|
|
308
|
-
}
|
|
309
|
-
|
|
246
|
+
}
|
|
247
|
+
stop() {
|
|
310
248
|
if (!this._isEnabled) {
|
|
311
249
|
return;
|
|
312
250
|
}
|
|
@@ -321,44 +259,43 @@ var RecognizeManager = (function (_super) {
|
|
|
321
259
|
this.async.clearTimeout(this._restartTimeout);
|
|
322
260
|
this._isEnabled = false;
|
|
323
261
|
this.emit('pulse', false);
|
|
324
|
-
}
|
|
325
|
-
|
|
262
|
+
}
|
|
263
|
+
toggle() {
|
|
326
264
|
if (!this._isEnabled) {
|
|
327
265
|
this.start();
|
|
328
266
|
}
|
|
329
267
|
else {
|
|
330
268
|
this.stop();
|
|
331
269
|
}
|
|
332
|
-
}
|
|
333
|
-
|
|
270
|
+
}
|
|
271
|
+
restart() {
|
|
334
272
|
this.stop();
|
|
335
273
|
this.start();
|
|
336
|
-
}
|
|
337
|
-
|
|
274
|
+
}
|
|
275
|
+
__on(event, callback) {
|
|
338
276
|
this._api.addEventListener(event, callback);
|
|
339
277
|
return this;
|
|
340
|
-
}
|
|
341
|
-
|
|
278
|
+
}
|
|
279
|
+
__off(event, callback) {
|
|
342
280
|
this._api.removeEventListener(event, callback);
|
|
343
281
|
return this;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
var _this = this;
|
|
282
|
+
}
|
|
283
|
+
_onResult(e) {
|
|
347
284
|
if (!this._isEnabled) {
|
|
348
285
|
return;
|
|
349
286
|
}
|
|
350
287
|
this.async.clearTimeout(this._progressTimeout);
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
288
|
+
const resultItem = e.results.item(e.resultIndex);
|
|
289
|
+
const { transcript } = resultItem.item(0);
|
|
290
|
+
const resultHandler = () => {
|
|
354
291
|
try {
|
|
355
|
-
|
|
356
|
-
|
|
292
|
+
this.async.clearTimeout(this._restartTimeout);
|
|
293
|
+
this.emit('result', transcript);
|
|
357
294
|
}
|
|
358
295
|
catch (_a) { }
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
296
|
+
this.restart();
|
|
297
|
+
this.emit('pulse', false);
|
|
298
|
+
this._makeSound(PII);
|
|
362
299
|
};
|
|
363
300
|
if (resultItem.isFinal === false) {
|
|
364
301
|
this.emit('progress', transcript);
|
|
@@ -366,202 +303,200 @@ var RecognizeManager = (function (_super) {
|
|
|
366
303
|
return;
|
|
367
304
|
}
|
|
368
305
|
resultHandler();
|
|
369
|
-
}
|
|
370
|
-
|
|
306
|
+
}
|
|
307
|
+
_onError() {
|
|
371
308
|
if (!this._isEnabled) {
|
|
372
309
|
return;
|
|
373
310
|
}
|
|
374
|
-
this._makeSound(
|
|
311
|
+
this._makeSound(WARN);
|
|
375
312
|
this.emit('pulse', false);
|
|
376
313
|
this.restart();
|
|
377
|
-
}
|
|
378
|
-
|
|
314
|
+
}
|
|
315
|
+
_makeSound(frequency) {
|
|
379
316
|
if (this.sound) {
|
|
380
|
-
|
|
317
|
+
sound({ frequency });
|
|
381
318
|
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
return RecognizeManager;
|
|
389
|
-
}(eventify_1.Eventify));
|
|
390
|
-
exports.RecognizeManager = RecognizeManager;
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
/***/ }),
|
|
394
|
-
|
|
395
|
-
/***/ 87672:
|
|
396
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
RecognizeManager._instances = new Set();
|
|
322
|
+
RecognizeManager = RecognizeManager_1 = (0,tslib_es6/* __decorate */.gn)([
|
|
323
|
+
decorators.autobind
|
|
324
|
+
], RecognizeManager);
|
|
397
325
|
|
|
398
|
-
"use strict";
|
|
399
326
|
|
|
327
|
+
;// CONCATENATED MODULE: ./src/plugins/speech-recognize/helpers/api.ts
|
|
400
328
|
/*!
|
|
401
329
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
402
330
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
403
331
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
404
332
|
*/
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
var constants_1 = __webpack_require__(28511);
|
|
408
|
-
function sound(_a) {
|
|
409
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.sec, sec = _c === void 0 ? 0.1 : _c, _d = _b.frequency, frequency = _d === void 0 ? constants_1.PII : _d, _e = _b.gain, gain = _e === void 0 ? 0.1 : _e, _f = _b.type, type = _f === void 0 ? 'sine' : _f;
|
|
410
|
-
if (typeof window.AudioContext === 'undefined' &&
|
|
411
|
-
typeof window.webkitAudioContext === 'undefined') {
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
var context = new (window.AudioContext ||
|
|
415
|
-
window.webkitAudioContext)();
|
|
416
|
-
var vol = context.createGain();
|
|
417
|
-
var osc = context.createOscillator();
|
|
418
|
-
osc.type = type;
|
|
419
|
-
osc.frequency.value = frequency;
|
|
420
|
-
osc.connect(vol);
|
|
421
|
-
vol.connect(context.destination);
|
|
422
|
-
osc.start();
|
|
423
|
-
osc.stop(context.currentTime + sec);
|
|
424
|
-
vol.gain.value = gain;
|
|
425
|
-
}
|
|
426
|
-
exports.sound = sound;
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
/***/ }),
|
|
430
|
-
|
|
431
|
-
/***/ 86937:
|
|
432
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
433
|
-
|
|
434
|
-
"use strict";
|
|
333
|
+
const SpeechRecognition = window.SpeechRecognition ||
|
|
334
|
+
window.webkitSpeechRecognition;
|
|
435
335
|
|
|
336
|
+
;// CONCATENATED MODULE: ./src/plugins/speech-recognize/config.ts
|
|
436
337
|
/*!
|
|
437
338
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
438
339
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
439
340
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
440
341
|
*/
|
|
441
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
442
|
-
exports.zh_tw = exports.zh_cn = exports.tr = exports.ru = exports.pt_br = exports.pl = exports.nl = exports.ko = exports.ja = exports.it = exports.id = exports.hu = exports.he = exports.fr = exports.fa = exports.es = exports.de = exports.cs_cz = exports.ar = void 0;
|
|
443
|
-
var ar = __webpack_require__(5466);
|
|
444
|
-
exports.ar = ar;
|
|
445
|
-
var cs_cz = __webpack_require__(65226);
|
|
446
|
-
exports.cs_cz = cs_cz;
|
|
447
|
-
var de = __webpack_require__(87541);
|
|
448
|
-
exports.de = de;
|
|
449
|
-
var es = __webpack_require__(87104);
|
|
450
|
-
exports.es = es;
|
|
451
|
-
var fa = __webpack_require__(53808);
|
|
452
|
-
exports.fa = fa;
|
|
453
|
-
var fr = __webpack_require__(48954);
|
|
454
|
-
exports.fr = fr;
|
|
455
|
-
var he = __webpack_require__(14694);
|
|
456
|
-
exports.he = he;
|
|
457
|
-
var hu = __webpack_require__(67381);
|
|
458
|
-
exports.hu = hu;
|
|
459
|
-
var id = __webpack_require__(99549);
|
|
460
|
-
exports.id = id;
|
|
461
|
-
var it = __webpack_require__(28428);
|
|
462
|
-
exports.it = it;
|
|
463
|
-
var ja = __webpack_require__(25363);
|
|
464
|
-
exports.ja = ja;
|
|
465
|
-
var ko = __webpack_require__(96929);
|
|
466
|
-
exports.ko = ko;
|
|
467
|
-
var nl = __webpack_require__(58499);
|
|
468
|
-
exports.nl = nl;
|
|
469
|
-
var pl = __webpack_require__(59430);
|
|
470
|
-
exports.pl = pl;
|
|
471
|
-
var pt_br = __webpack_require__(70297);
|
|
472
|
-
exports.pt_br = pt_br;
|
|
473
|
-
var ru = __webpack_require__(98949);
|
|
474
|
-
exports.ru = ru;
|
|
475
|
-
var tr = __webpack_require__(61232);
|
|
476
|
-
exports.tr = tr;
|
|
477
|
-
var zh_cn = __webpack_require__(56775);
|
|
478
|
-
exports.zh_cn = zh_cn;
|
|
479
|
-
var zh_tw = __webpack_require__(97957);
|
|
480
|
-
exports.zh_tw = zh_tw;
|
|
481
342
|
|
|
482
343
|
|
|
483
|
-
/***/ }),
|
|
484
344
|
|
|
485
|
-
/***/ 40256:
|
|
486
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
487
345
|
|
|
488
|
-
"use strict";
|
|
489
346
|
|
|
347
|
+
|
|
348
|
+
config/* Config.prototype.speechRecognize */.D.prototype.speechRecognize = {
|
|
349
|
+
api: SpeechRecognition,
|
|
350
|
+
sound: true,
|
|
351
|
+
continuous: true,
|
|
352
|
+
interimResults: true,
|
|
353
|
+
commands: {
|
|
354
|
+
'newline|enter': 'enter',
|
|
355
|
+
'delete|remove word|delete word': 'backspaceWordButton',
|
|
356
|
+
comma: 'inserthtml::,',
|
|
357
|
+
underline: 'inserthtml::_',
|
|
358
|
+
hyphen: 'inserthtml::-',
|
|
359
|
+
space: 'inserthtml:: ',
|
|
360
|
+
question: 'inserthtml::?',
|
|
361
|
+
dot: 'inserthtml::.',
|
|
362
|
+
'quote|quotes|open quote': "inserthtml::'",
|
|
363
|
+
'header|header h1': 'formatblock::h1',
|
|
364
|
+
'select all': 'selectall'
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
icon/* Icon.set */.J.set('speech-recognize', __webpack_require__(90327));
|
|
368
|
+
config/* Config.prototype.controls.speechRecognize */.D.prototype.controls.speechRecognize = {
|
|
369
|
+
isActive(jodit, _) {
|
|
370
|
+
const api = (0,data_bind/* dataBind */.q)(jodit, 'speech');
|
|
371
|
+
return Boolean(api === null || api === void 0 ? void 0 : api.isEnabled);
|
|
372
|
+
},
|
|
373
|
+
isDisabled(jodit) {
|
|
374
|
+
return !jodit.o.speechRecognize.api;
|
|
375
|
+
},
|
|
376
|
+
exec(jodit, current, { button, control }) {
|
|
377
|
+
const { api: Api, lang, continuous, interimResults, sound } = jodit.o.speechRecognize;
|
|
378
|
+
if (!Api) {
|
|
379
|
+
jodit.alert('Speech recognize API unsupported in your browser');
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
let api = (0,data_bind/* dataBind */.q)(jodit, 'speech');
|
|
383
|
+
if (!api) {
|
|
384
|
+
const nativeApi = new Api();
|
|
385
|
+
api = new RecognizeManager(jodit.async, nativeApi);
|
|
386
|
+
api.lang = lang;
|
|
387
|
+
api.continuous = continuous;
|
|
388
|
+
api.interimResults = interimResults;
|
|
389
|
+
api.sound = sound;
|
|
390
|
+
(0,data_bind/* dataBind */.q)(jodit, 'speech', api);
|
|
391
|
+
api.on('pulse', (enable) => {
|
|
392
|
+
button.setMod('pulse', enable);
|
|
393
|
+
});
|
|
394
|
+
api.on('result', (text) => jodit.e.fire('speechRecognizeResult', text));
|
|
395
|
+
api.on('progress', (text) => jodit.e.fire('speechRecognizeProgressResult', text));
|
|
396
|
+
button.hookStatus('beforeDestruct', () => {
|
|
397
|
+
api.destruct();
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
if (control.args) {
|
|
401
|
+
const key = control.args[0];
|
|
402
|
+
if ((0,is_boolean/* isBoolean */.j)(api[key])) {
|
|
403
|
+
api[key] = !api[key];
|
|
404
|
+
if (api.isEnabled) {
|
|
405
|
+
api.restart();
|
|
406
|
+
}
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
api.toggle();
|
|
411
|
+
button.state.activated = api.isEnabled;
|
|
412
|
+
},
|
|
413
|
+
name: 'speechRecognize',
|
|
414
|
+
command: 'toggleSpeechRecognize',
|
|
415
|
+
tooltip: 'Speech Recognize',
|
|
416
|
+
list: {
|
|
417
|
+
sound: 'Sound',
|
|
418
|
+
interimResults: 'Interim Results'
|
|
419
|
+
},
|
|
420
|
+
childTemplate(jodit, key, value) {
|
|
421
|
+
var _a;
|
|
422
|
+
const api = (0,data_bind/* dataBind */.q)(jodit, 'speech'), checked = (_a = api === null || api === void 0 ? void 0 : api[key]) !== null && _a !== void 0 ? _a : jodit.o.speechRecognize[key];
|
|
423
|
+
return `<span class='jodit-speech-recognize__list-item'><input ${checked ? 'checked' : ''} class='jodit-checkbox' type='checkbox'> ${value}</span>`;
|
|
424
|
+
},
|
|
425
|
+
mods: {
|
|
426
|
+
stroke: false
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
;// CONCATENATED MODULE: ./src/plugins/speech-recognize/speech-recognize.ts
|
|
490
431
|
/*!
|
|
491
432
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
492
433
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
493
434
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
494
435
|
*/
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
function SpeechRecognizeNative(j) {
|
|
510
|
-
var _this = _super.call(this, j) || this;
|
|
511
|
-
_this._commandToWord = {};
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
class SpeechRecognizeNative extends core_plugin/* Plugin */.S {
|
|
447
|
+
constructor(j) {
|
|
448
|
+
super(j);
|
|
449
|
+
this._commandToWord = {};
|
|
512
450
|
if (j.o.speechRecognize.api) {
|
|
513
451
|
j.registerButton({
|
|
514
452
|
group: 'state',
|
|
515
453
|
name: 'speechRecognize'
|
|
516
454
|
});
|
|
517
455
|
}
|
|
518
|
-
return _this;
|
|
519
456
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
var commands = jodit.o.speechRecognize.commands;
|
|
457
|
+
afterInit(jodit) {
|
|
458
|
+
const { commands } = jodit.o.speechRecognize;
|
|
523
459
|
if (commands) {
|
|
524
|
-
(0,
|
|
525
|
-
(0,
|
|
526
|
-
|
|
527
|
-
keys.forEach(
|
|
460
|
+
(0,global/* extendLang */.xl)(__webpack_require__(86937));
|
|
461
|
+
(0,utils/* keys */.XP)(commands, false).forEach(words => {
|
|
462
|
+
const keys = words.split('|');
|
|
463
|
+
keys.forEach(key => {
|
|
528
464
|
key = key.trim().toLowerCase();
|
|
529
|
-
|
|
530
|
-
|
|
465
|
+
this._commandToWord[key] = commands[words];
|
|
466
|
+
const translatedKeys = jodit.i18n(key);
|
|
531
467
|
if (translatedKeys !== key) {
|
|
532
|
-
translatedKeys.split('|').forEach(
|
|
533
|
-
|
|
468
|
+
translatedKeys.split('|').forEach(translatedKey => {
|
|
469
|
+
this._commandToWord[translatedKey.trim().toLowerCase()] = commands[words].trim();
|
|
534
470
|
});
|
|
535
471
|
}
|
|
536
472
|
});
|
|
537
473
|
});
|
|
538
474
|
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
var _this = this;
|
|
475
|
+
}
|
|
476
|
+
beforeDestruct(jodit) { }
|
|
477
|
+
onSpeechRecognizeProgressResult(text) {
|
|
543
478
|
if (!this.messagePopup) {
|
|
544
479
|
this.messagePopup = this.j.create.div('jodit-speech-recognize__popup');
|
|
545
480
|
}
|
|
546
481
|
this.j.workplace.appendChild(this.messagePopup);
|
|
547
|
-
this.j.async.setTimeout(
|
|
548
|
-
|
|
482
|
+
this.j.async.setTimeout(() => {
|
|
483
|
+
dom/* Dom.safeRemove */.i.safeRemove(this.messagePopup);
|
|
549
484
|
}, {
|
|
550
485
|
label: 'onSpeechRecognizeProgressResult',
|
|
551
486
|
timeout: 1000
|
|
552
487
|
});
|
|
553
488
|
this.messagePopup.innerText = text + '|';
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
489
|
+
}
|
|
490
|
+
onSpeechRecognizeResult(text) {
|
|
491
|
+
const { j } = this, { s } = j;
|
|
492
|
+
dom/* Dom.safeRemove */.i.safeRemove(this.messagePopup);
|
|
558
493
|
if (!this._checkCommand(text)) {
|
|
559
|
-
|
|
494
|
+
const { range } = s, node = s.current();
|
|
560
495
|
if (s.isCollapsed() &&
|
|
561
|
-
|
|
562
|
-
|
|
496
|
+
dom/* Dom.isText */.i.isText(node) &&
|
|
497
|
+
dom/* Dom.isOrContains */.i.isOrContains(j.editor, node) &&
|
|
563
498
|
node.nodeValue) {
|
|
564
|
-
|
|
499
|
+
const sentence = node.nodeValue;
|
|
565
500
|
node.nodeValue =
|
|
566
501
|
sentence +
|
|
567
502
|
(/[\u00A0 ]\uFEFF*$/.test(sentence) ? '' : ' ') +
|
|
@@ -574,25 +509,23 @@ var SpeechRecognizeNative = (function (_super) {
|
|
|
574
509
|
s.insertHTML(text);
|
|
575
510
|
}
|
|
576
511
|
}
|
|
577
|
-
}
|
|
578
|
-
|
|
512
|
+
}
|
|
513
|
+
_checkCommand(command) {
|
|
579
514
|
command = command.toLowerCase().replace(/\./g, '');
|
|
580
515
|
if (this._commandToWord[command]) {
|
|
581
|
-
|
|
516
|
+
execSpellCommand(this.j, this._commandToWord[command]);
|
|
582
517
|
return true;
|
|
583
518
|
}
|
|
584
519
|
return false;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}(plugin_1.Plugin));
|
|
595
|
-
exports.SpeechRecognizeNative = SpeechRecognizeNative;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
(0,tslib_es6/* __decorate */.gn)([
|
|
523
|
+
(0,watch/* watch */.YP)(':speechRecognizeProgressResult'),
|
|
524
|
+
(0,debounce/* debounce */.D)()
|
|
525
|
+
], SpeechRecognizeNative.prototype, "onSpeechRecognizeProgressResult", null);
|
|
526
|
+
(0,tslib_es6/* __decorate */.gn)([
|
|
527
|
+
(0,watch/* watch */.YP)(':speechRecognizeResult')
|
|
528
|
+
], SpeechRecognizeNative.prototype, "onSpeechRecognizeResult", null);
|
|
596
529
|
if (typeof Jodit !== 'undefined') {
|
|
597
530
|
Jodit.plugins.add('speech-recognize', SpeechRecognizeNative);
|
|
598
531
|
}
|
|
@@ -1002,7 +935,7 @@ module.exports = {
|
|
|
1002
935
|
},
|
|
1003
936
|
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
|
1004
937
|
/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
1005
|
-
/******/ var __webpack_exports__ = (__webpack_exec__(
|
|
938
|
+
/******/ var __webpack_exports__ = (__webpack_exec__(56949));
|
|
1006
939
|
/******/ return __webpack_exports__;
|
|
1007
940
|
/******/ }
|
|
1008
941
|
]);
|