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/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.1
4
+ * Version: v4.17.1
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.1";
1808
+ */ const APP_VERSION = "4.17.1";
1809
1809
  // prettier-ignore
1810
1810
  const ES = "es2015";
1811
1811
  const IS_ES_MODERN = true;
@@ -6306,7 +6306,7 @@ function isSmuggledForeignHtml(elm) {
6306
6306
  }
6307
6307
  return /^data:image\/svg/.test(normalized) && DOCUMENT_EMBED_TAGS.has(tagName);
6308
6308
  }
6309
- function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
6309
+ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError, removeEventAttributes } = {
6310
6310
  safeJavaScriptLink: true,
6311
6311
  removeOnError: true
6312
6312
  }) {
@@ -6314,6 +6314,13 @@ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
6314
6314
  return false;
6315
6315
  }
6316
6316
  let effected = false;
6317
+ // Every `on*` handler, not only `onerror`: the clean-html background
6318
+ // pass calls this directly, and markup that reached the editable area
6319
+ // without `safeHTML` (a drop, a script) kept its handlers otherwise.
6320
+ // See GHSA-jhhp-r3r7-v2cg
6321
+ if (removeEventAttributes && removeAllEventAttributes(elm)) {
6322
+ effected = true;
6323
+ }
6317
6324
  if (removeOnError && elm.hasAttribute('onerror')) {
6318
6325
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'onerror', null);
6319
6326
  effected = true;
@@ -26399,22 +26406,19 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
26399
26406
  const tabs = [];
26400
26407
  const options = editor.o.uploader;
26401
26408
  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;
26409
+ const { upload } = callbacks;
26410
+ tabs.push(UploadTab(editor, (resp)=>{
26411
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(upload) ? upload : options.defaultHandlerSuccess;
26405
26412
  if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handler)) {
26406
26413
  handler.call(editor, resp);
26407
26414
  }
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
- });
26415
+ }, isImage ? {
26416
+ label: 'Drop image',
26417
+ accept: 'image/*'
26418
+ } : {
26419
+ label: 'Drop file',
26420
+ accept: '*'
26421
+ }));
26418
26422
  }
26419
26423
  if (callbacks.filebrowser) {
26420
26424
  if (editor.o.filebrowser.ajax.url || editor.o.filebrowser.items.url) {
@@ -26482,6 +26486,24 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
26482
26486
  box.classList.add('jodit-file-selector');
26483
26487
  return box;
26484
26488
  };
26489
+ /**
26490
+ * The Upload tab: a box that uploads the files dropped on it or chosen in its
26491
+ * file input, then passes the uploader's answer to `onSuccess` and closes the popup
26492
+ */ const UploadTab = (editor, onSuccess, { label, accept })=>{
26493
+ 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>');
26494
+ editor.uploader.bind(dragBox, (resp)=>{
26495
+ onSuccess.call(editor, resp);
26496
+ editor.e.fire('closeAllPopups');
26497
+ }, (error)=>{
26498
+ editor.message.error(error.message);
26499
+ editor.e.fire('closeAllPopups');
26500
+ });
26501
+ return {
26502
+ icon: 'upload',
26503
+ name: 'Upload',
26504
+ content: dragBox
26505
+ };
26506
+ };
26485
26507
  function val(elm, name, value) {
26486
26508
  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
26509
  if (!child) {
@@ -26494,7 +26516,8 @@ function val(elm, name, value) {
26494
26516
  }
26495
26517
 
26496
26518
  /* harmony export */ __webpack_require__.d(__webpack_exports__, [
26497
- /* harmony export */ "FileSelectorWidget", 0, /* binding */ FileSelectorWidget
26519
+ /* harmony export */ "FileSelectorWidget", 0, /* binding */ FileSelectorWidget,
26520
+ /* harmony export */ "UploadTab", 0, /* binding */ UploadTab
26498
26521
  /* harmony export */ ]);
26499
26522
 
26500
26523
 
@@ -26507,7 +26530,8 @@ function val(elm, name, value) {
26507
26530
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26508
26531
  /* harmony export */ ColorPickerWidget: function() { return /* reexport safe */ _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__.ColorPickerWidget; },
26509
26532
  /* 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; }
26533
+ /* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; },
26534
+ /* harmony export */ UploadTab: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.UploadTab; }
26511
26535
  /* harmony export */ });
26512
26536
  /* harmony import */ var _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72348);
26513
26537
  /* harmony import */ var _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18762);
@@ -31252,7 +31276,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
31252
31276
  window,
31253
31277
  this.j.ed,
31254
31278
  this.j.editor
31255
- ], 'dragstart.DragAndDrop', this.onDragStart);
31279
+ ], 'dragstart.DragAndDrop', this.onDragStart)// Always, not only after a `dragstart` seen in this window: a drop
31280
+ // from another window or application never produces one here, and
31281
+ // the browser then inserted its HTML natively, unsanitized. Routed
31282
+ // through the paste plugin instead. See GHSA-jhhp-r3r7-v2cg
31283
+ .on('drop.DragAndDrop', this.onDrop);
31256
31284
  }
31257
31285
  onDragStart(event) {
31258
31286
  let target = event.target;
@@ -31280,10 +31308,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
31280
31308
  this.addDragListeners();
31281
31309
  }
31282
31310
  addDragListeners() {
31283
- this.j.e.on('dragover', this.onDrag).on('drop.DragAndDrop', this.onDrop).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31311
+ this.j.e.on('dragover', this.onDrag).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31284
31312
  }
31285
31313
  removeDragListeners() {
31286
- this.j.e.off('dragover', this.onDrag).off('drop.DragAndDrop', this.onDrop).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31314
+ this.j.e.off('dragover', this.onDrag).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31287
31315
  }
31288
31316
  onDrag(event) {
31289
31317
  if (this.draggable) {
@@ -31345,7 +31373,12 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
31345
31373
  fragment = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.dataBind)(this.draggable, 'target');
31346
31374
  }
31347
31375
  } else if (this.getText(event)) {
31348
- fragment = this.j.createInside.fromHTML(this.getText(event));
31376
+ // Dropped markup takes the same sanitizing pass as pasted and
31377
+ // assigned content. See GHSA-jhhp-r3r7-v2cg
31378
+ const box = this.j.createInside.div();
31379
+ box.innerHTML = this.getText(event);
31380
+ this.j.e.fire('safeHTML', box);
31381
+ fragment = box.firstChild !== box.lastChild || !box.firstChild ? box : box.firstChild;
31349
31382
  }
31350
31383
  return fragment;
31351
31384
  }
@@ -32223,6 +32256,19 @@ function brBefore(start) {
32223
32256
 
32224
32257
 
32225
32258
 
32259
+ function insertLinks(data) {
32260
+ var _data_files;
32261
+ (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach((file)=>{
32262
+ const link = this.createInside.element('a', {
32263
+ href: data.baseurl + file
32264
+ });
32265
+ link.textContent = this.o.uploader.getDisplayName.call(this.uploader, data.baseurl, file);
32266
+ this.s.insertNode(link);
32267
+ });
32268
+ }
32269
+ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
32270
+ defaultHandlerSuccess: insertLinks
32271
+ };
32226
32272
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
32227
32273
  popup: (editor, current, close)=>{
32228
32274
  const insert = (url, title = '')=>{
@@ -32237,7 +32283,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
32237
32283
  data.files && data.files.forEach((file)=>insert(data.baseurl + file));
32238
32284
  close();
32239
32285
  },
32240
- upload: true,
32286
+ upload: (data)=>{
32287
+ var _ref;
32288
+ var _editor_o_file;
32289
+ ((_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);
32290
+ },
32241
32291
  url: (url, text)=>{
32242
32292
  if (sourceAnchor) {
32243
32293
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(sourceAnchor, 'href', url);
@@ -35782,6 +35832,26 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35782
35832
  // Images align with `imageAlignClasses`; the wrappers of iframes and media
35783
35833
  // keep inline styles
35784
35834
  const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
35835
+ // A Normal image sits where the text of its line is aligned (#1531)
35836
+ const lineAlign = (editor, elm)=>{
35837
+ 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;
35838
+ const rtl = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(block, 'direction') === 'rtl';
35839
+ switch((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(block, 'text-align')){
35840
+ case 'center':
35841
+ case '-webkit-center':
35842
+ return 'center';
35843
+ case 'justify':
35844
+ return 'justify';
35845
+ case 'right':
35846
+ return 'right';
35847
+ case 'end':
35848
+ return rtl ? 'left' : 'right';
35849
+ case 'start':
35850
+ return rtl ? 'right' : 'left';
35851
+ default:
35852
+ return 'left';
35853
+ }
35854
+ };
35785
35855
  const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
35786
35856
  const align = {
35787
35857
  name: 'left',
@@ -35794,7 +35864,7 @@ const align = {
35794
35864
  ],
35795
35865
  update: (editor, button)=>{
35796
35866
  const current = currentAlign(editor, button.target);
35797
- button.state.icon.name = current === 'normal' ? 'left' : current;
35867
+ button.state.icon.name = current === 'normal' ? lineAlign(editor, button.target) : current;
35798
35868
  },
35799
35869
  isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
35800
35870
  isChildActive: (editor, button)=>{
@@ -42417,7 +42487,8 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42417
42487
  }
42418
42488
  return;
42419
42489
  }
42420
- this.fromWYSIWYG();
42490
+ // The source plugin carries the fallback editor's text over when this
42491
+ // one is ready; refilling from WYSIWYG here would drop unsynced typing
42421
42492
  tryInitAceEditor();
42422
42493
  };
42423
42494
  editor.e.on('afterSetMode', initAceEditor);
@@ -42802,6 +42873,7 @@ class SourceEditor {
42802
42873
  if (new_value !== this.getMirrorValue()) {
42803
42874
  this.setMirrorValue(new_value);
42804
42875
  }
42876
+ this.__filledValue = this.getMirrorValue();
42805
42877
  this.__lock = false;
42806
42878
  }
42807
42879
  }
@@ -42979,9 +43051,9 @@ class SourceEditor {
42979
43051
  return;
42980
43052
  }
42981
43053
  loading = true;
42982
- // It formats the source view from the next time it opens:
42983
- // filling it again now would replace what was typed there
42984
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(addEventListener, ()=>null);
43054
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(()=>{
43055
+ addEventListener() && this.beautifyUntouched();
43056
+ }, ()=>null);
42985
43057
  };
42986
43058
  editor.e.on('afterSetMode.source', loadBeautify);
42987
43059
  loadBeautify();
@@ -43000,10 +43072,8 @@ class SourceEditor {
43000
43072
  if (editor.o.sourceEditor !== 'area') {
43001
43073
  const sourceEditor = (0,_editor_factory__WEBPACK_IMPORTED_MODULE_9__.createSourceEditor)(editor.o.sourceEditor, editor, this.mirrorContainer, this.toWYSIWYG, this.fromWYSIWYG);
43002
43074
  sourceEditor.onReadyAlways(()=>{
43003
- var _this_sourceEditor, _editor_events;
43004
- (_this_sourceEditor = this.sourceEditor) === null || _this_sourceEditor === void 0 ? void 0 : _this_sourceEditor.destruct();
43005
- this.sourceEditor = sourceEditor;
43006
- this.syncValueFromWYSIWYG(true);
43075
+ var _editor_events;
43076
+ this.takeOver(sourceEditor);
43007
43077
  (_editor_events = editor.events) === null || _editor_events === void 0 ? void 0 : _editor_events.fire('sourceEditorReady', editor);
43008
43078
  });
43009
43079
  } else {
@@ -43015,6 +43085,49 @@ class SourceEditor {
43015
43085
  });
43016
43086
  }
43017
43087
  }
43088
+ /**
43089
+ * Replaces the source editor (the textarea shown while ACE loads) with
43090
+ * the one that just became ready, carrying its text, selection and focus
43091
+ * over. Filling the new editor from WYSIWYG instead would drop what was
43092
+ * typed since the last, debounced, sync and normalise half-typed markup.
43093
+ */ takeOver(sourceEditor) {
43094
+ const previous = this.sourceEditor;
43095
+ if (!previous || previous === sourceEditor) {
43096
+ this.sourceEditor = sourceEditor;
43097
+ this.syncValueFromWYSIWYG(true);
43098
+ return;
43099
+ }
43100
+ const value = previous.getValue(), start = previous.getSelectionStart(), end = previous.getSelectionEnd(), focused = previous.isFocused, untouched = value === this.__filledValue;
43101
+ previous.destruct();
43102
+ this.sourceEditor = sourceEditor;
43103
+ if (untouched) {
43104
+ this.syncValueFromWYSIWYG(true);
43105
+ } else {
43106
+ sourceEditor.setValue(value);
43107
+ this.toWYSIWYG();
43108
+ }
43109
+ if (start >= 0) {
43110
+ sourceEditor.setSelectionRange(start, end);
43111
+ }
43112
+ focused && sourceEditor.focus();
43113
+ }
43114
+ /**
43115
+ * The beautifier arrived after the source view was opened: format the
43116
+ * view if nothing has been typed into it, otherwise leave the typing alone
43117
+ */ beautifyUntouched() {
43118
+ const value = this.getMirrorValue();
43119
+ if (this.j.o.editHTMLDocumentMode || !value || value !== this.__filledValue) {
43120
+ return;
43121
+ }
43122
+ const html = this.j.e.fire('beautifyHTML', value);
43123
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) && html !== value) {
43124
+ var _this_sourceEditor, _this_sourceEditor1;
43125
+ const focused = (_this_sourceEditor = this.sourceEditor) === null || _this_sourceEditor === void 0 ? void 0 : _this_sourceEditor.isFocused;
43126
+ this.setMirrorValue(html);
43127
+ this.__filledValue = this.getMirrorValue();
43128
+ focused && ((_this_sourceEditor1 = this.sourceEditor) === null || _this_sourceEditor1 === void 0 ? void 0 : _this_sourceEditor1.focus());
43129
+ }
43130
+ }
43018
43131
  /** @override */ beforeDestruct() {
43019
43132
  if (this.sourceEditor) {
43020
43133
  this.sourceEditor.destruct();
@@ -43028,7 +43141,10 @@ class SourceEditor {
43028
43141
  name: 'source',
43029
43142
  group: 'source'
43030
43143
  }
43031
- ]), (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
43144
+ ]), (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", ''), /**
43145
+ * What the source view was last filled with from WYSIWYG, read back from
43146
+ * the editor; while the view still holds it, nothing has been typed there
43147
+ */ (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
43032
43148
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "getSelectionStart", ()=>{
43033
43149
  var _ref;
43034
43150
  var _this_sourceEditor;
@@ -45396,10 +45512,20 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('toolbarNavigati
45396
45512
 
45397
45513
 
45398
45514
 
45515
+ function insertVideos(data) {
45516
+ var _data_files;
45517
+ (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach((file)=>{
45518
+ this.s.insertNode(this.createInside.element('video', {
45519
+ controls: '',
45520
+ src: data.baseurl + file
45521
+ }));
45522
+ });
45523
+ }
45399
45524
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.video = {
45400
45525
  parseUrlToVideoEmbed: jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.convertMediaUrlToVideoEmbed,
45401
45526
  defaultWidth: 400,
45402
- defaultHeight: 345
45527
+ defaultHeight: 345,
45528
+ defaultHandlerSuccess: insertVideos
45403
45529
  };
45404
45530
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('video', (_video_svg__WEBPACK_IMPORTED_MODULE_6___default()));
45405
45531
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
@@ -45436,6 +45562,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
45436
45562
  close();
45437
45563
  };
45438
45564
  jodit.s.save();
45565
+ const { uploader } = jodit.o;
45566
+ // Base64 alone would put whole video files into the content
45567
+ if (uploader.showTabInFileSelector !== false && (uploader.url || uploader.customUploadFunction)) {
45568
+ tabs.push((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_5__.UploadTab)(jodit, (data)=>{
45569
+ var _ref;
45570
+ var _jodit_o_video;
45571
+ jodit.s.restore();
45572
+ ((_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);
45573
+ }, {
45574
+ label: 'Drop file',
45575
+ accept: 'video/*'
45576
+ }));
45577
+ }
45439
45578
  tabs.push({
45440
45579
  icon: 'link',
45441
45580
  name: 'Link',