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/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.15.14
4
+ * Version: v4.15.16
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1786,7 +1786,7 @@ __webpack_require__.r(__webpack_exports__);
1786
1786
  * ```
1787
1787
  * @packageDocumentation
1788
1788
  * @module constants
1789
- */ const APP_VERSION = "4.15.14";
1789
+ */ const APP_VERSION = "4.15.16";
1790
1790
  // prettier-ignore
1791
1791
  const ES = "es2015";
1792
1792
  const IS_ES_MODERN = true;
@@ -28737,7 +28737,10 @@ class cleanHtml extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_7__.Pl
28737
28737
  if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
28738
28738
  return;
28739
28739
  }
28740
- if (/^<([a-z][a-z0-9]*)\b[^>]*>(?:<br\/?>)?<\/\1>$/i.test(data.value.trim())) {
28740
+ // Only a text block can be an empty caret container; a lone video,
28741
+ // iframe or icon has no children but is content in itself
28742
+ const lone = /^<([a-z][a-z0-9]*)\b[^>]*>(?:<br\/?>)?<\/\1>$/i.exec(data.value.trim());
28743
+ if (lone && /^(p|div|h[1-6]|blockquote|pre)$/i.test(lone[1])) {
28741
28744
  data.value = '';
28742
28745
  }
28743
28746
  }
@@ -30027,6 +30030,15 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('color', color);
30027
30030
 
30028
30031
 
30029
30032
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__.Icon.set('brush', (_brush_svg__WEBPACK_IMPORTED_MODULE_5___default()));
30033
+ /**
30034
+ * Set a color style; an empty value removes it, and with it the `style`
30035
+ * attribute once nothing else is left in it
30036
+ */ function setColorStyle(elm, key, value) {
30037
+ (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(elm, key, value);
30038
+ if (!(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'style')) {
30039
+ (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'style', null);
30040
+ }
30041
+ }
30030
30042
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brushCell = {
30031
30043
  isVisible: (editor)=>{
30032
30044
  return !editor.o.disablePlugins.includes('color');
@@ -30042,7 +30054,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brushCell =
30042
30054
  }
30043
30055
  const makeColorPicker = (key)=>(0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_4__.ColorPickerWidget)(editor, (value)=>{
30044
30056
  selected.forEach((cell)=>{
30045
- ;(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(cell, key, value);
30057
+ setColorStyle(cell, key, value);
30046
30058
  });
30047
30059
  editor.lock();
30048
30060
  editor.synchronizeValues();
@@ -30128,7 +30140,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brush = {
30128
30140
  if (!currentElement) {
30129
30141
  editor.execCommand('background', false, value);
30130
30142
  } else {
30131
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(currentElement, 'backgroundColor', value);
30143
+ setColorStyle(currentElement, 'backgroundColor', value);
30132
30144
  }
30133
30145
  ;(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.dataBind)(button, 'color', value);
30134
30146
  (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.dataBind)(button, 'color-mode', 'background');
@@ -30138,7 +30150,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brush = {
30138
30150
  if (!currentElement) {
30139
30151
  editor.execCommand('forecolor', false, value);
30140
30152
  } else {
30141
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(currentElement, 'color', value);
30153
+ setColorStyle(currentElement, 'color', value);
30142
30154
  }
30143
30155
  ;(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.dataBind)(button, 'color', value);
30144
30156
  (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.dataBind)(button, 'color-mode', 'color');
@@ -30167,10 +30179,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brush = {
30167
30179
  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)) {
30168
30180
  switch(mode){
30169
30181
  case 'color':
30170
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(current, 'color', color);
30182
+ setColorStyle(current, 'color', color);
30171
30183
  break;
30172
30184
  case 'background':
30173
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(current, 'backgroundColor', color);
30185
+ setColorStyle(current, 'backgroundColor', color);
30174
30186
  break;
30175
30187
  }
30176
30188
  } else {
@@ -38570,10 +38582,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.paste = {
38570
38582
  dialog.close();
38571
38583
  callback(value);
38572
38584
  }));
38573
- dialog.e.one(dialog, 'afterClose', ()=>{
38585
+ dialog.e.on(dialog, 'beforeClose', ()=>{
38586
+ jodit.e.fire('beforeClosePasteDialog', dialog);
38587
+ }).one(dialog, 'afterClose', ()=>{
38574
38588
  if (!jodit.s.isFocused()) {
38575
38589
  jodit.s.focus();
38576
38590
  }
38591
+ jodit.e.fire('afterClosePasteDialog', dialog);
38577
38592
  });
38578
38593
  const cancel = (0,jodit_core_ui_button_button_button__WEBPACK_IMPORTED_MODULE_3__.Button)(jodit, {
38579
38594
  text: 'Cancel',
@@ -38942,7 +38957,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
38942
38957
  this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(editor.element, 'placeholder') || '';
38943
38958
  }
38944
38959
  editor.e.fire('placeholder', this.placeholderElm.innerHTML);
38945
- 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);
38960
+ 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);
38946
38961
  this.addNativeListeners();
38947
38962
  this.toggle();
38948
38963
  });