jodit 4.15.14 → 4.15.16

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 (59) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +25 -10
  5. package/es2015/jodit.min.js +4 -4
  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 +4 -4
  13. package/es2018/jodit.min.js +4 -4
  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 +4 -4
  18. package/es2021/jodit.js +25 -10
  19. package/es2021/jodit.min.js +4 -4
  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 +4 -4
  28. package/es2021.en/jodit.js +25 -10
  29. package/es2021.en/jodit.min.js +4 -4
  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 +25 -10
  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 +4 -2
  51. package/esm/core/constants.js +1 -1
  52. package/esm/plugins/clean-html/clean-html.js +4 -1
  53. package/esm/plugins/clean-html/config.d.ts +4 -2
  54. package/esm/plugins/color/config.js +16 -6
  55. package/esm/plugins/paste/helpers.js +6 -1
  56. package/esm/plugins/placeholder/placeholder.js +2 -1
  57. package/package.json +1 -1
  58. package/types/config.d.ts +4 -2
  59. package/types/plugins/clean-html/config.d.ts +4 -2
package/es2021/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.15.14
4
+ * Version: v4.15.16
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1780,7 +1780,7 @@ __webpack_require__.r(__webpack_exports__);
1780
1780
  * ```
1781
1781
  * @packageDocumentation
1782
1782
  * @module constants
1783
- */ const APP_VERSION = "4.15.14";
1783
+ */ const APP_VERSION = "4.15.16";
1784
1784
  // prettier-ignore
1785
1785
  const ES = "es2021";
1786
1786
  const IS_ES_MODERN = true;
@@ -28525,7 +28525,10 @@ class cleanHtml extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_7__.Pl
28525
28525
  if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
28526
28526
  return;
28527
28527
  }
28528
- if (/^<([a-z][a-z0-9]*)\b[^>]*>(?:<br\/?>)?<\/\1>$/i.test(data.value.trim())) {
28528
+ // Only a text block can be an empty caret container; a lone video,
28529
+ // iframe or icon has no children but is content in itself
28530
+ const lone = /^<([a-z][a-z0-9]*)\b[^>]*>(?:<br\/?>)?<\/\1>$/i.exec(data.value.trim());
28531
+ if (lone && /^(p|div|h[1-6]|blockquote|pre)$/i.test(lone[1])) {
28529
28532
  data.value = '';
28530
28533
  }
28531
28534
  }
@@ -29810,6 +29813,15 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('color', color);
29810
29813
 
29811
29814
 
29812
29815
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__.Icon.set('brush', (_brush_svg__WEBPACK_IMPORTED_MODULE_5___default()));
29816
+ /**
29817
+ * Set a color style; an empty value removes it, and with it the `style`
29818
+ * attribute once nothing else is left in it
29819
+ */ function setColorStyle(elm, key, value) {
29820
+ (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(elm, key, value);
29821
+ if (!(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'style')) {
29822
+ (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'style', null);
29823
+ }
29824
+ }
29813
29825
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brushCell = {
29814
29826
  isVisible: (editor)=>{
29815
29827
  return !editor.o.disablePlugins.includes('color');
@@ -29825,7 +29837,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brushCell =
29825
29837
  }
29826
29838
  const makeColorPicker = (key)=>(0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_4__.ColorPickerWidget)(editor, (value)=>{
29827
29839
  selected.forEach((cell)=>{
29828
- ;(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(cell, key, value);
29840
+ setColorStyle(cell, key, value);
29829
29841
  });
29830
29842
  editor.lock();
29831
29843
  editor.synchronizeValues();
@@ -29911,7 +29923,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brush = {
29911
29923
  if (!currentElement) {
29912
29924
  editor.execCommand('background', false, value);
29913
29925
  } else {
29914
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(currentElement, 'backgroundColor', value);
29926
+ setColorStyle(currentElement, 'backgroundColor', value);
29915
29927
  }
29916
29928
  ;(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.dataBind)(button, 'color', value);
29917
29929
  (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.dataBind)(button, 'color-mode', 'background');
@@ -29921,7 +29933,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brush = {
29921
29933
  if (!currentElement) {
29922
29934
  editor.execCommand('forecolor', false, value);
29923
29935
  } else {
29924
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(currentElement, 'color', value);
29936
+ setColorStyle(currentElement, 'color', value);
29925
29937
  }
29926
29938
  ;(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.dataBind)(button, 'color', value);
29927
29939
  (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.dataBind)(button, 'color-mode', 'color');
@@ -29950,10 +29962,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brush = {
29950
29962
  if (current && current !== jodit.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isNode(current) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(current)) {
29951
29963
  switch(mode){
29952
29964
  case 'color':
29953
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(current, 'color', color);
29965
+ setColorStyle(current, 'color', color);
29954
29966
  break;
29955
29967
  case 'background':
29956
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(current, 'backgroundColor', color);
29968
+ setColorStyle(current, 'backgroundColor', color);
29957
29969
  break;
29958
29970
  }
29959
29971
  } else {
@@ -38293,10 +38305,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.controls.paste = {
38293
38305
  dialog.close();
38294
38306
  callback(value);
38295
38307
  }));
38296
- dialog.e.one(dialog, 'afterClose', ()=>{
38308
+ dialog.e.on(dialog, 'beforeClose', ()=>{
38309
+ jodit.e.fire('beforeClosePasteDialog', dialog);
38310
+ }).one(dialog, 'afterClose', ()=>{
38297
38311
  if (!jodit.s.isFocused()) {
38298
38312
  jodit.s.focus();
38299
38313
  }
38314
+ jodit.e.fire('afterClosePasteDialog', dialog);
38300
38315
  });
38301
38316
  const cancel = (0,jodit_core_ui_button_button_button__WEBPACK_IMPORTED_MODULE_3__.Button)(jodit, {
38302
38317
  text: 'Cancel',
@@ -38664,7 +38679,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
38664
38679
  this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(editor.element, 'placeholder') || '';
38665
38680
  }
38666
38681
  editor.e.fire('placeholder', this.placeholderElm.innerHTML);
38667
- editor.e.off('.placeholder').on('changePlace.placeholder', this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder', this.toggle).on(window, 'load', this.toggle);
38682
+ editor.e.off('.placeholder').on('changePlace.placeholder', this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder', this.toggle).on(window, 'load', this.toggle);
38668
38683
  this.addNativeListeners();
38669
38684
  this.toggle();
38670
38685
  });