jodit 4.16.0 → 4.17.0

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/es2015/jodit.css +11 -1
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +7 -7
  5. package/es2015/jodit.js +176 -33
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +7 -7
  8. package/es2015/plugins/debug/debug.css +1 -1
  9. package/es2015/plugins/debug/debug.js +1 -1
  10. package/es2015/plugins/debug/debug.min.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +7 -7
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +7 -7
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +11 -1
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +7 -7
  23. package/es2021/jodit.js +168 -32
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +7 -7
  26. package/es2021/plugins/debug/debug.css +1 -1
  27. package/es2021/plugins/debug/debug.js +1 -1
  28. package/es2021/plugins/debug/debug.min.js +1 -1
  29. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  32. package/es2021.en/jodit.css +11 -1
  33. package/es2021.en/jodit.fat.min.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +7 -7
  35. package/es2021.en/jodit.js +168 -32
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +7 -7
  38. package/es2021.en/plugins/debug/debug.css +1 -1
  39. package/es2021.en/plugins/debug/debug.js +1 -1
  40. package/es2021.en/plugins/debug/debug.min.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  44. package/es5/jodit.css +15 -2
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +188 -33
  48. package/es5/jodit.min.css +3 -3
  49. package/es5/jodit.min.js +2 -2
  50. package/es5/plugins/debug/debug.css +1 -1
  51. package/es5/plugins/debug/debug.js +1 -1
  52. package/es5/plugins/debug/debug.min.js +1 -1
  53. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  56. package/es5/polyfills.fat.min.js +1 -1
  57. package/es5/polyfills.js +1 -1
  58. package/es5/polyfills.min.js +1 -1
  59. package/esm/config.d.ts +40 -1
  60. package/esm/core/constants.js +1 -1
  61. package/esm/modules/widget/file-selector/file-selector.d.ts +10 -1
  62. package/esm/modules/widget/file-selector/file-selector.js +30 -18
  63. package/esm/plugins/file/file.d.ts +24 -1
  64. package/esm/plugins/file/file.js +17 -1
  65. package/esm/plugins/iframe/config.js +4 -0
  66. package/esm/plugins/image-processor/image-processor.d.ts +5 -0
  67. package/esm/plugins/image-processor/image-processor.js +29 -2
  68. package/esm/plugins/inline-popup/config/items/img.js +22 -1
  69. package/esm/plugins/source/editor/engines/ace.js +2 -1
  70. package/esm/plugins/source/source.d.ts +17 -0
  71. package/esm/plugins/source/source.js +58 -10
  72. package/esm/plugins/video/config.d.ts +21 -1
  73. package/esm/plugins/video/config.js +22 -2
  74. package/package.json +1 -1
  75. package/types/config.d.ts +40 -1
  76. package/types/modules/widget/file-selector/file-selector.d.ts +10 -1
  77. package/types/plugins/file/file.d.ts +24 -1
  78. package/types/plugins/image-processor/image-processor.d.ts +5 -0
  79. package/types/plugins/source/source.d.ts +17 -0
  80. package/types/plugins/video/config.d.ts +21 -1
package/es2015/jodit.js CHANGED
@@ -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.16.0
4
+ * Version: v4.17.0
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1805,7 +1805,7 @@ __webpack_require__.r(__webpack_exports__);
1805
1805
  * ```
1806
1806
  * @packageDocumentation
1807
1807
  * @module constants
1808
- */ const APP_VERSION = "4.16.0";
1808
+ */ const APP_VERSION = "4.17.0";
1809
1809
  // prettier-ignore
1810
1810
  const ES = "es2015";
1811
1811
  const IS_ES_MODERN = true;
@@ -26399,22 +26399,19 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
26399
26399
  const tabs = [];
26400
26400
  const options = editor.o.uploader;
26401
26401
  if (callbacks.upload && options.showTabInFileSelector !== false && (options.url || options.insertImageAsBase64URI || options.customUploadFunction)) {
26402
- const dragBox = editor.c.fromHTML('<div class="jodit-drag-and-drop__file-box">' + `<strong>${editor.i18n(isImage ? 'Drop image' : 'Drop file')}</strong>` + `<span><br>${editor.i18n('or click')}</span>` + `<input type="file" accept="${isImage ? 'image/*' : '*'}" tabindex="-1" dir="auto" multiple=""/>` + '</div>');
26403
- editor.uploader.bind(dragBox, (resp)=>{
26404
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(callbacks.upload) ? callbacks.upload : options.defaultHandlerSuccess;
26402
+ const { upload } = callbacks;
26403
+ tabs.push(UploadTab(editor, (resp)=>{
26404
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(upload) ? upload : options.defaultHandlerSuccess;
26405
26405
  if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handler)) {
26406
26406
  handler.call(editor, resp);
26407
26407
  }
26408
- editor.e.fire('closeAllPopups');
26409
- }, (error)=>{
26410
- editor.message.error(error.message);
26411
- editor.e.fire('closeAllPopups');
26412
- });
26413
- tabs.push({
26414
- icon: 'upload',
26415
- name: 'Upload',
26416
- content: dragBox
26417
- });
26408
+ }, isImage ? {
26409
+ label: 'Drop image',
26410
+ accept: 'image/*'
26411
+ } : {
26412
+ label: 'Drop file',
26413
+ accept: '*'
26414
+ }));
26418
26415
  }
26419
26416
  if (callbacks.filebrowser) {
26420
26417
  if (editor.o.filebrowser.ajax.url || editor.o.filebrowser.items.url) {
@@ -26482,6 +26479,24 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
26482
26479
  box.classList.add('jodit-file-selector');
26483
26480
  return box;
26484
26481
  };
26482
+ /**
26483
+ * The Upload tab: a box that uploads the files dropped on it or chosen in its
26484
+ * file input, then passes the uploader's answer to `onSuccess` and closes the popup
26485
+ */ const UploadTab = (editor, onSuccess, { label, accept })=>{
26486
+ const dragBox = editor.c.fromHTML('<div class="jodit-drag-and-drop__file-box">' + `<strong>${editor.i18n(label)}</strong>` + `<span><br>${editor.i18n('or click')}</span>` + `<input type="file" accept="${accept}" tabindex="-1" dir="auto" multiple=""/>` + '</div>');
26487
+ editor.uploader.bind(dragBox, (resp)=>{
26488
+ onSuccess.call(editor, resp);
26489
+ editor.e.fire('closeAllPopups');
26490
+ }, (error)=>{
26491
+ editor.message.error(error.message);
26492
+ editor.e.fire('closeAllPopups');
26493
+ });
26494
+ return {
26495
+ icon: 'upload',
26496
+ name: 'Upload',
26497
+ content: dragBox
26498
+ };
26499
+ };
26485
26500
  function val(elm, name, value) {
26486
26501
  const child = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.first(elm, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(node, 'input') && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(node, 'name') === name);
26487
26502
  if (!child) {
@@ -26494,7 +26509,8 @@ function val(elm, name, value) {
26494
26509
  }
26495
26510
 
26496
26511
  /* harmony export */ __webpack_require__.d(__webpack_exports__, [
26497
- /* harmony export */ "FileSelectorWidget", 0, /* binding */ FileSelectorWidget
26512
+ /* harmony export */ "FileSelectorWidget", 0, /* binding */ FileSelectorWidget,
26513
+ /* harmony export */ "UploadTab", 0, /* binding */ UploadTab
26498
26514
  /* harmony export */ ]);
26499
26515
 
26500
26516
 
@@ -26507,7 +26523,8 @@ function val(elm, name, value) {
26507
26523
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26508
26524
  /* harmony export */ ColorPickerWidget: function() { return /* reexport safe */ _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__.ColorPickerWidget; },
26509
26525
  /* harmony export */ FileSelectorWidget: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.FileSelectorWidget; },
26510
- /* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; }
26526
+ /* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; },
26527
+ /* harmony export */ UploadTab: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.UploadTab; }
26511
26528
  /* harmony export */ });
26512
26529
  /* harmony import */ var _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72348);
26513
26530
  /* harmony import */ var _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18762);
@@ -32223,6 +32240,19 @@ function brBefore(start) {
32223
32240
 
32224
32241
 
32225
32242
 
32243
+ function insertLinks(data) {
32244
+ var _data_files;
32245
+ (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach((file)=>{
32246
+ const link = this.createInside.element('a', {
32247
+ href: data.baseurl + file
32248
+ });
32249
+ link.textContent = this.o.uploader.getDisplayName.call(this.uploader, data.baseurl, file);
32250
+ this.s.insertNode(link);
32251
+ });
32252
+ }
32253
+ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
32254
+ defaultHandlerSuccess: insertLinks
32255
+ };
32226
32256
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
32227
32257
  popup: (editor, current, close)=>{
32228
32258
  const insert = (url, title = '')=>{
@@ -32237,7 +32267,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
32237
32267
  data.files && data.files.forEach((file)=>insert(data.baseurl + file));
32238
32268
  close();
32239
32269
  },
32240
- upload: true,
32270
+ upload: (data)=>{
32271
+ var _ref;
32272
+ var _editor_o_file;
32273
+ ((_ref = (_editor_o_file = editor.o.file) === null || _editor_o_file === void 0 ? void 0 : _editor_o_file.defaultHandlerSuccess) !== null && _ref !== void 0 ? _ref : insertLinks).call(editor, data);
32274
+ },
32241
32275
  url: (url, text)=>{
32242
32276
  if (sourceAnchor) {
32243
32277
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(sourceAnchor, 'href', url);
@@ -33135,7 +33169,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeBaseUrl = '';
33135
33169
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeTitle = 'Jodit Editor';
33136
33170
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDoctype = '<!DOCTYPE html>';
33137
33171
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDefaultSrc = 'about:blank';
33138
- jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeStyle = 'html{' + 'margin:0;' + 'padding:0;' + 'min-height: 100%;' + '}' + 'body{' + 'box-sizing:border-box;' + 'font-size:13px;' + 'line-height:1.6;' + 'padding:10px;' + 'margin:0;' + 'background:transparent;' + 'color:#000;' + 'position:' + 'relative;' + 'z-index:2;' + 'user-select:auto;' + 'margin:0px;' + 'overflow:auto;' + 'outline:none;' + '}' + 'table{' + 'width:100%;' + 'border:none;' + 'border-collapse:collapse;' + 'empty-cells: show;' + 'max-width: 100%;' + '}' + 'th,td{' + 'padding: 2px 5px;' + 'border:1px solid #ccc;' + '-webkit-user-select:text;' + '-moz-user-select:text;' + '-ms-user-select:text;' + 'user-select:text' + '}' + 'p{' + 'margin-top:0;' + '}' + '.jodit_editor .jodit_iframe_wrapper{' + 'display: block;' + 'clear: both;' + 'user-select: none;' + 'position: relative;' + '}' + '.jodit_editor .jodit_iframe_wrapper:after {' + 'position:absolute;' + 'content:"";' + 'z-index:1;' + 'top:0;' + 'left:0;' + 'right: 0;' + 'bottom: 0;' + 'cursor: pointer;' + 'display: block;' + 'background: rgba(0, 0, 0, 0);' + '} ' + '.jodit_disabled{' + 'user-select: none;' + '-o-user-select: none;' + '-moz-user-select: none;' + '-khtml-user-select: none;' + '-webkit-user-select: none;' + '-ms-user-select: none' + '}';
33172
+ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeStyle = 'html{' + 'margin:0;' + 'padding:0;' + 'min-height: 100%;' + '}' + 'body{' + 'box-sizing:border-box;' + 'font-size:13px;' + 'line-height:1.6;' + 'padding:10px;' + 'margin:0;' + 'background:transparent;' + 'color:#000;' + 'position:' + 'relative;' + 'z-index:2;' + 'user-select:auto;' + 'margin:0px;' + 'overflow:auto;' + 'outline:none;' + '}' + 'table{' + 'width:100%;' + 'border:none;' + 'border-collapse:collapse;' + 'empty-cells: show;' + 'max-width: 100%;' + '}' + 'th,td{' + 'padding: 2px 5px;' + 'border:1px solid #ccc;' + '-webkit-user-select:text;' + '-moz-user-select:text;' + '-ms-user-select:text;' + 'user-select:text' + '}' + 'p{' + 'margin-top:0;' + '}' + '.jodit_editor .jodit_iframe_wrapper{' + 'display: block;' + 'clear: both;' + 'user-select: none;' + 'position: relative;' + '}' + '.jodit_editor .jodit_iframe_wrapper:after {' + 'position:absolute;' + 'content:"";' + 'z-index:1;' + 'top:0;' + 'left:0;' + 'right: 0;' + 'bottom: 0;' + 'cursor: pointer;' + 'display: block;' + 'background: rgba(0, 0, 0, 0);' + '} ' + '.jodit-wysiwyg_image-selected::selection,' + '.jodit-wysiwyg_image-selected *:not(img)::selection{' + 'background:transparent' + '}' + '.jodit_disabled{' + 'user-select: none;' + '-o-user-select: none;' + '-moz-user-select: none;' + '-khtml-user-select: none;' + '-webkit-user-select: none;' + '-ms-user-select: none' + '}';
33139
33173
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeCSSLinks = [];
33140
33174
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeSandbox = null;
33141
33175
 
@@ -33380,13 +33414,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
33380
33414
 
33381
33415
 
33382
33416
 
33417
+
33383
33418
  const JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
33384
33419
  const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33420
+ const IMAGE_SELECTED = 'jodit-wysiwyg_image-selected';
33385
33421
  /**
33386
33422
  * Change editor's size after load all images
33387
33423
  */ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
33388
- afterInit(jodit) {}
33424
+ afterInit(jodit) {
33425
+ jodit.e.on(jodit.ed, 'selectionchange', this.onSelectionChange);
33426
+ }
33389
33427
  beforeDestruct(jodit) {
33428
+ jodit.e.off(jodit.ed, 'selectionchange', this.onSelectionChange);
33429
+ jodit.editor.classList.remove(IMAGE_SELECTED);
33390
33430
  const buffer = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.cached)(jodit, 'buffer');
33391
33431
  const list = buffer === null || buffer === void 0 ? void 0 : buffer.get(JODIT_IMAGE_BLOB_ID);
33392
33432
  if (buffer && list) {
@@ -33417,6 +33457,13 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33417
33457
  }
33418
33458
  }
33419
33459
  }
33460
+ /**
33461
+ * While the selection is an image, only the image is highlighted: Safari
33462
+ * paints the rest of a block image's line with its parent's highlight. See #1528
33463
+ */ onSelectionChange() {
33464
+ const { jodit } = this;
33465
+ jodit.editor.classList.toggle(IMAGE_SELECTED, isImageSelected(jodit));
33466
+ }
33420
33467
  afterChange(data) {
33421
33468
  return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function*() {
33422
33469
  const { jodit: editor } = this;
@@ -33451,6 +33498,9 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33451
33498
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33452
33499
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':beforeSetElementValue')
33453
33500
  ], imageProcessor.prototype, "onBeforeSetElementValue", null);
33501
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33502
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
33503
+ ], imageProcessor.prototype, "onSelectionChange", null);
33454
33504
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33455
33505
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
33456
33506
  ':change',
@@ -33459,6 +33509,14 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33459
33509
  ]),
33460
33510
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.debounce)()
33461
33511
  ], imageProcessor.prototype, "afterChange", null);
33512
+ function isImageSelected(jodit) {
33513
+ const { sel } = jodit.s;
33514
+ if (!sel || !sel.rangeCount) {
33515
+ return false;
33516
+ }
33517
+ const { startContainer, startOffset, endContainer, endOffset } = sel.getRangeAt(0);
33518
+ return startContainer === endContainer && endOffset === startOffset + 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(startContainer.childNodes[startOffset], 'img') && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, startContainer);
33519
+ }
33462
33520
  /**
33463
33521
  * Remove the invisible-space text beside an image, which only held a caret.
33464
33522
  * Selecting the image replaces the caret, and with the text still after a
@@ -35758,6 +35816,26 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35758
35816
  // Images align with `imageAlignClasses`; the wrappers of iframes and media
35759
35817
  // keep inline styles
35760
35818
  const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
35819
+ // A Normal image sits where the text of its line is aligned (#1531)
35820
+ const lineAlign = (editor, elm)=>{
35821
+ const block = elm && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(elm, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock, editor.editor) || editor.editor;
35822
+ const rtl = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(block, 'direction') === 'rtl';
35823
+ switch((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(block, 'text-align')){
35824
+ case 'center':
35825
+ case '-webkit-center':
35826
+ return 'center';
35827
+ case 'justify':
35828
+ return 'justify';
35829
+ case 'right':
35830
+ return 'right';
35831
+ case 'end':
35832
+ return rtl ? 'left' : 'right';
35833
+ case 'start':
35834
+ return rtl ? 'right' : 'left';
35835
+ default:
35836
+ return 'left';
35837
+ }
35838
+ };
35761
35839
  const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
35762
35840
  const align = {
35763
35841
  name: 'left',
@@ -35770,7 +35848,7 @@ const align = {
35770
35848
  ],
35771
35849
  update: (editor, button)=>{
35772
35850
  const current = currentAlign(editor, button.target);
35773
- button.state.icon.name = current === 'normal' ? 'left' : current;
35851
+ button.state.icon.name = current === 'normal' ? lineAlign(editor, button.target) : current;
35774
35852
  },
35775
35853
  isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
35776
35854
  isChildActive: (editor, button)=>{
@@ -42393,7 +42471,8 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42393
42471
  }
42394
42472
  return;
42395
42473
  }
42396
- this.fromWYSIWYG();
42474
+ // The source plugin carries the fallback editor's text over when this
42475
+ // one is ready; refilling from WYSIWYG here would drop unsynced typing
42397
42476
  tryInitAceEditor();
42398
42477
  };
42399
42478
  editor.e.on('afterSetMode', initAceEditor);
@@ -42778,6 +42857,7 @@ class SourceEditor {
42778
42857
  if (new_value !== this.getMirrorValue()) {
42779
42858
  this.setMirrorValue(new_value);
42780
42859
  }
42860
+ this.__filledValue = this.getMirrorValue();
42781
42861
  this.__lock = false;
42782
42862
  }
42783
42863
  }
@@ -42956,11 +43036,7 @@ class SourceEditor {
42956
43036
  }
42957
43037
  loading = true;
42958
43038
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(()=>{
42959
- // The source view was filled before the
42960
- // beautifier arrived — format it now.
42961
- if (addEventListener()) {
42962
- this.syncValueFromWYSIWYG(true);
42963
- }
43039
+ addEventListener() && this.beautifyUntouched();
42964
43040
  }, ()=>null);
42965
43041
  };
42966
43042
  editor.e.on('afterSetMode.source', loadBeautify);
@@ -42980,10 +43056,8 @@ class SourceEditor {
42980
43056
  if (editor.o.sourceEditor !== 'area') {
42981
43057
  const sourceEditor = (0,_editor_factory__WEBPACK_IMPORTED_MODULE_9__.createSourceEditor)(editor.o.sourceEditor, editor, this.mirrorContainer, this.toWYSIWYG, this.fromWYSIWYG);
42982
43058
  sourceEditor.onReadyAlways(()=>{
42983
- var _this_sourceEditor, _editor_events;
42984
- (_this_sourceEditor = this.sourceEditor) === null || _this_sourceEditor === void 0 ? void 0 : _this_sourceEditor.destruct();
42985
- this.sourceEditor = sourceEditor;
42986
- this.syncValueFromWYSIWYG(true);
43059
+ var _editor_events;
43060
+ this.takeOver(sourceEditor);
42987
43061
  (_editor_events = editor.events) === null || _editor_events === void 0 ? void 0 : _editor_events.fire('sourceEditorReady', editor);
42988
43062
  });
42989
43063
  } else {
@@ -42995,6 +43069,49 @@ class SourceEditor {
42995
43069
  });
42996
43070
  }
42997
43071
  }
43072
+ /**
43073
+ * Replaces the source editor (the textarea shown while ACE loads) with
43074
+ * the one that just became ready, carrying its text, selection and focus
43075
+ * over. Filling the new editor from WYSIWYG instead would drop what was
43076
+ * typed since the last, debounced, sync and normalise half-typed markup.
43077
+ */ takeOver(sourceEditor) {
43078
+ const previous = this.sourceEditor;
43079
+ if (!previous || previous === sourceEditor) {
43080
+ this.sourceEditor = sourceEditor;
43081
+ this.syncValueFromWYSIWYG(true);
43082
+ return;
43083
+ }
43084
+ const value = previous.getValue(), start = previous.getSelectionStart(), end = previous.getSelectionEnd(), focused = previous.isFocused, untouched = value === this.__filledValue;
43085
+ previous.destruct();
43086
+ this.sourceEditor = sourceEditor;
43087
+ if (untouched) {
43088
+ this.syncValueFromWYSIWYG(true);
43089
+ } else {
43090
+ sourceEditor.setValue(value);
43091
+ this.toWYSIWYG();
43092
+ }
43093
+ if (start >= 0) {
43094
+ sourceEditor.setSelectionRange(start, end);
43095
+ }
43096
+ focused && sourceEditor.focus();
43097
+ }
43098
+ /**
43099
+ * The beautifier arrived after the source view was opened: format the
43100
+ * view if nothing has been typed into it, otherwise leave the typing alone
43101
+ */ beautifyUntouched() {
43102
+ const value = this.getMirrorValue();
43103
+ if (this.j.o.editHTMLDocumentMode || !value || value !== this.__filledValue) {
43104
+ return;
43105
+ }
43106
+ const html = this.j.e.fire('beautifyHTML', value);
43107
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) && html !== value) {
43108
+ var _this_sourceEditor, _this_sourceEditor1;
43109
+ const focused = (_this_sourceEditor = this.sourceEditor) === null || _this_sourceEditor === void 0 ? void 0 : _this_sourceEditor.isFocused;
43110
+ this.setMirrorValue(html);
43111
+ this.__filledValue = this.getMirrorValue();
43112
+ focused && ((_this_sourceEditor1 = this.sourceEditor) === null || _this_sourceEditor1 === void 0 ? void 0 : _this_sourceEditor1.focus());
43113
+ }
43114
+ }
42998
43115
  /** @override */ beforeDestruct() {
42999
43116
  if (this.sourceEditor) {
43000
43117
  this.sourceEditor.destruct();
@@ -43008,7 +43125,10 @@ class SourceEditor {
43008
43125
  name: 'source',
43009
43126
  group: 'source'
43010
43127
  }
43011
- ]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "sourceEditor", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "mirrorContainer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__lock", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__oldMirrorValue", ''), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerStart", '{start-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerStartReg", /{start-jodit-selection}/g), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerEnd", '{end-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerEndReg", /{end-jodit-selection}/g), // override it for ace editors
43128
+ ]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "sourceEditor", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "mirrorContainer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__lock", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__oldMirrorValue", ''), /**
43129
+ * What the source view was last filled with from WYSIWYG, read back from
43130
+ * the editor; while the view still holds it, nothing has been typed there
43131
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__filledValue", ''), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerStart", '{start-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerStartReg", /{start-jodit-selection}/g), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerEnd", '{end-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerEndReg", /{end-jodit-selection}/g), // override it for ace editors
43012
43132
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "getSelectionStart", ()=>{
43013
43133
  var _ref;
43014
43134
  var _this_sourceEditor;
@@ -45376,10 +45496,20 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('toolbarNavigati
45376
45496
 
45377
45497
 
45378
45498
 
45499
+ function insertVideos(data) {
45500
+ var _data_files;
45501
+ (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach((file)=>{
45502
+ this.s.insertNode(this.createInside.element('video', {
45503
+ controls: '',
45504
+ src: data.baseurl + file
45505
+ }));
45506
+ });
45507
+ }
45379
45508
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.video = {
45380
45509
  parseUrlToVideoEmbed: jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.convertMediaUrlToVideoEmbed,
45381
45510
  defaultWidth: 400,
45382
- defaultHeight: 345
45511
+ defaultHeight: 345,
45512
+ defaultHandlerSuccess: insertVideos
45383
45513
  };
45384
45514
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('video', (_video_svg__WEBPACK_IMPORTED_MODULE_6___default()));
45385
45515
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
@@ -45416,6 +45546,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
45416
45546
  close();
45417
45547
  };
45418
45548
  jodit.s.save();
45549
+ const { uploader } = jodit.o;
45550
+ // Base64 alone would put whole video files into the content
45551
+ if (uploader.showTabInFileSelector !== false && (uploader.url || uploader.customUploadFunction)) {
45552
+ tabs.push((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_5__.UploadTab)(jodit, (data)=>{
45553
+ var _ref;
45554
+ var _jodit_o_video;
45555
+ jodit.s.restore();
45556
+ ((_ref = (_jodit_o_video = jodit.o.video) === null || _jodit_o_video === void 0 ? void 0 : _jodit_o_video.defaultHandlerSuccess) !== null && _ref !== void 0 ? _ref : insertVideos).call(jodit, data);
45557
+ }, {
45558
+ label: 'Drop file',
45559
+ accept: 'video/*'
45560
+ }));
45561
+ }
45419
45562
  tabs.push({
45420
45563
  icon: 'link',
45421
45564
  name: 'Link',