jodit 4.16.1 → 4.17.1

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 (71) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +7 -7
  4. package/es2015/jodit.js +173 -34
  5. package/es2015/jodit.min.js +7 -7
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +7 -7
  13. package/es2018/jodit.min.js +7 -7
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +8 -8
  18. package/es2021/jodit.js +165 -33
  19. package/es2021/jodit.min.js +8 -8
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +8 -8
  28. package/es2021.en/jodit.js +165 -33
  29. package/es2021.en/jodit.min.js +8 -8
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +182 -34
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/config.d.ts +40 -1
  51. package/esm/core/constants.js +1 -1
  52. package/esm/core/helpers/html/safe-html.d.ts +1 -1
  53. package/esm/core/helpers/html/safe-html.js +8 -1
  54. package/esm/modules/widget/file-selector/file-selector.d.ts +10 -1
  55. package/esm/modules/widget/file-selector/file-selector.js +30 -18
  56. package/esm/plugins/drag-and-drop/drag-and-drop.js +16 -4
  57. package/esm/plugins/file/file.d.ts +24 -1
  58. package/esm/plugins/file/file.js +17 -1
  59. package/esm/plugins/inline-popup/config/items/img.js +22 -1
  60. package/esm/plugins/source/editor/engines/ace.js +2 -1
  61. package/esm/plugins/source/source.d.ts +17 -0
  62. package/esm/plugins/source/source.js +60 -8
  63. package/esm/plugins/video/config.d.ts +21 -1
  64. package/esm/plugins/video/config.js +22 -2
  65. package/package.json +1 -1
  66. package/types/config.d.ts +40 -1
  67. package/types/core/helpers/html/safe-html.d.ts +1 -1
  68. package/types/modules/widget/file-selector/file-selector.d.ts +10 -1
  69. package/types/plugins/file/file.d.ts +24 -1
  70. package/types/plugins/source/source.d.ts +17 -0
  71. 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.1
4
+ * Version: v4.17.1
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.1";
2132
+ var APP_VERSION = "4.17.1";
2133
2133
  // prettier-ignore
2134
2134
  var ES = "es5";
2135
2135
  var IS_ES_MODERN = false;
@@ -7266,11 +7266,18 @@ function sanitizeHTMLElement(elm) {
7266
7266
  var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
7267
7267
  safeJavaScriptLink: true,
7268
7268
  removeOnError: true
7269
- }, safeJavaScriptLink = _ref.safeJavaScriptLink, removeOnError = _ref.removeOnError;
7269
+ }, safeJavaScriptLink = _ref.safeJavaScriptLink, removeOnError = _ref.removeOnError, removeEventAttributes = _ref.removeEventAttributes;
7270
7270
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(elm)) {
7271
7271
  return false;
7272
7272
  }
7273
7273
  var effected = false;
7274
+ // Every `on*` handler, not only `onerror`: the clean-html background
7275
+ // pass calls this directly, and markup that reached the editable area
7276
+ // without `safeHTML` (a drop, a script) kept its handlers otherwise.
7277
+ // See GHSA-jhhp-r3r7-v2cg
7278
+ if (removeEventAttributes && removeAllEventAttributes(elm)) {
7279
+ effected = true;
7280
+ }
7274
7281
  if (removeOnError && elm.hasAttribute('onerror')) {
7275
7282
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'onerror', null);
7276
7283
  effected = true;
@@ -31712,7 +31719,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
31712
31719
 
31713
31720
  "use strict";
31714
31721
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31715
- /* harmony export */ FileSelectorWidget: function() { return /* binding */ FileSelectorWidget; }
31722
+ /* harmony export */ FileSelectorWidget: function() { return /* binding */ FileSelectorWidget; },
31723
+ /* harmony export */ UploadTab: function() { return /* binding */ UploadTab; }
31716
31724
  /* harmony export */ });
31717
31725
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
31718
31726
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
@@ -31744,22 +31752,19 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
31744
31752
  var tabs = [];
31745
31753
  var options = editor.o.uploader;
31746
31754
  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;
31755
+ var upload = callbacks.upload;
31756
+ tabs.push(UploadTab(editor, function(resp) {
31757
+ var handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(upload) ? upload : options.defaultHandlerSuccess;
31750
31758
  if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handler)) {
31751
31759
  handler.call(editor, resp);
31752
31760
  }
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
- });
31761
+ }, isImage ? {
31762
+ label: 'Drop image',
31763
+ accept: 'image/*'
31764
+ } : {
31765
+ label: 'Drop file',
31766
+ accept: '*'
31767
+ }));
31763
31768
  }
31764
31769
  if (callbacks.filebrowser) {
31765
31770
  if (editor.o.filebrowser.ajax.url || editor.o.filebrowser.items.url) {
@@ -31827,6 +31832,25 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
31827
31832
  box.classList.add('jodit-file-selector');
31828
31833
  return box;
31829
31834
  };
31835
+ /**
31836
+ * The Upload tab: a box that uploads the files dropped on it or chosen in its
31837
+ * file input, then passes the uploader's answer to `onSuccess` and closes the popup
31838
+ */ var UploadTab = function UploadTab(editor, onSuccess, param) {
31839
+ var label = param.label, accept = param.accept;
31840
+ 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>');
31841
+ editor.uploader.bind(dragBox, function(resp) {
31842
+ onSuccess.call(editor, resp);
31843
+ editor.e.fire('closeAllPopups');
31844
+ }, function(error) {
31845
+ editor.message.error(error.message);
31846
+ editor.e.fire('closeAllPopups');
31847
+ });
31848
+ return {
31849
+ icon: 'upload',
31850
+ name: 'Upload',
31851
+ content: dragBox
31852
+ };
31853
+ };
31830
31854
  function val(elm, name, value) {
31831
31855
  var child = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.first(elm, function(node) {
31832
31856
  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 +31874,8 @@ function val(elm, name, value) {
31850
31874
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31851
31875
  /* harmony export */ ColorPickerWidget: function() { return /* reexport safe */ _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__.ColorPickerWidget; },
31852
31876
  /* 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; }
31877
+ /* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; },
31878
+ /* harmony export */ UploadTab: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.UploadTab; }
31854
31879
  /* harmony export */ });
31855
31880
  /* harmony import */ var _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72348);
31856
31881
  /* harmony import */ var _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18762);
@@ -37106,7 +37131,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('dragAndDropElem
37106
37131
  window,
37107
37132
  this.j.ed,
37108
37133
  this.j.editor
37109
- ], 'dragstart.DragAndDrop', this.onDragStart);
37134
+ ], 'dragstart.DragAndDrop', this.onDragStart)// Always, not only after a `dragstart` seen in this window: a drop
37135
+ // from another window or application never produces one here, and
37136
+ // the browser then inserted its HTML natively, unsanitized. Routed
37137
+ // through the paste plugin instead. See GHSA-jhhp-r3r7-v2cg
37138
+ .on('drop.DragAndDrop', this.onDrop);
37110
37139
  }
37111
37140
  },
37112
37141
  {
@@ -37142,13 +37171,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('dragAndDropElem
37142
37171
  {
37143
37172
  key: "addDragListeners",
37144
37173
  value: function addDragListeners() {
37145
- this.j.e.on('dragover', this.onDrag).on('drop.DragAndDrop', this.onDrop).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
37174
+ this.j.e.on('dragover', this.onDrag).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
37146
37175
  }
37147
37176
  },
37148
37177
  {
37149
37178
  key: "removeDragListeners",
37150
37179
  value: function removeDragListeners() {
37151
- this.j.e.off('dragover', this.onDrag).off('drop.DragAndDrop', this.onDrop).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
37180
+ this.j.e.off('dragover', this.onDrag).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
37152
37181
  }
37153
37182
  },
37154
37183
  {
@@ -37222,7 +37251,12 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('dragAndDropElem
37222
37251
  fragment = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_12__.dataBind)(this.draggable, 'target');
37223
37252
  }
37224
37253
  } else if (this.getText(event)) {
37225
- fragment = this.j.createInside.fromHTML(this.getText(event));
37254
+ // Dropped markup takes the same sanitizing pass as pasted and
37255
+ // assigned content. See GHSA-jhhp-r3r7-v2cg
37256
+ var box = this.j.createInside.div();
37257
+ box.innerHTML = this.getText(event);
37258
+ this.j.e.fire('safeHTML', box);
37259
+ fragment = box.firstChild !== box.lastChild || !box.firstChild ? box : box.firstChild;
37226
37260
  }
37227
37261
  return fragment;
37228
37262
  }
@@ -38179,6 +38213,20 @@ function brBefore(start) {
38179
38213
 
38180
38214
 
38181
38215
 
38216
+ function insertLinks(data) {
38217
+ var _this = this;
38218
+ var _data_files;
38219
+ (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach(function(file) {
38220
+ var link = _this.createInside.element('a', {
38221
+ href: data.baseurl + file
38222
+ });
38223
+ link.textContent = _this.o.uploader.getDisplayName.call(_this.uploader, data.baseurl, file);
38224
+ _this.s.insertNode(link);
38225
+ });
38226
+ }
38227
+ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
38228
+ defaultHandlerSuccess: insertLinks
38229
+ };
38182
38230
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
38183
38231
  popup: function popup(editor, current, close) {
38184
38232
  var insert = function insert(url) {
@@ -38196,7 +38244,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
38196
38244
  });
38197
38245
  close();
38198
38246
  },
38199
- upload: true,
38247
+ upload: function upload(data) {
38248
+ var _ref;
38249
+ var _editor_o_file;
38250
+ ((_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);
38251
+ },
38200
38252
  url: function url(url, text) {
38201
38253
  if (sourceAnchor) {
38202
38254
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(sourceAnchor, 'href', url);
@@ -42226,6 +42278,26 @@ var cmd = function cmd(control) {
42226
42278
  var alignClasses = function alignClasses(editor, elm) {
42227
42279
  return jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
42228
42280
  };
42281
+ // A Normal image sits where the text of its line is aligned (#1531)
42282
+ var lineAlign = function lineAlign(editor, elm) {
42283
+ 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;
42284
+ var rtl = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_4__.css)(block, 'direction') === 'rtl';
42285
+ switch((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_4__.css)(block, 'text-align')){
42286
+ case 'center':
42287
+ case '-webkit-center':
42288
+ return 'center';
42289
+ case 'justify':
42290
+ return 'justify';
42291
+ case 'right':
42292
+ return 'right';
42293
+ case 'end':
42294
+ return rtl ? 'left' : 'right';
42295
+ case 'start':
42296
+ return rtl ? 'right' : 'left';
42297
+ default:
42298
+ return 'left';
42299
+ }
42300
+ };
42229
42301
  var currentAlign = function currentAlign(editor, elm) {
42230
42302
  return elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_3__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
42231
42303
  };
@@ -42242,7 +42314,7 @@ var align = {
42242
42314
  ],
42243
42315
  update: function update(editor, button) {
42244
42316
  var current = currentAlign(editor, button.target);
42245
- button.state.icon.name = current === 'normal' ? 'left' : current;
42317
+ button.state.icon.name = current === 'normal' ? lineAlign(editor, button.target) : current;
42246
42318
  },
42247
42319
  isActive: function isActive(editor, button) {
42248
42320
  return currentAlign(editor, button.target) !== 'normal';
@@ -50221,7 +50293,8 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50221
50293
  }
50222
50294
  return;
50223
50295
  }
50224
- _this.fromWYSIWYG();
50296
+ // The source plugin carries the fallback editor's text over when this
50297
+ // one is ready; refilling from WYSIWYG here would drop unsynced typing
50225
50298
  tryInitAceEditor();
50226
50299
  };
50227
50300
  editor.e.on('afterSetMode', initAceEditor);
@@ -50725,7 +50798,10 @@ var SourceEditor = /*#__PURE__*/ function() {
50725
50798
  name: 'source',
50726
50799
  group: 'source'
50727
50800
  }
50728
- ]), (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
50801
+ ]), (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", ''), /**
50802
+ * What the source view was last filled with from WYSIWYG, read back from
50803
+ * the editor; while the view still holds it, nothing has been typed there
50804
+ */ (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
50729
50805
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "getSelectionStart", function() {
50730
50806
  var _ref;
50731
50807
  var _this_sourceEditor;
@@ -50761,6 +50837,7 @@ var SourceEditor = /*#__PURE__*/ function() {
50761
50837
  if (new_value !== this.getMirrorValue()) {
50762
50838
  this.setMirrorValue(new_value);
50763
50839
  }
50840
+ this.__filledValue = this.getMirrorValue();
50764
50841
  this.__lock = false;
50765
50842
  }
50766
50843
  }
@@ -50979,9 +51056,9 @@ var SourceEditor = /*#__PURE__*/ function() {
50979
51056
  return;
50980
51057
  }
50981
51058
  loading = true;
50982
- // It formats the source view from the next time it opens:
50983
- // filling it again now would replace what was typed there
50984
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(addEventListener, function() {
51059
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(function() {
51060
+ addEventListener() && _this.beautifyUntouched();
51061
+ }, function() {
50985
51062
  return null;
50986
51063
  });
50987
51064
  };
@@ -51010,10 +51087,8 @@ var SourceEditor = /*#__PURE__*/ function() {
51010
51087
  if (editor.o.sourceEditor !== 'area') {
51011
51088
  var sourceEditor = (0,_editor_factory__WEBPACK_IMPORTED_MODULE_14__.createSourceEditor)(editor.o.sourceEditor, editor, this.mirrorContainer, this.toWYSIWYG, this.fromWYSIWYG);
51012
51089
  sourceEditor.onReadyAlways(function() {
51013
- var _this_sourceEditor, _editor_events;
51014
- (_this_sourceEditor = _this.sourceEditor) === null || _this_sourceEditor === void 0 ? void 0 : _this_sourceEditor.destruct();
51015
- _this.sourceEditor = sourceEditor;
51016
- _this.syncValueFromWYSIWYG(true);
51090
+ var _editor_events;
51091
+ _this.takeOver(sourceEditor);
51017
51092
  (_editor_events = editor.events) === null || _editor_events === void 0 ? void 0 : _editor_events.fire('sourceEditorReady', editor);
51018
51093
  });
51019
51094
  } else {
@@ -51026,6 +51101,55 @@ var SourceEditor = /*#__PURE__*/ function() {
51026
51101
  }
51027
51102
  }
51028
51103
  },
51104
+ {
51105
+ key: "takeOver",
51106
+ value: /**
51107
+ * Replaces the source editor (the textarea shown while ACE loads) with
51108
+ * the one that just became ready, carrying its text, selection and focus
51109
+ * over. Filling the new editor from WYSIWYG instead would drop what was
51110
+ * typed since the last, debounced, sync and normalise half-typed markup.
51111
+ */ function takeOver(sourceEditor) {
51112
+ var previous = this.sourceEditor;
51113
+ if (!previous || previous === sourceEditor) {
51114
+ this.sourceEditor = sourceEditor;
51115
+ this.syncValueFromWYSIWYG(true);
51116
+ return;
51117
+ }
51118
+ var value = previous.getValue(), start = previous.getSelectionStart(), end = previous.getSelectionEnd(), focused = previous.isFocused, untouched = value === this.__filledValue;
51119
+ previous.destruct();
51120
+ this.sourceEditor = sourceEditor;
51121
+ if (untouched) {
51122
+ this.syncValueFromWYSIWYG(true);
51123
+ } else {
51124
+ sourceEditor.setValue(value);
51125
+ this.toWYSIWYG();
51126
+ }
51127
+ if (start >= 0) {
51128
+ sourceEditor.setSelectionRange(start, end);
51129
+ }
51130
+ focused && sourceEditor.focus();
51131
+ }
51132
+ },
51133
+ {
51134
+ key: "beautifyUntouched",
51135
+ value: /**
51136
+ * The beautifier arrived after the source view was opened: format the
51137
+ * view if nothing has been typed into it, otherwise leave the typing alone
51138
+ */ function beautifyUntouched() {
51139
+ var value = this.getMirrorValue();
51140
+ if (this.j.o.editHTMLDocumentMode || !value || value !== this.__filledValue) {
51141
+ return;
51142
+ }
51143
+ var html = this.j.e.fire('beautifyHTML', value);
51144
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.isString)(html) && html !== value) {
51145
+ var _this_sourceEditor, _this_sourceEditor1;
51146
+ var focused = (_this_sourceEditor = this.sourceEditor) === null || _this_sourceEditor === void 0 ? void 0 : _this_sourceEditor.isFocused;
51147
+ this.setMirrorValue(html);
51148
+ this.__filledValue = this.getMirrorValue();
51149
+ focused && ((_this_sourceEditor1 = this.sourceEditor) === null || _this_sourceEditor1 === void 0 ? void 0 : _this_sourceEditor1.focus());
51150
+ }
51151
+ }
51152
+ },
51029
51153
  {
51030
51154
  /** @override */ key: "beforeDestruct",
51031
51155
  value: function beforeDestruct() {
@@ -53601,10 +53725,21 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_11__.pluginSystem.add('toolbarNavigat
53601
53725
 
53602
53726
 
53603
53727
 
53728
+ function insertVideos(data) {
53729
+ var _this = this;
53730
+ var _data_files;
53731
+ (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach(function(file) {
53732
+ _this.s.insertNode(_this.createInside.element('video', {
53733
+ controls: '',
53734
+ src: data.baseurl + file
53735
+ }));
53736
+ });
53737
+ }
53604
53738
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.video = {
53605
53739
  parseUrlToVideoEmbed: jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.convertMediaUrlToVideoEmbed,
53606
53740
  defaultWidth: 400,
53607
- defaultHeight: 345
53741
+ defaultHeight: 345,
53742
+ defaultHandlerSuccess: insertVideos
53608
53743
  };
53609
53744
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('video', (_video_svg__WEBPACK_IMPORTED_MODULE_6___default()));
53610
53745
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
@@ -53645,6 +53780,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
53645
53780
  close();
53646
53781
  };
53647
53782
  jodit.s.save();
53783
+ var uploader = jodit.o.uploader;
53784
+ // Base64 alone would put whole video files into the content
53785
+ if (uploader.showTabInFileSelector !== false && (uploader.url || uploader.customUploadFunction)) {
53786
+ tabs.push((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_5__.UploadTab)(jodit, function(data) {
53787
+ var _ref;
53788
+ var _jodit_o_video;
53789
+ jodit.s.restore();
53790
+ ((_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);
53791
+ }, {
53792
+ label: 'Drop file',
53793
+ accept: 'video/*'
53794
+ }));
53795
+ }
53648
53796
  tabs.push({
53649
53797
  icon: 'link',
53650
53798
  name: 'Link',
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.16.1
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.16.1
11
+ * Version: v4.17.1
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */