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
@@ -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
  */
@@ -1799,7 +1799,7 @@ __webpack_require__.r(__webpack_exports__);
1799
1799
  * ```
1800
1800
  * @packageDocumentation
1801
1801
  * @module constants
1802
- */ const APP_VERSION = "4.16.1";
1802
+ */ const APP_VERSION = "4.17.1";
1803
1803
  // prettier-ignore
1804
1804
  const ES = "es2021";
1805
1805
  const IS_ES_MODERN = true;
@@ -6281,7 +6281,7 @@ function isSmuggledForeignHtml(elm) {
6281
6281
  }
6282
6282
  return /^data:image\/svg/.test(normalized) && DOCUMENT_EMBED_TAGS.has(tagName);
6283
6283
  }
6284
- function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
6284
+ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError, removeEventAttributes } = {
6285
6285
  safeJavaScriptLink: true,
6286
6286
  removeOnError: true
6287
6287
  }) {
@@ -6289,6 +6289,13 @@ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
6289
6289
  return false;
6290
6290
  }
6291
6291
  let effected = false;
6292
+ // Every `on*` handler, not only `onerror`: the clean-html background
6293
+ // pass calls this directly, and markup that reached the editable area
6294
+ // without `safeHTML` (a drop, a script) kept its handlers otherwise.
6295
+ // See GHSA-jhhp-r3r7-v2cg
6296
+ if (removeEventAttributes && removeAllEventAttributes(elm)) {
6297
+ effected = true;
6298
+ }
6292
6299
  if (removeOnError && elm.hasAttribute('onerror')) {
6293
6300
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'onerror', null);
6294
6301
  effected = true;
@@ -26171,22 +26178,19 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
26171
26178
  const tabs = [];
26172
26179
  const options = editor.o.uploader;
26173
26180
  if (callbacks.upload && options.showTabInFileSelector !== false && (options.url || options.insertImageAsBase64URI || options.customUploadFunction)) {
26174
- 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>');
26175
- editor.uploader.bind(dragBox, (resp)=>{
26176
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(callbacks.upload) ? callbacks.upload : options.defaultHandlerSuccess;
26181
+ const { upload } = callbacks;
26182
+ tabs.push(UploadTab(editor, (resp)=>{
26183
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(upload) ? upload : options.defaultHandlerSuccess;
26177
26184
  if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handler)) {
26178
26185
  handler.call(editor, resp);
26179
26186
  }
26180
- editor.e.fire('closeAllPopups');
26181
- }, (error)=>{
26182
- editor.message.error(error.message);
26183
- editor.e.fire('closeAllPopups');
26184
- });
26185
- tabs.push({
26186
- icon: 'upload',
26187
- name: 'Upload',
26188
- content: dragBox
26189
- });
26187
+ }, isImage ? {
26188
+ label: 'Drop image',
26189
+ accept: 'image/*'
26190
+ } : {
26191
+ label: 'Drop file',
26192
+ accept: '*'
26193
+ }));
26190
26194
  }
26191
26195
  if (callbacks.filebrowser) {
26192
26196
  if (editor.o.filebrowser.ajax.url || editor.o.filebrowser.items.url) {
@@ -26254,6 +26258,24 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
26254
26258
  box.classList.add('jodit-file-selector');
26255
26259
  return box;
26256
26260
  };
26261
+ /**
26262
+ * The Upload tab: a box that uploads the files dropped on it or chosen in its
26263
+ * file input, then passes the uploader's answer to `onSuccess` and closes the popup
26264
+ */ const UploadTab = (editor, onSuccess, { label, accept })=>{
26265
+ 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>');
26266
+ editor.uploader.bind(dragBox, (resp)=>{
26267
+ onSuccess.call(editor, resp);
26268
+ editor.e.fire('closeAllPopups');
26269
+ }, (error)=>{
26270
+ editor.message.error(error.message);
26271
+ editor.e.fire('closeAllPopups');
26272
+ });
26273
+ return {
26274
+ icon: 'upload',
26275
+ name: 'Upload',
26276
+ content: dragBox
26277
+ };
26278
+ };
26257
26279
  function val(elm, name, value) {
26258
26280
  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);
26259
26281
  if (!child) {
@@ -26266,7 +26288,8 @@ function val(elm, name, value) {
26266
26288
  }
26267
26289
 
26268
26290
  /* harmony export */ __webpack_require__.d(__webpack_exports__, [
26269
- /* harmony export */ "FileSelectorWidget", 0, /* binding */ FileSelectorWidget
26291
+ /* harmony export */ "FileSelectorWidget", 0, /* binding */ FileSelectorWidget,
26292
+ /* harmony export */ "UploadTab", 0, /* binding */ UploadTab
26270
26293
  /* harmony export */ ]);
26271
26294
 
26272
26295
 
@@ -26279,7 +26302,8 @@ function val(elm, name, value) {
26279
26302
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26280
26303
  /* harmony export */ ColorPickerWidget: function() { return /* reexport safe */ _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__.ColorPickerWidget; },
26281
26304
  /* harmony export */ FileSelectorWidget: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.FileSelectorWidget; },
26282
- /* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; }
26305
+ /* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; },
26306
+ /* harmony export */ UploadTab: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.UploadTab; }
26283
26307
  /* harmony export */ });
26284
26308
  /* harmony import */ var _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72348);
26285
26309
  /* harmony import */ var _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18762);
@@ -30645,7 +30669,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
30645
30669
  window,
30646
30670
  this.j.ed,
30647
30671
  this.j.editor
30648
- ], 'dragstart.DragAndDrop', this.onDragStart);
30672
+ ], 'dragstart.DragAndDrop', this.onDragStart)// Always, not only after a `dragstart` seen in this window: a drop
30673
+ // from another window or application never produces one here, and
30674
+ // the browser then inserted its HTML natively, unsanitized. Routed
30675
+ // through the paste plugin instead. See GHSA-jhhp-r3r7-v2cg
30676
+ .on('drop.DragAndDrop', this.onDrop);
30649
30677
  }
30650
30678
  onDragStart(event) {
30651
30679
  let target = event.target;
@@ -30673,10 +30701,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
30673
30701
  this.addDragListeners();
30674
30702
  }
30675
30703
  addDragListeners() {
30676
- this.j.e.on('dragover', this.onDrag).on('drop.DragAndDrop', this.onDrop).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
30704
+ this.j.e.on('dragover', this.onDrag).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
30677
30705
  }
30678
30706
  removeDragListeners() {
30679
- this.j.e.off('dragover', this.onDrag).off('drop.DragAndDrop', this.onDrop).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
30707
+ this.j.e.off('dragover', this.onDrag).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
30680
30708
  }
30681
30709
  onDrag(event) {
30682
30710
  if (this.draggable) {
@@ -30738,7 +30766,12 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
30738
30766
  fragment = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.dataBind)(this.draggable, 'target');
30739
30767
  }
30740
30768
  } else if (this.getText(event)) {
30741
- fragment = this.j.createInside.fromHTML(this.getText(event));
30769
+ // Dropped markup takes the same sanitizing pass as pasted and
30770
+ // assigned content. See GHSA-jhhp-r3r7-v2cg
30771
+ const box = this.j.createInside.div();
30772
+ box.innerHTML = this.getText(event);
30773
+ this.j.e.fire('safeHTML', box);
30774
+ fragment = box.firstChild !== box.lastChild || !box.firstChild ? box : box.firstChild;
30742
30775
  }
30743
30776
  return fragment;
30744
30777
  }
@@ -31614,6 +31647,18 @@ function brBefore(start) {
31614
31647
 
31615
31648
 
31616
31649
 
31650
+ function insertLinks(data) {
31651
+ data.files?.forEach((file)=>{
31652
+ const link = this.createInside.element('a', {
31653
+ href: data.baseurl + file
31654
+ });
31655
+ link.textContent = this.o.uploader.getDisplayName.call(this.uploader, data.baseurl, file);
31656
+ this.s.insertNode(link);
31657
+ });
31658
+ }
31659
+ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
31660
+ defaultHandlerSuccess: insertLinks
31661
+ };
31617
31662
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
31618
31663
  popup: (editor, current, close)=>{
31619
31664
  const insert = (url, title = '')=>{
@@ -31628,7 +31673,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
31628
31673
  data.files && data.files.forEach((file)=>insert(data.baseurl + file));
31629
31674
  close();
31630
31675
  },
31631
- upload: true,
31676
+ upload: (data)=>{
31677
+ (editor.o.file?.defaultHandlerSuccess ?? insertLinks).call(editor, data);
31678
+ },
31632
31679
  url: (url, text)=>{
31633
31680
  if (sourceAnchor) {
31634
31681
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(sourceAnchor, 'href', url);
@@ -35131,6 +35178,26 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35131
35178
  // Images align with `imageAlignClasses`; the wrappers of iframes and media
35132
35179
  // keep inline styles
35133
35180
  const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
35181
+ // A Normal image sits where the text of its line is aligned (#1531)
35182
+ const lineAlign = (editor, elm)=>{
35183
+ 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;
35184
+ const rtl = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(block, 'direction') === 'rtl';
35185
+ switch((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(block, 'text-align')){
35186
+ case 'center':
35187
+ case '-webkit-center':
35188
+ return 'center';
35189
+ case 'justify':
35190
+ return 'justify';
35191
+ case 'right':
35192
+ return 'right';
35193
+ case 'end':
35194
+ return rtl ? 'left' : 'right';
35195
+ case 'start':
35196
+ return rtl ? 'right' : 'left';
35197
+ default:
35198
+ return 'left';
35199
+ }
35200
+ };
35134
35201
  const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
35135
35202
  const align = {
35136
35203
  name: 'left',
@@ -35143,7 +35210,7 @@ const align = {
35143
35210
  ],
35144
35211
  update: (editor, button)=>{
35145
35212
  const current = currentAlign(editor, button.target);
35146
- button.state.icon.name = current === 'normal' ? 'left' : current;
35213
+ button.state.icon.name = current === 'normal' ? lineAlign(editor, button.target) : current;
35147
35214
  },
35148
35215
  isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
35149
35216
  isChildActive: (editor, button)=>{
@@ -41345,7 +41412,8 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
41345
41412
  }
41346
41413
  return;
41347
41414
  }
41348
- this.fromWYSIWYG();
41415
+ // The source plugin carries the fallback editor's text over when this
41416
+ // one is ready; refilling from WYSIWYG here would drop unsynced typing
41349
41417
  tryInitAceEditor();
41350
41418
  };
41351
41419
  editor.e.on('afterSetMode', initAceEditor);
@@ -41727,6 +41795,7 @@ class SourceEditor {
41727
41795
  if (new_value !== this.getMirrorValue()) {
41728
41796
  this.setMirrorValue(new_value);
41729
41797
  }
41798
+ this.__filledValue = this.getMirrorValue();
41730
41799
  this.__lock = false;
41731
41800
  }
41732
41801
  }
@@ -41895,9 +41964,9 @@ class SourceEditor {
41895
41964
  return;
41896
41965
  }
41897
41966
  loading = true;
41898
- // It formats the source view from the next time it opens:
41899
- // filling it again now would replace what was typed there
41900
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(addEventListener, ()=>null);
41967
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(()=>{
41968
+ addEventListener() && this.beautifyUntouched();
41969
+ }, ()=>null);
41901
41970
  };
41902
41971
  editor.e.on('afterSetMode.source', loadBeautify);
41903
41972
  loadBeautify();
@@ -41916,9 +41985,7 @@ class SourceEditor {
41916
41985
  if (editor.o.sourceEditor !== 'area') {
41917
41986
  const sourceEditor = (0,_editor_factory__WEBPACK_IMPORTED_MODULE_9__.createSourceEditor)(editor.o.sourceEditor, editor, this.mirrorContainer, this.toWYSIWYG, this.fromWYSIWYG);
41918
41987
  sourceEditor.onReadyAlways(()=>{
41919
- this.sourceEditor?.destruct();
41920
- this.sourceEditor = sourceEditor;
41921
- this.syncValueFromWYSIWYG(true);
41988
+ this.takeOver(sourceEditor);
41922
41989
  editor.events?.fire('sourceEditorReady', editor);
41923
41990
  });
41924
41991
  } else {
@@ -41928,6 +41995,48 @@ class SourceEditor {
41928
41995
  });
41929
41996
  }
41930
41997
  }
41998
+ /**
41999
+ * Replaces the source editor (the textarea shown while ACE loads) with
42000
+ * the one that just became ready, carrying its text, selection and focus
42001
+ * over. Filling the new editor from WYSIWYG instead would drop what was
42002
+ * typed since the last, debounced, sync and normalise half-typed markup.
42003
+ */ takeOver(sourceEditor) {
42004
+ const previous = this.sourceEditor;
42005
+ if (!previous || previous === sourceEditor) {
42006
+ this.sourceEditor = sourceEditor;
42007
+ this.syncValueFromWYSIWYG(true);
42008
+ return;
42009
+ }
42010
+ const value = previous.getValue(), start = previous.getSelectionStart(), end = previous.getSelectionEnd(), focused = previous.isFocused, untouched = value === this.__filledValue;
42011
+ previous.destruct();
42012
+ this.sourceEditor = sourceEditor;
42013
+ if (untouched) {
42014
+ this.syncValueFromWYSIWYG(true);
42015
+ } else {
42016
+ sourceEditor.setValue(value);
42017
+ this.toWYSIWYG();
42018
+ }
42019
+ if (start >= 0) {
42020
+ sourceEditor.setSelectionRange(start, end);
42021
+ }
42022
+ focused && sourceEditor.focus();
42023
+ }
42024
+ /**
42025
+ * The beautifier arrived after the source view was opened: format the
42026
+ * view if nothing has been typed into it, otherwise leave the typing alone
42027
+ */ beautifyUntouched() {
42028
+ const value = this.getMirrorValue();
42029
+ if (this.j.o.editHTMLDocumentMode || !value || value !== this.__filledValue) {
42030
+ return;
42031
+ }
42032
+ const html = this.j.e.fire('beautifyHTML', value);
42033
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) && html !== value) {
42034
+ const focused = this.sourceEditor?.isFocused;
42035
+ this.setMirrorValue(html);
42036
+ this.__filledValue = this.getMirrorValue();
42037
+ focused && this.sourceEditor?.focus();
42038
+ }
42039
+ }
41931
42040
  /** @override */ beforeDestruct() {
41932
42041
  if (this.sourceEditor) {
41933
42042
  this.sourceEditor.destruct();
@@ -41941,7 +42050,10 @@ class SourceEditor {
41941
42050
  name: 'source',
41942
42051
  group: 'source'
41943
42052
  }
41944
- ]), (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
42053
+ ]), (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", ''), /**
42054
+ * What the source view was last filled with from WYSIWYG, read back from
42055
+ * the editor; while the view still holds it, nothing has been typed there
42056
+ */ (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
41945
42057
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "getSelectionStart", ()=>{
41946
42058
  return this.sourceEditor?.getSelectionStart() ?? 0;
41947
42059
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "getSelectionEnd", ()=>{
@@ -43573,10 +43685,19 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('toolbarNavigati
43573
43685
 
43574
43686
 
43575
43687
 
43688
+ function insertVideos(data) {
43689
+ data.files?.forEach((file)=>{
43690
+ this.s.insertNode(this.createInside.element('video', {
43691
+ controls: '',
43692
+ src: data.baseurl + file
43693
+ }));
43694
+ });
43695
+ }
43576
43696
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.video = {
43577
43697
  parseUrlToVideoEmbed: jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.convertMediaUrlToVideoEmbed,
43578
43698
  defaultWidth: 400,
43579
- defaultHeight: 345
43699
+ defaultHeight: 345,
43700
+ defaultHandlerSuccess: insertVideos
43580
43701
  };
43581
43702
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('video', (_video_svg__WEBPACK_IMPORTED_MODULE_6___default()));
43582
43703
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
@@ -43613,6 +43734,17 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
43613
43734
  close();
43614
43735
  };
43615
43736
  jodit.s.save();
43737
+ const { uploader } = jodit.o;
43738
+ // Base64 alone would put whole video files into the content
43739
+ if (uploader.showTabInFileSelector !== false && (uploader.url || uploader.customUploadFunction)) {
43740
+ tabs.push((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_5__.UploadTab)(jodit, (data)=>{
43741
+ jodit.s.restore();
43742
+ (jodit.o.video?.defaultHandlerSuccess ?? insertVideos).call(jodit, data);
43743
+ }, {
43744
+ label: 'Drop file',
43745
+ accept: 'video/*'
43746
+ }));
43747
+ }
43616
43748
  tabs.push({
43617
43749
  icon: 'link',
43618
43750
  name: 'Link',