jodit 4.2.14 → 4.2.17
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 +64 -5
- package/es2015/jodit.css +115 -115
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +928 -823
- package/es2015/jodit.min.css +1 -1
- 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 +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +11 -11
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es2018/jodit.css +115 -115
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +928 -825
- package/es2018/jodit.min.css +1 -1
- 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 +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.js +11 -11
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es2021/jodit.css +115 -115
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +922 -819
- package/es2021/jodit.min.css +1 -1
- 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 +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +11 -11
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es2021.en/jodit.css +115 -115
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +922 -819
- package/es2021.en/jodit.min.css +1 -1
- 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 +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +11 -11
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/es5/jodit.css +129 -129
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +950 -844
- package/es5/jodit.min.css +3 -3
- 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 +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +11 -11
- package/es5/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/utils/config-proto.js +1 -1
- package/esm/core/request/ajax.js +1 -1
- package/esm/core/selection/helpers/index.d.ts +9 -3
- package/esm/core/selection/helpers/index.js +48 -0
- package/esm/core/selection/selection.d.ts +6 -1
- package/esm/core/selection/selection.js +95 -117
- package/esm/core/ui/helpers/get-control-type.js +15 -9
- package/esm/core/ui/helpers/get-strong-control-types.js +1 -1
- package/esm/index.d.ts +6 -1
- package/esm/index.js +3 -2
- package/esm/jodit.d.ts +1 -1
- package/esm/jodit.js +1 -1
- package/esm/modules/file-browser/file-browser.js +1 -1
- package/esm/modules/history/history.js +1 -1
- package/esm/modules/image-editor/config.js +1 -1
- package/esm/modules/image-editor/image-editor.js +1 -1
- package/esm/modules/table/table.d.ts +3 -1
- package/esm/modules/table/table.js +38 -33
- package/esm/modules/toolbar/button/button.js +2 -1
- package/esm/modules/toolbar/button/select/select.js +2 -1
- package/esm/modules/uploader/helpers/send-files.js +33 -29
- package/esm/modules/uploader/uploader.js +1 -1
- package/esm/plugins/about/about.js +1 -1
- package/esm/plugins/add-new-line/config.js +1 -1
- package/esm/plugins/ai-assistant/config.js +1 -1
- package/esm/plugins/backspace/cases/check-remove-char.js +68 -54
- package/esm/plugins/bold/bold.js +1 -1
- package/esm/plugins/class-span/class-span.js +1 -1
- package/esm/plugins/clean-html/config.js +1 -1
- package/esm/plugins/clipboard/config.js +1 -1
- package/esm/plugins/color/config.js +1 -1
- package/esm/plugins/copy-format/copy-format.js +1 -1
- package/esm/plugins/drag-and-drop/drag-and-drop.d.ts +2 -0
- package/esm/plugins/drag-and-drop/drag-and-drop.js +43 -36
- package/esm/plugins/file/file.js +1 -1
- package/esm/plugins/font/config.js +1 -1
- package/esm/plugins/format-block/config.js +6 -4
- package/esm/plugins/fullsize/config.js +1 -1
- package/esm/plugins/hr/hr.js +1 -1
- package/esm/plugins/image/image.js +1 -1
- package/esm/plugins/image-properties/config.d.ts +0 -3
- package/esm/plugins/image-properties/config.js +3 -0
- package/esm/plugins/image-properties/interface.d.ts +121 -0
- package/esm/plugins/indent/config.js +1 -1
- package/esm/plugins/inline-popup/config/config.js +1 -1
- package/esm/plugins/justify/justify.js +10 -6
- package/esm/plugins/line-height/config.js +1 -1
- package/esm/plugins/link/config.js +1 -1
- package/esm/plugins/link/link.js +71 -64
- package/esm/plugins/mobile/config.js +1 -1
- package/esm/plugins/ordered-list/config.js +1 -1
- package/esm/plugins/paste/config.js +1 -1
- package/esm/plugins/print/print.js +1 -1
- package/esm/plugins/redo-undo/redo-undo.js +1 -1
- package/esm/plugins/search/config.js +1 -1
- package/esm/plugins/search/helpers/highlight-text-ranges.d.ts +0 -4
- package/esm/plugins/search/helpers/highlight-text-ranges.js +58 -49
- package/esm/plugins/source/config.js +1 -1
- package/esm/plugins/speech-recognize/config.js +1 -1
- package/esm/plugins/spellcheck/config.js +1 -1
- package/esm/plugins/symbols/config.js +1 -1
- package/esm/plugins/table/config.js +1 -1
- package/esm/plugins/table-keyboard-navigation/table-keyboard-navigation.js +35 -29
- package/esm/plugins/video/config.js +1 -1
- package/esm/types/toolbar.d.ts +1 -2
- package/package.json +1 -1
- package/types/core/selection/helpers/index.d.ts +9 -3
- package/types/core/selection/selection.d.ts +6 -1
- package/types/index.d.ts +6 -1
- package/types/jodit.d.ts +1 -1
- package/types/modules/table/table.d.ts +3 -1
- package/types/plugins/drag-and-drop/drag-and-drop.d.ts +2 -0
- package/types/plugins/image-properties/config.d.ts +0 -3
- package/types/plugins/image-properties/interface.d.ts +121 -0
- package/types/plugins/search/helpers/highlight-text-ranges.d.ts +0 -4
- package/types/types/toolbar.d.ts +1 -2
|
@@ -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.17
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -25,11 +25,11 @@ return (self["webpackChunkjodit"] = self["webpackChunkjodit"] || []).push([[882]
|
|
|
25
25
|
/* harmony import */ var jodit_core_helpers_checker_is_boolean__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9810);
|
|
26
26
|
/* harmony import */ var jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72197);
|
|
27
27
|
/* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(931);
|
|
28
|
-
/* harmony import */ var
|
|
29
|
-
/* harmony import */ var
|
|
30
|
-
/* harmony import */ var
|
|
31
|
-
/* harmony import */ var
|
|
32
|
-
/* harmony import */ var
|
|
28
|
+
/* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36115);
|
|
29
|
+
/* harmony import */ var _helpers_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(71722);
|
|
30
|
+
/* harmony import */ var _helpers_recognize_manager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(93676);
|
|
31
|
+
/* harmony import */ var _speech_recognize_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22227);
|
|
32
|
+
/* harmony import */ var _speech_recognize_svg__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_speech_recognize_svg__WEBPACK_IMPORTED_MODULE_5__);
|
|
33
33
|
/*!
|
|
34
34
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
35
35
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -42,8 +42,8 @@ return (self["webpackChunkjodit"] = self["webpackChunkjodit"] || []).push([[882]
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
api:
|
|
45
|
+
jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.speechRecognize = {
|
|
46
|
+
api: _helpers_api__WEBPACK_IMPORTED_MODULE_3__/* .SpeechRecognition */ .o,
|
|
47
47
|
sound: true,
|
|
48
48
|
continuous: true,
|
|
49
49
|
interimResults: true,
|
|
@@ -61,8 +61,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__/* .Config */ .T.prototype.speechRecogn
|
|
|
61
61
|
'select all': 'selectall'
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__/* .Icon */ .I.set('speech-recognize', (
|
|
65
|
-
|
|
64
|
+
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__/* .Icon */ .I.set('speech-recognize', (_speech_recognize_svg__WEBPACK_IMPORTED_MODULE_5___default()));
|
|
65
|
+
jodit_config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.prototype.controls.speechRecognize = {
|
|
66
66
|
isActive: function (jodit, _) {
|
|
67
67
|
var api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_0__/* .dataBind */ .m)(jodit, 'speech');
|
|
68
68
|
return Boolean(api === null || api === void 0 ? void 0 : api.isEnabled);
|
|
@@ -80,7 +80,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__/* .Config */ .T.prototype.controls.spe
|
|
|
80
80
|
var api = (0,jodit_core_helpers_utils_data_bind__WEBPACK_IMPORTED_MODULE_0__/* .dataBind */ .m)(jodit, 'speech');
|
|
81
81
|
if (!api) {
|
|
82
82
|
var nativeApi = new Api();
|
|
83
|
-
api = new
|
|
83
|
+
api = new _helpers_recognize_manager__WEBPACK_IMPORTED_MODULE_4__/* .RecognizeManager */ .g(jodit.async, nativeApi);
|
|
84
84
|
api.lang = lang;
|
|
85
85
|
api.continuous = continuous;
|
|
86
86
|
api.interimResults = interimResults;
|
|
@@ -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.17
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[882],{71096:function(e,t,n){"use strict";var i=n(9810),o=n(72197),s=n(931),r=n(71722),u=n(93676),c=n(22227),a=n.n(c),p=n(36115);p.T.prototype.speechRecognize={api:r.o,sound:!0,continuous:!0,interimResults:!0,commands:{"newline|enter":"enter","delete|remove word|delete word":"backspaceWordButton",comma:"inserthtml::,",underline:"inserthtml::_",hyphen:"inserthtml::-",space:"inserthtml:: ",question:"inserthtml::?",dot:"inserthtml::.","quote|quotes|open quote":"inserthtml::'","header|header h1":"formatblock::h1","select all":"selectall"}},s.I.set("speech-recognize",a()),p.T.prototype.controls.speechRecognize={isActive:function(e,t){var n=(0,o.m)(e,"speech");return Boolean(null==n?void 0:n.isEnabled)},isDisabled:function(e){return!e.o.speechRecognize.api},exec:function(e,t,n){var s=n.button,r=n.control,c=e.o.speechRecognize,a=c.api,p=c.lang,l=c.continuous,d=c.interimResults,h=c.sound;if(a){var f=(0,o.m)(e,"speech");if(!f){var m=new a;(f=new u.g(e.async,m)).lang=p,f.continuous=l,f.interimResults=d,f.sound=h,(0,o.m)(e,"speech",f),f.on("pulse",(function(e){s.setMod("pulse",e)})),f.on("result",(function(t){return e.e.fire("speechRecognizeResult",t)})),f.on("progress",(function(t){return e.e.fire("speechRecognizeProgressResult",t)})),s.hookStatus("beforeDestruct",(function(){f.destruct()}))}if(r.args){var g=r.args[0];if((0,i.L)(f[g]))return f[g]=!f[g],void(f.isEnabled&&f.restart())}f.toggle(),s.state.activated=f.isEnabled}else e.alert("Speech recognize API unsupported in your browser")},name:"speechRecognize",command:"toggleSpeechRecognize",tooltip:"Speech Recognize",list:{sound:"Sound",interimResults:"Interim Results"},childTemplate:function(e,t,n){var i,s=(0,o.m)(e,"speech"),r=null!==(i=null==s?void 0:s[t])&&void 0!==i?i:e.o.speechRecognize[t];return"<span class='jodit-speech-recognize__list-item'><input ".concat(r?"checked":""," class='jodit-checkbox' type='checkbox'> ").concat(n,"</span>")},mods:{stroke:!1}}},81629:function(e,t,n){"use strict";n.d(t,{N:function(){return i},Z:function(){return o}});var i=440,o=940},71722:function(e,t,n){"use strict";n.d(t,{o:function(){return i}});var i=window.SpeechRecognition||window.webkitSpeechRecognition},50834:function(e,t,n){"use strict";n.d(t,{F:function(){return o}});var i=n(31635);function o(e,t){var n=(0,i.zs)(t.split("::"),2);e.execCommand(n[0],null,n[1])}},93676:function(e,t,n){"use strict";n.d(t,{g:function(){return c}});var i=n(31635),o=n(22664),s=n(43431),r=n(95473),u=n(81629),c=function(e){function t(t,i){var o=e.call(this)||this;return o.async=t,o._continuous=!1,o._interimResults=!1,o.sound=!0,o._isEnabled=!1,o._restartTimeout=0,o._onSpeechStart=function(e){o._isEnabled&&(o.async.clearTimeout(o._restartTimeout),o._restartTimeout=o.async.setTimeout((function(){o.restart(),o.emit("pulse",!1),o._makeSound(u.Z)}),5e3),o.emit("pulse",!0))},o._progressTimeout=0,o._api=i,n._instances.add(o),o}var n;return(0,i.C6)(t,e),n=t,Object.defineProperty(t.prototype,"lang",{get:function(){return this._lang},set:function(e){this._lang=e,this._api.lang=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"continuous",{get:function(){return this._continuous},set:function(e){this._continuous=e,this._api.continuous=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"interimResults",{get:function(){return this._interimResults},set:function(e){this._interimResults=e,this._api.interimResults=e},enumerable:!1,configurable:!0}),t.prototype.destruct=function(){this.stop(),n._instances.delete(this),e.prototype.destruct.call(this)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},enumerable:!1,configurable:!0}),t.prototype.start=function(){var e=this;this._isEnabled||(this._isEnabled=!0,n._instances.forEach((function(t){t!==e&&t.stop()})),this._api.start(),this.__on("speechstart",this._onSpeechStart).__on("error",this._onError).__on("result",this._onResult))},t.prototype.stop=function(){if(this._isEnabled){try{this._api.abort(),this._api.stop()}catch(e){}this.__off("speechstart",this._onSpeechStart).__off("error",this._onError).__off("result",this._onResult),this.async.clearTimeout(this._restartTimeout),this._isEnabled=!1,this.emit("pulse",!1)}},t.prototype.toggle=function(){this._isEnabled?this.stop():this.start()},t.prototype.restart=function(){this.stop(),this.start()},t.prototype.__on=function(e,t){return this._api.addEventListener(e,t),this},t.prototype.__off=function(e,t){return this._api.removeEventListener(e,t),this},t.prototype._onResult=function(e){var t=this;if(this._isEnabled){this.async.clearTimeout(this._progressTimeout);var n=e.results.item(e.resultIndex),i=n.item(0).transcript,o=function(){try{t.async.clearTimeout(t._restartTimeout),t.emit("result",i)}catch(e){}t.restart(),t.emit("pulse",!1),t._makeSound(u.N)};if(!1===n.isFinal)return this.emit("progress",i),void(this._progressTimeout=this.async.setTimeout(o,500));o()}},t.prototype._onError=function(){this._isEnabled&&(this._makeSound(u.Z),this.emit("pulse",!1),this.restart())},t.prototype._makeSound=function(e){this.sound&&(0,r.s)({frequency:e})},t._instances=new Set,n=(0,i.Cg)([o.autobind],t)}(s.h)},95473:function(e,t,n){"use strict";n.d(t,{s:function(){return o}});var i=n(81629);function o(e){var t=void 0===e?{}:e,n=t.sec,o=void 0===n?.1:n,s=t.frequency,r=void 0===s?i.N:s,u=t.gain,c=void 0===u?.1:u,a=t.type,p=void 0===a?"sine":a;if(void 0!==window.AudioContext||void 0!==window.webkitAudioContext){var l=new(window.AudioContext||window.webkitAudioContext),d=l.createGain(),h=l.createOscillator();h.type=p,h.frequency.value=r,h.connect(d),d.connect(l.destination),h.start(),h.stop(l.currentTime+o),d.gain.value=c}}},61593:function(e){"use strict";e.exports={newline:"الخط الجديد",delete:"حذف",space:"الفضاء","Speech Recognize":"التعرف على الكلام",Sound:"الصوت","Interim Results":"النتائج المؤقتة"}},64458:function(e){"use strict";e.exports={newline:"řádek",delete:"odstranit",space:"prostora","Speech Recognize":"Rozpoznání Řeči",Sound:"Zvuk","Interim Results":"Průběžné Výsledky"}},89601:function(e){"use strict";e.exports={newline:"Zeilenumbruch",delete:"löschen",space:"Raum","Speech Recognize":"Sprache Erkennen",Sound:"Sound","Interim Results":"Zwischenergebnis"}},87710:function(e){"use strict";e.exports={newline:"nueva línea",delete:"eliminar",space:"espacio","Speech Recognize":"Reconocimiento de Voz",Sound:"Sonido","Interim Results":"Resultados Provisionales"}},15603:function(e){"use strict";e.exports={newline:"خط جدید",delete:"حذف",space:"فضا","Speech Recognize":"گفتار را تشخیص دهید",Sound:"صدا","Interim Results":"نتایج موقت"}},84059:function(e){"use strict";e.exports={"Speech Recognize":"Puheentunnistus",newline:"uusi rivi",delete:"poistaa",space:"tilaa",Sound:"Ääni","Interim Results":"Välitulokset"}},13958:function(e){"use strict";e.exports={newline:"nouvelle ligne",delete:"supprimer",space:"espace","Speech Recognize":"Reconnaissance Vocale",Sound:"Son","Interim Results":"Résultats Intermédiaires"}},18717:function(e){"use strict";e.exports={newline:"חדשות",delete:"מחק",space:"שטח","Speech Recognize":"דיבור מזהה",Sound:"קול","Interim Results":"תוצאות ביניים"}},14765:function(e){"use strict";e.exports={newline:"újsor",delete:"törlés",space:"tér","Speech Recognize":"A Beszéd Felismeri",Sound:"Hang","Interim Results":"Időközi Eredmények"}},77995:function(e){"use strict";e.exports={newline:"newline",delete:"Hapus",space:"ruang","Speech Recognize":"Pidato Mengenali",Sound:"Suara","Interim Results":"Hasil Sementara"}},25202:function(e,t,n){"use strict";n.r(t),n.d(t,{ar:function(){return i},cs_cz:function(){return o},de:function(){return s},es:function(){return r},fa:function(){return u},fi:function(){return c},fr:function(){return a},he:function(){return p},hu:function(){return l},id:function(){return d},it:function(){return h},ja:function(){return f},ko:function(){return m},mn:function(){return g},nl:function(){return R},pl:function(){return _},pt_br:function(){return S},ru:function(){return v},tr:function(){return w},zh_cn:function(){return z},zh_tw:function(){return y}});var i=n(61593),o=n(64458),s=n(89601),r=n(87710),u=n(15603),c=n(84059),a=n(13958),p=n(18717),l=n(14765),d=n(77995),h=n(92315),f=n(54711),m=n(68632),g=n(76769),R=n(3424),_=n(85454),S=n(64149),v=n(16491),w=n(48948),z=n(84370),y=n(56646)},92315:function(e){"use strict";e.exports={newline:"nuova riga",delete:"eliminare",space:"spazio","Speech Recognize":"Discorso Riconoscere",Sound:"Suono","Interim Results":"Risultati intermedi"}},54711:function(e){"use strict";e.exports={newline:"改行",delete:"削除",space:"スペース","Speech Recognize":"音声認識",Sound:"音","Interim Results":"中間結果"}},68632:function(e){"use strict";e.exports={newline:"줄 바꿈",delete:"삭제",space:"공간","Speech Recognize":"음성 인식",Sound:"소리","Interim Results":"중간 결과"}},76769:function(e){"use strict";e.exports={newline:"Шинэ мөр",delete:"Устгах",space:"Зай","Speech Recognize":"Дуу хоолой таних",Sound:"Дуу","Interim Results":"Түр зуурын үр дүн"}},3424:function(e){"use strict";e.exports={newline:"regel",delete:"verwijderen",space:"ruimte","Speech Recognize":"Spraak Herkennen",Sound:"Geluid","Interim Results":"Tussentijdse Resultaten"}},85454:function(e){"use strict";e.exports={newline:"newline",delete:"usunąć",space:"przestrzeń","Speech Recognize":"Rozpoznawanie Mowy",Sound:"Dźwięk","Interim Results":"Wyniki Okresowe"}},64149:function(e){"use strict";e.exports={newline:"linha",delete:"excluir",space:"espaco","Speech Recognize":"Discurso Reconhecer",Sound:"Som","Interim Results":"Resultados Provisórios"}},16491:function(e){"use strict";e.exports={newline:"новая строка|перенос|энтер",delete:"удалить",space:"пробел","Speech Recognize":"Распознавание речи",Sound:"Звук","Interim Results":"Промежуточные результаты"}},48948:function(e){"use strict";e.exports={newline:"yeni satır",delete:"silmek",space:"uzay","Speech Recognize":"Konuşma Tanıma",Sound:"Ses","Interim Results":"Ara Sonuçlar"}},84370:function(e){"use strict";e.exports={newline:"新行",delete:"删除",space:"空间","Speech Recognize":"言语识别",Sound:"声音","Interim Results":"中期业绩"}},56646:function(e){"use strict";e.exports={newline:"換行",delete:"刪除",space:"空白","Speech Recognize":"語音辨識",Sound:"聲音","Interim Results":"階段性辨識結果"}},37873:function(e,t,n){"use strict";n.r(t),n.d(t,{SpeechRecognizeNative:function(){return h}});var i=n(31635),o=n(37075),s=n(66927),r=n(55186),u=n(56298),c=n(84976),a=n(71005),p=(n(71096),n(46173)),l=n(50834),d=n(25202),h=function(e){function t(t){var n=e.call(this,t)||this;return n._commandToWord={},t.o.speechRecognize.api&&t.registerButton({group:"state",name:"speechRecognize"}),n}return(0,i.C6)(t,e),t.prototype.afterInit=function(e){var t=this,n=e.o.speechRecognize.commands;n&&((0,u.JW)(d),(0,c.HP)(n,!1).forEach((function(i){i.split("|").forEach((function(o){o=o.trim().toLowerCase(),t._commandToWord[o]=n[i];var s=e.i18n(o);s!==o&&s.split("|").forEach((function(e){t._commandToWord[e.trim().toLowerCase()]=n[i].trim()}))}))})))},t.prototype.beforeDestruct=function(e){},t.prototype.onSpeechRecognizeProgressResult=function(e){var t=this;this.messagePopup||(this.messagePopup=this.j.create.div("jodit-speech-recognize__popup")),this.j.workplace.appendChild(this.messagePopup),this.j.async.setTimeout((function(){r.J.safeRemove(t.messagePopup)}),{label:"onSpeechRecognizeProgressResult",timeout:1e3}),this.messagePopup.innerText=e+"|"},t.prototype.onSpeechRecognizeResult=function(e){var t=this.j,n=t.s;if(r.J.safeRemove(this.messagePopup),!this._checkCommand(e)){var i=n.range,o=n.current();if(n.isCollapsed()&&r.J.isText(o)&&r.J.isOrContains(t.editor,o)&&o.nodeValue){var s=o.nodeValue;o.nodeValue=s+(/[\u00A0 ]\uFEFF*$/.test(s)?"":" ")+e,i.setStartAfter(o),n.selectRange(i),t.synchronizeValues()}else n.insertHTML(e)}},t.prototype._checkCommand=function(e){return e=e.toLowerCase().replace(/\./g,""),!!this._commandToWord[e]&&((0,l.F)(this.j,this._commandToWord[e]),!0)},(0,i.Cg)([(0,s.w)(":speechRecognizeProgressResult"),(0,o.s)()],t.prototype,"onSpeechRecognizeProgressResult",null),(0,i.Cg)([(0,s.w)(":speechRecognizeResult")],t.prototype,"onSpeechRecognizeResult",null),t}(a.k);p.x.plugins.add("speech-recognize",h)},22227:function(e){e.exports='<svg viewBox="0 0 16 16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <path d="M8,11c1.657,0,3-1.343,3-3V3c0-1.657-1.343-3-3-3S5,1.343,5,3v5C5,9.657,6.343,11,8,11z"/> <path d="M13,8V6h-1l0,1.844c0,1.92-1.282,3.688-3.164,4.071C6.266,12.438,4,10.479,4,8V6H3v2c0,2.414,1.721,4.434,4,4.899V15H5v1h6 v-1H9v-2.101C11.279,12.434,13,10.414,13,8z"/> </svg>'}},function(e){return e(e.s=37873)}])}));
|
|
10
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[882],{71096:function(e,t,n){"use strict";var i=n(9810),o=n(72197),s=n(931),r=n(36115),u=n(71722),c=n(93676),a=n(22227),p=n.n(a);r.T.prototype.speechRecognize={api:u.o,sound:!0,continuous:!0,interimResults:!0,commands:{"newline|enter":"enter","delete|remove word|delete word":"backspaceWordButton",comma:"inserthtml::,",underline:"inserthtml::_",hyphen:"inserthtml::-",space:"inserthtml:: ",question:"inserthtml::?",dot:"inserthtml::.","quote|quotes|open quote":"inserthtml::'","header|header h1":"formatblock::h1","select all":"selectall"}},s.I.set("speech-recognize",p()),r.T.prototype.controls.speechRecognize={isActive:function(e,t){var n=(0,o.m)(e,"speech");return Boolean(null==n?void 0:n.isEnabled)},isDisabled:function(e){return!e.o.speechRecognize.api},exec:function(e,t,n){var s=n.button,r=n.control,u=e.o.speechRecognize,a=u.api,p=u.lang,l=u.continuous,d=u.interimResults,h=u.sound;if(a){var f=(0,o.m)(e,"speech");if(!f){var m=new a;(f=new c.g(e.async,m)).lang=p,f.continuous=l,f.interimResults=d,f.sound=h,(0,o.m)(e,"speech",f),f.on("pulse",(function(e){s.setMod("pulse",e)})),f.on("result",(function(t){return e.e.fire("speechRecognizeResult",t)})),f.on("progress",(function(t){return e.e.fire("speechRecognizeProgressResult",t)})),s.hookStatus("beforeDestruct",(function(){f.destruct()}))}if(r.args){var g=r.args[0];if((0,i.L)(f[g]))return f[g]=!f[g],void(f.isEnabled&&f.restart())}f.toggle(),s.state.activated=f.isEnabled}else e.alert("Speech recognize API unsupported in your browser")},name:"speechRecognize",command:"toggleSpeechRecognize",tooltip:"Speech Recognize",list:{sound:"Sound",interimResults:"Interim Results"},childTemplate:function(e,t,n){var i,s=(0,o.m)(e,"speech"),r=null!==(i=null==s?void 0:s[t])&&void 0!==i?i:e.o.speechRecognize[t];return"<span class='jodit-speech-recognize__list-item'><input ".concat(r?"checked":""," class='jodit-checkbox' type='checkbox'> ").concat(n,"</span>")},mods:{stroke:!1}}},81629:function(e,t,n){"use strict";n.d(t,{N:function(){return i},Z:function(){return o}});var i=440,o=940},71722:function(e,t,n){"use strict";n.d(t,{o:function(){return i}});var i=window.SpeechRecognition||window.webkitSpeechRecognition},50834:function(e,t,n){"use strict";n.d(t,{F:function(){return o}});var i=n(31635);function o(e,t){var n=(0,i.zs)(t.split("::"),2);e.execCommand(n[0],null,n[1])}},93676:function(e,t,n){"use strict";n.d(t,{g:function(){return c}});var i=n(31635),o=n(22664),s=n(43431),r=n(95473),u=n(81629),c=function(e){function t(t,i){var o=e.call(this)||this;return o.async=t,o._continuous=!1,o._interimResults=!1,o.sound=!0,o._isEnabled=!1,o._restartTimeout=0,o._onSpeechStart=function(e){o._isEnabled&&(o.async.clearTimeout(o._restartTimeout),o._restartTimeout=o.async.setTimeout((function(){o.restart(),o.emit("pulse",!1),o._makeSound(u.Z)}),5e3),o.emit("pulse",!0))},o._progressTimeout=0,o._api=i,n._instances.add(o),o}var n;return(0,i.C6)(t,e),n=t,Object.defineProperty(t.prototype,"lang",{get:function(){return this._lang},set:function(e){this._lang=e,this._api.lang=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"continuous",{get:function(){return this._continuous},set:function(e){this._continuous=e,this._api.continuous=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"interimResults",{get:function(){return this._interimResults},set:function(e){this._interimResults=e,this._api.interimResults=e},enumerable:!1,configurable:!0}),t.prototype.destruct=function(){this.stop(),n._instances.delete(this),e.prototype.destruct.call(this)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},enumerable:!1,configurable:!0}),t.prototype.start=function(){var e=this;this._isEnabled||(this._isEnabled=!0,n._instances.forEach((function(t){t!==e&&t.stop()})),this._api.start(),this.__on("speechstart",this._onSpeechStart).__on("error",this._onError).__on("result",this._onResult))},t.prototype.stop=function(){if(this._isEnabled){try{this._api.abort(),this._api.stop()}catch(e){}this.__off("speechstart",this._onSpeechStart).__off("error",this._onError).__off("result",this._onResult),this.async.clearTimeout(this._restartTimeout),this._isEnabled=!1,this.emit("pulse",!1)}},t.prototype.toggle=function(){this._isEnabled?this.stop():this.start()},t.prototype.restart=function(){this.stop(),this.start()},t.prototype.__on=function(e,t){return this._api.addEventListener(e,t),this},t.prototype.__off=function(e,t){return this._api.removeEventListener(e,t),this},t.prototype._onResult=function(e){var t=this;if(this._isEnabled){this.async.clearTimeout(this._progressTimeout);var n=e.results.item(e.resultIndex),i=n.item(0).transcript,o=function(){try{t.async.clearTimeout(t._restartTimeout),t.emit("result",i)}catch(e){}t.restart(),t.emit("pulse",!1),t._makeSound(u.N)};if(!1===n.isFinal)return this.emit("progress",i),void(this._progressTimeout=this.async.setTimeout(o,500));o()}},t.prototype._onError=function(){this._isEnabled&&(this._makeSound(u.Z),this.emit("pulse",!1),this.restart())},t.prototype._makeSound=function(e){this.sound&&(0,r.s)({frequency:e})},t._instances=new Set,n=(0,i.Cg)([o.autobind],t)}(s.h)},95473:function(e,t,n){"use strict";n.d(t,{s:function(){return o}});var i=n(81629);function o(e){var t=void 0===e?{}:e,n=t.sec,o=void 0===n?.1:n,s=t.frequency,r=void 0===s?i.N:s,u=t.gain,c=void 0===u?.1:u,a=t.type,p=void 0===a?"sine":a;if(void 0!==window.AudioContext||void 0!==window.webkitAudioContext){var l=new(window.AudioContext||window.webkitAudioContext),d=l.createGain(),h=l.createOscillator();h.type=p,h.frequency.value=r,h.connect(d),d.connect(l.destination),h.start(),h.stop(l.currentTime+o),d.gain.value=c}}},61593:function(e){"use strict";e.exports={newline:"الخط الجديد",delete:"حذف",space:"الفضاء","Speech Recognize":"التعرف على الكلام",Sound:"الصوت","Interim Results":"النتائج المؤقتة"}},64458:function(e){"use strict";e.exports={newline:"řádek",delete:"odstranit",space:"prostora","Speech Recognize":"Rozpoznání Řeči",Sound:"Zvuk","Interim Results":"Průběžné Výsledky"}},89601:function(e){"use strict";e.exports={newline:"Zeilenumbruch",delete:"löschen",space:"Raum","Speech Recognize":"Sprache Erkennen",Sound:"Sound","Interim Results":"Zwischenergebnis"}},87710:function(e){"use strict";e.exports={newline:"nueva línea",delete:"eliminar",space:"espacio","Speech Recognize":"Reconocimiento de Voz",Sound:"Sonido","Interim Results":"Resultados Provisionales"}},15603:function(e){"use strict";e.exports={newline:"خط جدید",delete:"حذف",space:"فضا","Speech Recognize":"گفتار را تشخیص دهید",Sound:"صدا","Interim Results":"نتایج موقت"}},84059:function(e){"use strict";e.exports={"Speech Recognize":"Puheentunnistus",newline:"uusi rivi",delete:"poistaa",space:"tilaa",Sound:"Ääni","Interim Results":"Välitulokset"}},13958:function(e){"use strict";e.exports={newline:"nouvelle ligne",delete:"supprimer",space:"espace","Speech Recognize":"Reconnaissance Vocale",Sound:"Son","Interim Results":"Résultats Intermédiaires"}},18717:function(e){"use strict";e.exports={newline:"חדשות",delete:"מחק",space:"שטח","Speech Recognize":"דיבור מזהה",Sound:"קול","Interim Results":"תוצאות ביניים"}},14765:function(e){"use strict";e.exports={newline:"újsor",delete:"törlés",space:"tér","Speech Recognize":"A Beszéd Felismeri",Sound:"Hang","Interim Results":"Időközi Eredmények"}},77995:function(e){"use strict";e.exports={newline:"newline",delete:"Hapus",space:"ruang","Speech Recognize":"Pidato Mengenali",Sound:"Suara","Interim Results":"Hasil Sementara"}},25202:function(e,t,n){"use strict";n.r(t),n.d(t,{ar:function(){return i},cs_cz:function(){return o},de:function(){return s},es:function(){return r},fa:function(){return u},fi:function(){return c},fr:function(){return a},he:function(){return p},hu:function(){return l},id:function(){return d},it:function(){return h},ja:function(){return f},ko:function(){return m},mn:function(){return g},nl:function(){return R},pl:function(){return _},pt_br:function(){return S},ru:function(){return v},tr:function(){return w},zh_cn:function(){return z},zh_tw:function(){return y}});var i=n(61593),o=n(64458),s=n(89601),r=n(87710),u=n(15603),c=n(84059),a=n(13958),p=n(18717),l=n(14765),d=n(77995),h=n(92315),f=n(54711),m=n(68632),g=n(76769),R=n(3424),_=n(85454),S=n(64149),v=n(16491),w=n(48948),z=n(84370),y=n(56646)},92315:function(e){"use strict";e.exports={newline:"nuova riga",delete:"eliminare",space:"spazio","Speech Recognize":"Discorso Riconoscere",Sound:"Suono","Interim Results":"Risultati intermedi"}},54711:function(e){"use strict";e.exports={newline:"改行",delete:"削除",space:"スペース","Speech Recognize":"音声認識",Sound:"音","Interim Results":"中間結果"}},68632:function(e){"use strict";e.exports={newline:"줄 바꿈",delete:"삭제",space:"공간","Speech Recognize":"음성 인식",Sound:"소리","Interim Results":"중간 결과"}},76769:function(e){"use strict";e.exports={newline:"Шинэ мөр",delete:"Устгах",space:"Зай","Speech Recognize":"Дуу хоолой таних",Sound:"Дуу","Interim Results":"Түр зуурын үр дүн"}},3424:function(e){"use strict";e.exports={newline:"regel",delete:"verwijderen",space:"ruimte","Speech Recognize":"Spraak Herkennen",Sound:"Geluid","Interim Results":"Tussentijdse Resultaten"}},85454:function(e){"use strict";e.exports={newline:"newline",delete:"usunąć",space:"przestrzeń","Speech Recognize":"Rozpoznawanie Mowy",Sound:"Dźwięk","Interim Results":"Wyniki Okresowe"}},64149:function(e){"use strict";e.exports={newline:"linha",delete:"excluir",space:"espaco","Speech Recognize":"Discurso Reconhecer",Sound:"Som","Interim Results":"Resultados Provisórios"}},16491:function(e){"use strict";e.exports={newline:"новая строка|перенос|энтер",delete:"удалить",space:"пробел","Speech Recognize":"Распознавание речи",Sound:"Звук","Interim Results":"Промежуточные результаты"}},48948:function(e){"use strict";e.exports={newline:"yeni satır",delete:"silmek",space:"uzay","Speech Recognize":"Konuşma Tanıma",Sound:"Ses","Interim Results":"Ara Sonuçlar"}},84370:function(e){"use strict";e.exports={newline:"新行",delete:"删除",space:"空间","Speech Recognize":"言语识别",Sound:"声音","Interim Results":"中期业绩"}},56646:function(e){"use strict";e.exports={newline:"換行",delete:"刪除",space:"空白","Speech Recognize":"語音辨識",Sound:"聲音","Interim Results":"階段性辨識結果"}},37873:function(e,t,n){"use strict";n.r(t),n.d(t,{SpeechRecognizeNative:function(){return h}});var i=n(31635),o=n(37075),s=n(66927),r=n(55186),u=n(56298),c=n(84976),a=n(71005),p=(n(71096),n(46173)),l=n(50834),d=n(25202),h=function(e){function t(t){var n=e.call(this,t)||this;return n._commandToWord={},t.o.speechRecognize.api&&t.registerButton({group:"state",name:"speechRecognize"}),n}return(0,i.C6)(t,e),t.prototype.afterInit=function(e){var t=this,n=e.o.speechRecognize.commands;n&&((0,u.JW)(d),(0,c.HP)(n,!1).forEach((function(i){i.split("|").forEach((function(o){o=o.trim().toLowerCase(),t._commandToWord[o]=n[i];var s=e.i18n(o);s!==o&&s.split("|").forEach((function(e){t._commandToWord[e.trim().toLowerCase()]=n[i].trim()}))}))})))},t.prototype.beforeDestruct=function(e){},t.prototype.onSpeechRecognizeProgressResult=function(e){var t=this;this.messagePopup||(this.messagePopup=this.j.create.div("jodit-speech-recognize__popup")),this.j.workplace.appendChild(this.messagePopup),this.j.async.setTimeout((function(){r.J.safeRemove(t.messagePopup)}),{label:"onSpeechRecognizeProgressResult",timeout:1e3}),this.messagePopup.innerText=e+"|"},t.prototype.onSpeechRecognizeResult=function(e){var t=this.j,n=t.s;if(r.J.safeRemove(this.messagePopup),!this._checkCommand(e)){var i=n.range,o=n.current();if(n.isCollapsed()&&r.J.isText(o)&&r.J.isOrContains(t.editor,o)&&o.nodeValue){var s=o.nodeValue;o.nodeValue=s+(/[\u00A0 ]\uFEFF*$/.test(s)?"":" ")+e,i.setStartAfter(o),n.selectRange(i),t.synchronizeValues()}else n.insertHTML(e)}},t.prototype._checkCommand=function(e){return e=e.toLowerCase().replace(/\./g,""),!!this._commandToWord[e]&&((0,l.F)(this.j,this._commandToWord[e]),!0)},(0,i.Cg)([(0,s.w)(":speechRecognizeProgressResult"),(0,o.s)()],t.prototype,"onSpeechRecognizeProgressResult",null),(0,i.Cg)([(0,s.w)(":speechRecognizeResult")],t.prototype,"onSpeechRecognizeResult",null),t}(a.k);p.x.plugins.add("speech-recognize",h)},22227:function(e){e.exports='<svg viewBox="0 0 16 16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <path d="M8,11c1.657,0,3-1.343,3-3V3c0-1.657-1.343-3-3-3S5,1.343,5,3v5C5,9.657,6.343,11,8,11z"/> <path d="M13,8V6h-1l0,1.844c0,1.92-1.282,3.688-3.164,4.071C6.266,12.438,4,10.479,4,8V6H3v2c0,2.414,1.721,4.434,4,4.899V15H5v1h6 v-1H9v-2.101C11.279,12.434,13,10.414,13,8z"/> </svg>'}},function(e){return e(e.s=37873)}])}));
|
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.2.
|
|
6
|
+
export const APP_VERSION = "4.2.17";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -7,9 +7,9 @@ import { isArray } from "../checker/is-array.js";
|
|
|
7
7
|
import { isPlainObject } from "../checker/is-plain-object.js";
|
|
8
8
|
import { isString } from "../checker/is-string.js";
|
|
9
9
|
import { isVoid } from "../checker/is-void.js";
|
|
10
|
+
import { Config } from "../../../config.js";
|
|
10
11
|
import { isAtom } from "./extend.js";
|
|
11
12
|
import { keys } from "./utils.js";
|
|
12
|
-
import { Config } from "../../../config.js";
|
|
13
13
|
/**
|
|
14
14
|
* @example
|
|
15
15
|
* ```js
|
package/esm/core/request/ajax.js
CHANGED
|
@@ -17,9 +17,9 @@ import { Async } from "../async/index.js";
|
|
|
17
17
|
import { autobind } from "../decorators/autobind/autobind.js";
|
|
18
18
|
import { buildQuery, ConfigProto, isFunction, isPlainObject, isString, parseQuery } from "../helpers/index.js";
|
|
19
19
|
import * as error from "../helpers/utils/error/index.js";
|
|
20
|
+
import { Config } from "../../config.js";
|
|
20
21
|
import "./config.js";
|
|
21
22
|
import { Response } from "./response.js";
|
|
22
|
-
import { Config } from "../../config.js";
|
|
23
23
|
export class Ajax {
|
|
24
24
|
className() {
|
|
25
25
|
return 'Ajax';
|
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* @module selection
|
|
8
|
-
*/
|
|
9
6
|
export * from "./move-node-inside-start";
|
|
10
7
|
export * from "./move-the-node-along-the-edge-outward";
|
|
8
|
+
/**
|
|
9
|
+
* Check if the cursor is at the edge of the string
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare function cursorInTheEdgeOfString(container: Node, offset: number, start: boolean, end: boolean): boolean;
|
|
13
|
+
export declare function findCorrectCurrentNode(node: Node, range: Range, rightMode: boolean, isCollapsed: boolean, checkChild: boolean, child: (nd: Node) => Node | null): {
|
|
14
|
+
node: Node;
|
|
15
|
+
rightMode: boolean;
|
|
16
|
+
};
|
|
@@ -6,5 +6,53 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module selection
|
|
8
8
|
*/
|
|
9
|
+
import { INVISIBLE_SPACE_REG_EXP_END as INV_END, INVISIBLE_SPACE_REG_EXP_START as INV_START } from "../../constants.js";
|
|
10
|
+
import { Dom } from "../../dom/dom.js";
|
|
9
11
|
export * from "./move-node-inside-start.js";
|
|
10
12
|
export * from "./move-the-node-along-the-edge-outward.js";
|
|
13
|
+
/**
|
|
14
|
+
* Check if the cursor is at the edge of the string
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
export function cursorInTheEdgeOfString(container, offset, start, end) {
|
|
18
|
+
const text = container.nodeValue?.length ? container.nodeValue : '';
|
|
19
|
+
if (end && text.replace(INV_END(), '').length > offset) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
const inv = INV_START().exec(text);
|
|
23
|
+
return start && ((inv && inv[0].length < offset) || (!inv && offset > 0));
|
|
24
|
+
}
|
|
25
|
+
export function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild, child) {
|
|
26
|
+
node = range.startContainer.childNodes[range.startOffset];
|
|
27
|
+
if (!node) {
|
|
28
|
+
node = range.startContainer.childNodes[range.startOffset - 1];
|
|
29
|
+
rightMode = true;
|
|
30
|
+
}
|
|
31
|
+
if (node && isCollapsed && !Dom.isText(node)) {
|
|
32
|
+
// test Current method - Cursor in the left of some SPAN
|
|
33
|
+
if (!rightMode && Dom.isText(node.previousSibling)) {
|
|
34
|
+
node = node.previousSibling;
|
|
35
|
+
}
|
|
36
|
+
else if (checkChild) {
|
|
37
|
+
let current = child(node);
|
|
38
|
+
while (current) {
|
|
39
|
+
if (current && Dom.isText(current)) {
|
|
40
|
+
node = current;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
current = child(current);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (node && !isCollapsed && !Dom.isText(node)) {
|
|
48
|
+
let leftChild = node, rightChild = node;
|
|
49
|
+
do {
|
|
50
|
+
leftChild = leftChild.firstChild;
|
|
51
|
+
rightChild = rightChild.lastChild;
|
|
52
|
+
} while (leftChild && rightChild && !Dom.isText(leftChild));
|
|
53
|
+
if (leftChild === rightChild && leftChild && Dom.isText(leftChild)) {
|
|
54
|
+
node = leftChild;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { node, rightMode };
|
|
58
|
+
}
|
|
@@ -125,10 +125,11 @@ export declare class Selection implements ISelect {
|
|
|
125
125
|
/**
|
|
126
126
|
* Returns the current element under the cursor inside editor
|
|
127
127
|
*/
|
|
128
|
-
current(checkChild?: boolean):
|
|
128
|
+
current(checkChild?: boolean): Nullable<Node>;
|
|
129
129
|
/**
|
|
130
130
|
* Insert element in editor
|
|
131
131
|
*
|
|
132
|
+
* @param node - Node for insert
|
|
132
133
|
* @param insertCursorAfter - After insert, cursor will move after element
|
|
133
134
|
* @param fireChange - After insert, editor fire change event. You can prevent this behavior
|
|
134
135
|
*/
|
|
@@ -137,6 +138,7 @@ export declare class Selection implements ISelect {
|
|
|
137
138
|
* Inserts in the current cursor position some HTML snippet
|
|
138
139
|
*
|
|
139
140
|
* @param html - HTML The text to be inserted into the document
|
|
141
|
+
* @param insertCursorAfter - After insert, cursor will move after element
|
|
140
142
|
* @example
|
|
141
143
|
* ```javascript
|
|
142
144
|
* parent.s.insertHTML('<img src="image.png"/>');
|
|
@@ -148,6 +150,7 @@ export declare class Selection implements ISelect {
|
|
|
148
150
|
*
|
|
149
151
|
* @param url - URL for image, or HTMLImageElement
|
|
150
152
|
* @param styles - If specified, it will be applied <code>$(image).css(styles)</code>
|
|
153
|
+
* @param defaultWidth - If specified, it will be applied <code>css('width', defaultWidth)</code>
|
|
151
154
|
*/
|
|
152
155
|
insertImage(url: string | HTMLImageElement, styles?: Nullable<IDictionary<string>>, defaultWidth?: Nullable<number | string>): void;
|
|
153
156
|
/**
|
|
@@ -188,6 +191,7 @@ export declare class Selection implements ISelect {
|
|
|
188
191
|
private setCursorNearWith;
|
|
189
192
|
/**
|
|
190
193
|
* Set cursor in the node
|
|
194
|
+
* @param node - Node element
|
|
191
195
|
* @param inStart - set cursor in start of element
|
|
192
196
|
*/
|
|
193
197
|
setCursorIn(node: Node, inStart?: boolean): Node;
|
|
@@ -197,6 +201,7 @@ export declare class Selection implements ISelect {
|
|
|
197
201
|
selectRange(range: Range, focus?: boolean): this;
|
|
198
202
|
/**
|
|
199
203
|
* Select node
|
|
204
|
+
* @param node - Node element
|
|
200
205
|
* @param inward - select all inside
|
|
201
206
|
*/
|
|
202
207
|
select(node: Node | HTMLElement | HTMLTableElement | HTMLTableCellElement, inward?: boolean): this;
|
|
@@ -14,7 +14,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
14
14
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
15
|
};
|
|
16
16
|
import * as consts from "../constants.js";
|
|
17
|
-
import { INSEPARABLE_TAGS, INVISIBLE_SPACE,
|
|
17
|
+
import { INSEPARABLE_TAGS, INVISIBLE_SPACE, IS_PROD } from "../constants.js";
|
|
18
18
|
import { autobind } from "../decorators/index.js";
|
|
19
19
|
import { Dom } from "../dom/dom.js";
|
|
20
20
|
import { $$, attr, call, css, error, getScrollParent, scrollIntoViewIfNeeded, size, toArray } from "../helpers/index.js";
|
|
@@ -23,6 +23,7 @@ import { assert } from "../helpers/utils/assert.js";
|
|
|
23
23
|
import { moveTheNodeAlongTheEdgeOutward } from "./helpers/move-the-node-along-the-edge-outward.js";
|
|
24
24
|
import "./interface.js";
|
|
25
25
|
import { CommitStyle } from "./style/commit-style.js";
|
|
26
|
+
import { cursorInTheEdgeOfString, findCorrectCurrentNode } from "./helpers/index.js";
|
|
26
27
|
export class Selection {
|
|
27
28
|
constructor(jodit) {
|
|
28
29
|
this.jodit = jodit;
|
|
@@ -405,63 +406,35 @@ export class Selection {
|
|
|
405
406
|
* Returns the current element under the cursor inside editor
|
|
406
407
|
*/
|
|
407
408
|
current(checkChild = true) {
|
|
408
|
-
if (this.j.getRealMode()
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
else if (checkChild) {
|
|
432
|
-
let current = child(node);
|
|
433
|
-
while (current) {
|
|
434
|
-
if (current && Dom.isText(current)) {
|
|
435
|
-
node = current;
|
|
436
|
-
break;
|
|
437
|
-
}
|
|
438
|
-
current = child(current);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
if (node && !sel.isCollapsed && !Dom.isText(node)) {
|
|
443
|
-
let leftChild = node, rightChild = node;
|
|
444
|
-
do {
|
|
445
|
-
leftChild = leftChild.firstChild;
|
|
446
|
-
rightChild = rightChild.lastChild;
|
|
447
|
-
} while (leftChild && rightChild && !Dom.isText(leftChild));
|
|
448
|
-
if (leftChild === rightChild &&
|
|
449
|
-
leftChild &&
|
|
450
|
-
Dom.isText(leftChild)) {
|
|
451
|
-
node = leftChild;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
// check - cursor inside editor
|
|
456
|
-
if (node && Dom.isOrContains(this.area, node)) {
|
|
457
|
-
return node;
|
|
458
|
-
}
|
|
409
|
+
if (this.j.getRealMode() !== consts.MODE_WYSIWYG) {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
const sel = this.sel;
|
|
413
|
+
if (!sel || sel.rangeCount === 0) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
const range = sel.getRangeAt(0);
|
|
417
|
+
let node = range.startContainer;
|
|
418
|
+
let rightMode = false;
|
|
419
|
+
const child = (nd) => rightMode ? nd.lastChild : nd.firstChild;
|
|
420
|
+
if (Dom.isTag(node, 'br') && sel.isCollapsed) {
|
|
421
|
+
return node;
|
|
422
|
+
}
|
|
423
|
+
if (!Dom.isText(node)) {
|
|
424
|
+
const ret = findCorrectCurrentNode(node, range, rightMode, sel.isCollapsed, checkChild, child);
|
|
425
|
+
node = ret.node;
|
|
426
|
+
rightMode = ret.rightMode;
|
|
427
|
+
}
|
|
428
|
+
// check - cursor inside editor
|
|
429
|
+
if (node && Dom.isOrContains(this.area, node)) {
|
|
430
|
+
return node;
|
|
459
431
|
}
|
|
460
432
|
return null;
|
|
461
433
|
}
|
|
462
434
|
/**
|
|
463
435
|
* Insert element in editor
|
|
464
436
|
*
|
|
437
|
+
* @param node - Node for insert
|
|
465
438
|
* @param insertCursorAfter - After insert, cursor will move after element
|
|
466
439
|
* @param fireChange - After insert, editor fire change event. You can prevent this behavior
|
|
467
440
|
*/
|
|
@@ -523,6 +496,7 @@ export class Selection {
|
|
|
523
496
|
* Inserts in the current cursor position some HTML snippet
|
|
524
497
|
*
|
|
525
498
|
* @param html - HTML The text to be inserted into the document
|
|
499
|
+
* @param insertCursorAfter - After insert, cursor will move after element
|
|
526
500
|
* @example
|
|
527
501
|
* ```javascript
|
|
528
502
|
* parent.s.insertHTML('<img src="image.png"/>');
|
|
@@ -566,6 +540,7 @@ export class Selection {
|
|
|
566
540
|
*
|
|
567
541
|
* @param url - URL for image, or HTMLImageElement
|
|
568
542
|
* @param styles - If specified, it will be applied <code>$(image).css(styles)</code>
|
|
543
|
+
* @param defaultWidth - If specified, it will be applied <code>css('width', defaultWidth)</code>
|
|
569
544
|
*/
|
|
570
545
|
insertImage(url, styles = null, defaultWidth = null) {
|
|
571
546
|
const image = isString(url) ? this.j.createInside.element('img') : url;
|
|
@@ -620,74 +595,81 @@ export class Selection {
|
|
|
620
595
|
*/
|
|
621
596
|
eachSelection(callback) {
|
|
622
597
|
const sel = this.sel;
|
|
623
|
-
if (sel
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
598
|
+
if (!sel || !sel.rangeCount) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const range = sel.getRangeAt(0);
|
|
602
|
+
let root = range.commonAncestorContainer;
|
|
603
|
+
if (!Dom.isHTMLElement(root)) {
|
|
604
|
+
root = root.parentElement;
|
|
605
|
+
}
|
|
606
|
+
const nodes = [];
|
|
607
|
+
const startOffset = range.startOffset;
|
|
608
|
+
const length = root.childNodes.length;
|
|
609
|
+
const elementOffset = startOffset < length ? startOffset : length - 1;
|
|
610
|
+
let start = range.startContainer === this.area
|
|
611
|
+
? root.childNodes[elementOffset]
|
|
612
|
+
: range.startContainer;
|
|
613
|
+
let end = range.endContainer === this.area
|
|
614
|
+
? root.childNodes[range.endOffset - 1]
|
|
615
|
+
: range.endContainer;
|
|
616
|
+
if (Dom.isText(start) &&
|
|
617
|
+
start === range.startContainer &&
|
|
618
|
+
range.startOffset === start.nodeValue?.length &&
|
|
619
|
+
start.nextSibling) {
|
|
620
|
+
start = start.nextSibling;
|
|
621
|
+
}
|
|
622
|
+
if (Dom.isText(end) &&
|
|
623
|
+
end === range.endContainer &&
|
|
624
|
+
range.endOffset === 0 &&
|
|
625
|
+
end.previousSibling) {
|
|
626
|
+
end = end.previousSibling;
|
|
627
|
+
}
|
|
628
|
+
const checkElm = (node) => {
|
|
629
|
+
if (node &&
|
|
630
|
+
node !== root &&
|
|
631
|
+
!Dom.isEmptyTextNode(node) &&
|
|
632
|
+
!isMarker(node)) {
|
|
633
|
+
nodes.push(node);
|
|
640
634
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
635
|
+
};
|
|
636
|
+
checkElm(start);
|
|
637
|
+
if (start !== end && Dom.isOrContains(root, start, true)) {
|
|
638
|
+
Dom.find(start, node => {
|
|
639
|
+
checkElm(node);
|
|
640
|
+
// checks parentElement as well because partial selections are not equal to entire element
|
|
641
|
+
return (node === end ||
|
|
642
|
+
(node && node.contains && node.contains(end)));
|
|
643
|
+
}, root, true, false);
|
|
644
|
+
}
|
|
645
|
+
const forEvery = (current) => {
|
|
646
|
+
if (!Dom.isOrContains(this.j.editor, current, true)) {
|
|
647
|
+
return;
|
|
646
648
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
node !== root &&
|
|
650
|
-
!Dom.isEmptyTextNode(node) &&
|
|
651
|
-
!isMarker(node)) {
|
|
652
|
-
nodes.push(node);
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
checkElm(start);
|
|
656
|
-
if (start !== end && Dom.isOrContains(root, start, true)) {
|
|
657
|
-
Dom.find(start, node => {
|
|
658
|
-
checkElm(node);
|
|
659
|
-
// checks parentElement as well because partial selections are not equal to entire element
|
|
660
|
-
return (node === end ||
|
|
661
|
-
(node && node.contains && node.contains(end)));
|
|
662
|
-
}, root, true, false);
|
|
649
|
+
if (current.nodeName.match(/^(UL|OL)$/)) {
|
|
650
|
+
return toArray(current.childNodes).forEach(forEvery);
|
|
663
651
|
}
|
|
664
|
-
|
|
665
|
-
if (
|
|
666
|
-
|
|
667
|
-
}
|
|
668
|
-
if (current.nodeName.match(/^(UL|OL)$/)) {
|
|
669
|
-
return toArray(current.childNodes).forEach(forEvery);
|
|
652
|
+
if (Dom.isTag(current, 'li')) {
|
|
653
|
+
if (current.firstChild) {
|
|
654
|
+
current = current.firstChild;
|
|
670
655
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
else {
|
|
676
|
-
const currentB = this.j.createInside.text(INVISIBLE_SPACE);
|
|
677
|
-
current.appendChild(currentB);
|
|
678
|
-
current = currentB;
|
|
679
|
-
}
|
|
656
|
+
else {
|
|
657
|
+
const currentB = this.j.createInside.text(INVISIBLE_SPACE);
|
|
658
|
+
current.appendChild(currentB);
|
|
659
|
+
current = currentB;
|
|
680
660
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
661
|
+
}
|
|
662
|
+
callback(current);
|
|
663
|
+
};
|
|
664
|
+
if (nodes.length === 0) {
|
|
665
|
+
if (Dom.isEmptyTextNode(start)) {
|
|
684
666
|
nodes.push(start);
|
|
685
667
|
}
|
|
686
|
-
if (
|
|
668
|
+
if (start.firstChild) {
|
|
687
669
|
nodes.push(start.firstChild);
|
|
688
670
|
}
|
|
689
|
-
nodes.forEach(forEvery);
|
|
690
671
|
}
|
|
672
|
+
nodes.forEach(forEvery);
|
|
691
673
|
}
|
|
692
674
|
/**
|
|
693
675
|
* Checks if the cursor is at the end(start) block
|
|
@@ -714,13 +696,7 @@ export class Selection {
|
|
|
714
696
|
this.j.e.fire('isInvisibleForCursor', elm) === true));
|
|
715
697
|
// check right offset
|
|
716
698
|
if (Dom.isText(container)) {
|
|
717
|
-
|
|
718
|
-
if (end && text.replace(INV_END(), '').length > offset) {
|
|
719
|
-
return false;
|
|
720
|
-
}
|
|
721
|
-
const inv = INV_START().exec(text);
|
|
722
|
-
if (start &&
|
|
723
|
-
((inv && inv[0].length < offset) || (!inv && offset > 0))) {
|
|
699
|
+
if (cursorInTheEdgeOfString(container, offset, start, end)) {
|
|
724
700
|
return false;
|
|
725
701
|
}
|
|
726
702
|
}
|
|
@@ -808,6 +784,7 @@ export class Selection {
|
|
|
808
784
|
}
|
|
809
785
|
/**
|
|
810
786
|
* Set cursor in the node
|
|
787
|
+
* @param node - Node element
|
|
811
788
|
* @param inStart - set cursor in start of element
|
|
812
789
|
*/
|
|
813
790
|
setCursorIn(node, inStart = false) {
|
|
@@ -868,6 +845,7 @@ export class Selection {
|
|
|
868
845
|
}
|
|
869
846
|
/**
|
|
870
847
|
* Select node
|
|
848
|
+
* @param node - Node element
|
|
871
849
|
* @param inward - select all inside
|
|
872
850
|
*/
|
|
873
851
|
select(node, inward = false) {
|