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/es5/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
  */
@@ -2129,7 +2129,7 @@ __webpack_require__.r(__webpack_exports__);
2129
2129
  * @packageDocumentation
2130
2130
  * @module constants
2131
2131
  */
2132
- var APP_VERSION = "4.16.0";
2132
+ var APP_VERSION = "4.17.0";
2133
2133
  // prettier-ignore
2134
2134
  var ES = "es5";
2135
2135
  var IS_ES_MODERN = false;
@@ -31712,7 +31712,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
31712
31712
 
31713
31713
  "use strict";
31714
31714
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31715
- /* harmony export */ FileSelectorWidget: function() { return /* binding */ FileSelectorWidget; }
31715
+ /* harmony export */ FileSelectorWidget: function() { return /* binding */ FileSelectorWidget; },
31716
+ /* harmony export */ UploadTab: function() { return /* binding */ UploadTab; }
31716
31717
  /* harmony export */ });
31717
31718
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
31718
31719
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
@@ -31744,22 +31745,19 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
31744
31745
  var tabs = [];
31745
31746
  var options = editor.o.uploader;
31746
31747
  if (callbacks.upload && options.showTabInFileSelector !== false && (options.url || options.insertImageAsBase64URI || options.customUploadFunction)) {
31747
- var dragBox = editor.c.fromHTML('<div class="jodit-drag-and-drop__file-box">' + "<strong>".concat(editor.i18n(isImage ? 'Drop image' : 'Drop file'), "</strong>") + "<span><br>".concat(editor.i18n('or click'), "</span>") + '<input type="file" accept="'.concat(isImage ? 'image/*' : '*', '" tabindex="-1" dir="auto" multiple=""/>') + '</div>');
31748
- editor.uploader.bind(dragBox, function(resp) {
31749
- var handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(callbacks.upload) ? callbacks.upload : options.defaultHandlerSuccess;
31748
+ var upload = callbacks.upload;
31749
+ tabs.push(UploadTab(editor, function(resp) {
31750
+ var handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(upload) ? upload : options.defaultHandlerSuccess;
31750
31751
  if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handler)) {
31751
31752
  handler.call(editor, resp);
31752
31753
  }
31753
- editor.e.fire('closeAllPopups');
31754
- }, function(error) {
31755
- editor.message.error(error.message);
31756
- editor.e.fire('closeAllPopups');
31757
- });
31758
- tabs.push({
31759
- icon: 'upload',
31760
- name: 'Upload',
31761
- content: dragBox
31762
- });
31754
+ }, isImage ? {
31755
+ label: 'Drop image',
31756
+ accept: 'image/*'
31757
+ } : {
31758
+ label: 'Drop file',
31759
+ accept: '*'
31760
+ }));
31763
31761
  }
31764
31762
  if (callbacks.filebrowser) {
31765
31763
  if (editor.o.filebrowser.ajax.url || editor.o.filebrowser.items.url) {
@@ -31827,6 +31825,25 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
31827
31825
  box.classList.add('jodit-file-selector');
31828
31826
  return box;
31829
31827
  };
31828
+ /**
31829
+ * The Upload tab: a box that uploads the files dropped on it or chosen in its
31830
+ * file input, then passes the uploader's answer to `onSuccess` and closes the popup
31831
+ */ var UploadTab = function UploadTab(editor, onSuccess, param) {
31832
+ var label = param.label, accept = param.accept;
31833
+ var dragBox = editor.c.fromHTML('<div class="jodit-drag-and-drop__file-box">' + "<strong>".concat(editor.i18n(label), "</strong>") + "<span><br>".concat(editor.i18n('or click'), "</span>") + '<input type="file" accept="'.concat(accept, '" tabindex="-1" dir="auto" multiple=""/>') + '</div>');
31834
+ editor.uploader.bind(dragBox, function(resp) {
31835
+ onSuccess.call(editor, resp);
31836
+ editor.e.fire('closeAllPopups');
31837
+ }, function(error) {
31838
+ editor.message.error(error.message);
31839
+ editor.e.fire('closeAllPopups');
31840
+ });
31841
+ return {
31842
+ icon: 'upload',
31843
+ name: 'Upload',
31844
+ content: dragBox
31845
+ };
31846
+ };
31830
31847
  function val(elm, name, value) {
31831
31848
  var child = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.first(elm, function(node) {
31832
31849
  return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(node, 'input') && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(node, 'name') === name;
@@ -31850,7 +31867,8 @@ function val(elm, name, value) {
31850
31867
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31851
31868
  /* harmony export */ ColorPickerWidget: function() { return /* reexport safe */ _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__.ColorPickerWidget; },
31852
31869
  /* harmony export */ FileSelectorWidget: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.FileSelectorWidget; },
31853
- /* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; }
31870
+ /* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; },
31871
+ /* harmony export */ UploadTab: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.UploadTab; }
31854
31872
  /* harmony export */ });
31855
31873
  /* harmony import */ var _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72348);
31856
31874
  /* harmony import */ var _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18762);
@@ -38179,6 +38197,20 @@ function brBefore(start) {
38179
38197
 
38180
38198
 
38181
38199
 
38200
+ function insertLinks(data) {
38201
+ var _this = this;
38202
+ var _data_files;
38203
+ (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach(function(file) {
38204
+ var link = _this.createInside.element('a', {
38205
+ href: data.baseurl + file
38206
+ });
38207
+ link.textContent = _this.o.uploader.getDisplayName.call(_this.uploader, data.baseurl, file);
38208
+ _this.s.insertNode(link);
38209
+ });
38210
+ }
38211
+ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
38212
+ defaultHandlerSuccess: insertLinks
38213
+ };
38182
38214
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
38183
38215
  popup: function popup(editor, current, close) {
38184
38216
  var insert = function insert(url) {
@@ -38196,7 +38228,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
38196
38228
  });
38197
38229
  close();
38198
38230
  },
38199
- upload: true,
38231
+ upload: function upload(data) {
38232
+ var _ref;
38233
+ var _editor_o_file;
38234
+ ((_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);
38235
+ },
38200
38236
  url: function url(url, text) {
38201
38237
  if (sourceAnchor) {
38202
38238
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(sourceAnchor, 'href', url);
@@ -39131,7 +39167,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeBaseUrl = '';
39131
39167
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeTitle = 'Jodit Editor';
39132
39168
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDoctype = '<!DOCTYPE html>';
39133
39169
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDefaultSrc = 'about:blank';
39134
- 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' + '}';
39170
+ 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' + '}';
39135
39171
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeCSSLinks = [];
39136
39172
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeSandbox = null;
39137
39173
 
@@ -39394,8 +39430,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
39394
39430
 
39395
39431
 
39396
39432
 
39433
+
39397
39434
  var JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
39398
39435
  var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39436
+ var IMAGE_SELECTED = 'jodit-wysiwyg_image-selected';
39399
39437
  /**
39400
39438
  * Change editor's size after load all images
39401
39439
  */ var imageProcessor = /*#__PURE__*/ function(Plugin) {
@@ -39408,11 +39446,15 @@ var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39408
39446
  ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_3__._)(imageProcessor, [
39409
39447
  {
39410
39448
  key: "afterInit",
39411
- value: function afterInit(jodit) {}
39449
+ value: function afterInit(jodit) {
39450
+ jodit.e.on(jodit.ed, 'selectionchange', this.onSelectionChange);
39451
+ }
39412
39452
  },
39413
39453
  {
39414
39454
  key: "beforeDestruct",
39415
39455
  value: function beforeDestruct(jodit) {
39456
+ jodit.e.off(jodit.ed, 'selectionchange', this.onSelectionChange);
39457
+ jodit.editor.classList.remove(IMAGE_SELECTED);
39416
39458
  var buffer = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.cached)(jodit, 'buffer');
39417
39459
  var list = buffer === null || buffer === void 0 ? void 0 : buffer.get(JODIT_IMAGE_BLOB_ID);
39418
39460
  if (buffer && list) {
@@ -39484,6 +39526,16 @@ var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39484
39526
  }
39485
39527
  }
39486
39528
  },
39529
+ {
39530
+ key: "onSelectionChange",
39531
+ value: /**
39532
+ * While the selection is an image, only the image is highlighted: Safari
39533
+ * paints the rest of a block image's line with its parent's highlight. See #1528
39534
+ */ function onSelectionChange() {
39535
+ var jodit = this.jodit;
39536
+ jodit.editor.classList.toggle(IMAGE_SELECTED, isImageSelected(jodit));
39537
+ }
39538
+ },
39487
39539
  {
39488
39540
  key: "afterChange",
39489
39541
  value: function afterChange(data) {
@@ -39531,6 +39583,9 @@ var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39531
39583
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
39532
39584
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)(':beforeSetElementValue')
39533
39585
  ], imageProcessor.prototype, "onBeforeSetElementValue", null);
39586
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
39587
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.autobind
39588
+ ], imageProcessor.prototype, "onSelectionChange", null);
39534
39589
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
39535
39590
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)([
39536
39591
  ':change',
@@ -39539,6 +39594,14 @@ var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39539
39594
  ]),
39540
39595
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.debounce)()
39541
39596
  ], imageProcessor.prototype, "afterChange", null);
39597
+ function isImageSelected(jodit) {
39598
+ var sel = jodit.s.sel;
39599
+ if (!sel || !sel.rangeCount) {
39600
+ return false;
39601
+ }
39602
+ var _sel_getRangeAt = sel.getRangeAt(0), startContainer = _sel_getRangeAt.startContainer, startOffset = _sel_getRangeAt.startOffset, endContainer = _sel_getRangeAt.endContainer, endOffset = _sel_getRangeAt.endOffset;
39603
+ return startContainer === endContainer && endOffset === startOffset + 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isTag(startContainer.childNodes[startOffset], 'img') && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isOrContains(jodit.editor, startContainer);
39604
+ }
39542
39605
  /**
39543
39606
  * Remove the invisible-space text beside an image, which only held a caret.
39544
39607
  * Selecting the image replaces the caret, and with the text still after a
@@ -42199,6 +42262,26 @@ var cmd = function cmd(control) {
42199
42262
  var alignClasses = function alignClasses(editor, elm) {
42200
42263
  return jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
42201
42264
  };
42265
+ // A Normal image sits where the text of its line is aligned (#1531)
42266
+ var lineAlign = function lineAlign(editor, elm) {
42267
+ var block = elm && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(elm, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, editor.editor) || editor.editor;
42268
+ var rtl = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_4__.css)(block, 'direction') === 'rtl';
42269
+ switch((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_4__.css)(block, 'text-align')){
42270
+ case 'center':
42271
+ case '-webkit-center':
42272
+ return 'center';
42273
+ case 'justify':
42274
+ return 'justify';
42275
+ case 'right':
42276
+ return 'right';
42277
+ case 'end':
42278
+ return rtl ? 'left' : 'right';
42279
+ case 'start':
42280
+ return rtl ? 'right' : 'left';
42281
+ default:
42282
+ return 'left';
42283
+ }
42284
+ };
42202
42285
  var currentAlign = function currentAlign(editor, elm) {
42203
42286
  return elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_3__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
42204
42287
  };
@@ -42215,7 +42298,7 @@ var align = {
42215
42298
  ],
42216
42299
  update: function update(editor, button) {
42217
42300
  var current = currentAlign(editor, button.target);
42218
- button.state.icon.name = current === 'normal' ? 'left' : current;
42301
+ button.state.icon.name = current === 'normal' ? lineAlign(editor, button.target) : current;
42219
42302
  },
42220
42303
  isActive: function isActive(editor, button) {
42221
42304
  return currentAlign(editor, button.target) !== 'normal';
@@ -50194,7 +50277,8 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50194
50277
  }
50195
50278
  return;
50196
50279
  }
50197
- _this.fromWYSIWYG();
50280
+ // The source plugin carries the fallback editor's text over when this
50281
+ // one is ready; refilling from WYSIWYG here would drop unsynced typing
50198
50282
  tryInitAceEditor();
50199
50283
  };
50200
50284
  editor.e.on('afterSetMode', initAceEditor);
@@ -50698,7 +50782,10 @@ var SourceEditor = /*#__PURE__*/ function() {
50698
50782
  name: 'source',
50699
50783
  group: 'source'
50700
50784
  }
50701
- ]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "sourceEditor", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "mirrorContainer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__lock", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__oldMirrorValue", ''), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "tempMarkerStart", '{start-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "tempMarkerStartReg", /{start-jodit-selection}/g), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "tempMarkerEnd", '{end-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "tempMarkerEndReg", /{end-jodit-selection}/g), // override it for ace editors
50785
+ ]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "sourceEditor", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "mirrorContainer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__lock", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__oldMirrorValue", ''), /**
50786
+ * What the source view was last filled with from WYSIWYG, read back from
50787
+ * the editor; while the view still holds it, nothing has been typed there
50788
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__filledValue", ''), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "tempMarkerStart", '{start-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "tempMarkerStartReg", /{start-jodit-selection}/g), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "tempMarkerEnd", '{end-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "tempMarkerEndReg", /{end-jodit-selection}/g), // override it for ace editors
50702
50789
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "getSelectionStart", function() {
50703
50790
  var _ref;
50704
50791
  var _this_sourceEditor;
@@ -50734,6 +50821,7 @@ var SourceEditor = /*#__PURE__*/ function() {
50734
50821
  if (new_value !== this.getMirrorValue()) {
50735
50822
  this.setMirrorValue(new_value);
50736
50823
  }
50824
+ this.__filledValue = this.getMirrorValue();
50737
50825
  this.__lock = false;
50738
50826
  }
50739
50827
  }
@@ -50953,11 +51041,7 @@ var SourceEditor = /*#__PURE__*/ function() {
50953
51041
  }
50954
51042
  loading = true;
50955
51043
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(function() {
50956
- // The source view was filled before the
50957
- // beautifier arrived — format it now.
50958
- if (addEventListener()) {
50959
- _this.syncValueFromWYSIWYG(true);
50960
- }
51044
+ addEventListener() && _this.beautifyUntouched();
50961
51045
  }, function() {
50962
51046
  return null;
50963
51047
  });
@@ -50987,10 +51071,8 @@ var SourceEditor = /*#__PURE__*/ function() {
50987
51071
  if (editor.o.sourceEditor !== 'area') {
50988
51072
  var sourceEditor = (0,_editor_factory__WEBPACK_IMPORTED_MODULE_14__.createSourceEditor)(editor.o.sourceEditor, editor, this.mirrorContainer, this.toWYSIWYG, this.fromWYSIWYG);
50989
51073
  sourceEditor.onReadyAlways(function() {
50990
- var _this_sourceEditor, _editor_events;
50991
- (_this_sourceEditor = _this.sourceEditor) === null || _this_sourceEditor === void 0 ? void 0 : _this_sourceEditor.destruct();
50992
- _this.sourceEditor = sourceEditor;
50993
- _this.syncValueFromWYSIWYG(true);
51074
+ var _editor_events;
51075
+ _this.takeOver(sourceEditor);
50994
51076
  (_editor_events = editor.events) === null || _editor_events === void 0 ? void 0 : _editor_events.fire('sourceEditorReady', editor);
50995
51077
  });
50996
51078
  } else {
@@ -51003,6 +51085,55 @@ var SourceEditor = /*#__PURE__*/ function() {
51003
51085
  }
51004
51086
  }
51005
51087
  },
51088
+ {
51089
+ key: "takeOver",
51090
+ value: /**
51091
+ * Replaces the source editor (the textarea shown while ACE loads) with
51092
+ * the one that just became ready, carrying its text, selection and focus
51093
+ * over. Filling the new editor from WYSIWYG instead would drop what was
51094
+ * typed since the last, debounced, sync and normalise half-typed markup.
51095
+ */ function takeOver(sourceEditor) {
51096
+ var previous = this.sourceEditor;
51097
+ if (!previous || previous === sourceEditor) {
51098
+ this.sourceEditor = sourceEditor;
51099
+ this.syncValueFromWYSIWYG(true);
51100
+ return;
51101
+ }
51102
+ var value = previous.getValue(), start = previous.getSelectionStart(), end = previous.getSelectionEnd(), focused = previous.isFocused, untouched = value === this.__filledValue;
51103
+ previous.destruct();
51104
+ this.sourceEditor = sourceEditor;
51105
+ if (untouched) {
51106
+ this.syncValueFromWYSIWYG(true);
51107
+ } else {
51108
+ sourceEditor.setValue(value);
51109
+ this.toWYSIWYG();
51110
+ }
51111
+ if (start >= 0) {
51112
+ sourceEditor.setSelectionRange(start, end);
51113
+ }
51114
+ focused && sourceEditor.focus();
51115
+ }
51116
+ },
51117
+ {
51118
+ key: "beautifyUntouched",
51119
+ value: /**
51120
+ * The beautifier arrived after the source view was opened: format the
51121
+ * view if nothing has been typed into it, otherwise leave the typing alone
51122
+ */ function beautifyUntouched() {
51123
+ var value = this.getMirrorValue();
51124
+ if (this.j.o.editHTMLDocumentMode || !value || value !== this.__filledValue) {
51125
+ return;
51126
+ }
51127
+ var html = this.j.e.fire('beautifyHTML', value);
51128
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.isString)(html) && html !== value) {
51129
+ var _this_sourceEditor, _this_sourceEditor1;
51130
+ var focused = (_this_sourceEditor = this.sourceEditor) === null || _this_sourceEditor === void 0 ? void 0 : _this_sourceEditor.isFocused;
51131
+ this.setMirrorValue(html);
51132
+ this.__filledValue = this.getMirrorValue();
51133
+ focused && ((_this_sourceEditor1 = this.sourceEditor) === null || _this_sourceEditor1 === void 0 ? void 0 : _this_sourceEditor1.focus());
51134
+ }
51135
+ }
51136
+ },
51006
51137
  {
51007
51138
  /** @override */ key: "beforeDestruct",
51008
51139
  value: function beforeDestruct() {
@@ -53578,10 +53709,21 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_11__.pluginSystem.add('toolbarNavigat
53578
53709
 
53579
53710
 
53580
53711
 
53712
+ function insertVideos(data) {
53713
+ var _this = this;
53714
+ var _data_files;
53715
+ (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach(function(file) {
53716
+ _this.s.insertNode(_this.createInside.element('video', {
53717
+ controls: '',
53718
+ src: data.baseurl + file
53719
+ }));
53720
+ });
53721
+ }
53581
53722
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.video = {
53582
53723
  parseUrlToVideoEmbed: jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.convertMediaUrlToVideoEmbed,
53583
53724
  defaultWidth: 400,
53584
- defaultHeight: 345
53725
+ defaultHeight: 345,
53726
+ defaultHandlerSuccess: insertVideos
53585
53727
  };
53586
53728
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('video', (_video_svg__WEBPACK_IMPORTED_MODULE_6___default()));
53587
53729
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
@@ -53622,6 +53764,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
53622
53764
  close();
53623
53765
  };
53624
53766
  jodit.s.save();
53767
+ var uploader = jodit.o.uploader;
53768
+ // Base64 alone would put whole video files into the content
53769
+ if (uploader.showTabInFileSelector !== false && (uploader.url || uploader.customUploadFunction)) {
53770
+ tabs.push((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_5__.UploadTab)(jodit, function(data) {
53771
+ var _ref;
53772
+ var _jodit_o_video;
53773
+ jodit.s.restore();
53774
+ ((_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);
53775
+ }, {
53776
+ label: 'Drop file',
53777
+ accept: 'video/*'
53778
+ }));
53779
+ }
53625
53780
  tabs.push({
53626
53781
  icon: 'link',
53627
53782
  name: 'Link',