jodit 4.15.4 → 4.15.6

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 (60) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +34 -2
  5. package/es2015/jodit.min.js +6 -6
  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 +6 -6
  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 +34 -2
  19. package/es2021/jodit.min.js +6 -6
  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 +34 -2
  29. package/es2021.en/jodit.min.js +11 -11
  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 +39 -2
  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 +9 -0
  51. package/esm/core/constants.js +1 -1
  52. package/esm/plugins/clean-html/clean-html.d.ts +9 -0
  53. package/esm/plugins/clean-html/clean-html.js +27 -0
  54. package/esm/plugins/clean-html/config.d.ts +9 -0
  55. package/esm/plugins/clean-html/config.js +1 -0
  56. package/esm/plugins/link/link.js +9 -0
  57. package/package.json +1 -1
  58. package/types/config.d.ts +9 -0
  59. package/types/plugins/clean-html/clean-html.d.ts +9 -0
  60. package/types/plugins/clean-html/config.d.ts +9 -0
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.4
4
+ * Version: v4.15.6
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1779,7 +1779,7 @@ __webpack_require__.r(__webpack_exports__);
1779
1779
  * ```
1780
1780
  * @packageDocumentation
1781
1781
  * @module constants
1782
- */ const APP_VERSION = "4.15.4";
1782
+ */ const APP_VERSION = "4.15.6";
1783
1783
  // prettier-ignore
1784
1784
  const ES = "es2021";
1785
1785
  const IS_ES_MODERN = true;
@@ -28387,6 +28387,7 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('class-span', (_class_s
28387
28387
  * `<p><br></p>` left after deleting all content) to an empty string —
28388
28388
  * opt-in via `cleanHTML.collapseEmptyValueToEmptyString`. See #1149
28389
28389
  */ onAfterGetValueFromEditor(data) {
28390
+ this.__singleQuotesInFontFamily(data);
28390
28391
  if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
28391
28392
  return;
28392
28393
  }
@@ -28394,6 +28395,27 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('class-span', (_class_s
28394
28395
  data.value = '';
28395
28396
  }
28396
28397
  }
28398
+ /**
28399
+ * Rewrite double-quoted font names inside `style` attributes with single
28400
+ * quotes. The DOM always serialises them as `&quot;…&quot;`, and back ends
28401
+ * that HTML-decode the value before storing it then produce
28402
+ * `style="font-family: "Open Sans", …"` — broken markup. Single quotes
28403
+ * survive that round trip. Names that already contain an apostrophe are
28404
+ * left alone.
28405
+ */ __singleQuotesInFontFamily(data) {
28406
+ if (!this.j.o.cleanHTML.singleQuotesInFontFamily || !data.value.includes('&quot;')) {
28407
+ return;
28408
+ }
28409
+ data.value = data.value.replace(/\sstyle="([^"]*)"/gi, (attribute, css)=>{
28410
+ if (!css.includes('&quot;') || !/font-family/i.test(css)) {
28411
+ return attribute;
28412
+ }
28413
+ const normalized = css.replace(// `&quot;` itself ends with `;`, so the entity has to be
28414
+ // consumed as a unit or the declaration stops inside it.
28415
+ /font-family\s*:(?:&quot;|[^;])*/gi, (declaration)=>declaration.includes("'") ? declaration : declaration.replace(/&quot;/g, "'"));
28416
+ return attribute.replace(css, normalized);
28417
+ });
28418
+ }
28397
28419
  onSafeHTML(sandBox) {
28398
28420
  const sanitizer = this.j.o.cleanHTML.sanitizer;
28399
28421
  if (sanitizer) {
@@ -28466,6 +28488,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.cleanHTML = {
28466
28488
  removeEmptyElements: true,
28467
28489
  fillEmptyParagraph: true,
28468
28490
  collapseEmptyValueToEmptyString: false,
28491
+ singleQuotesInFontFamily: true,
28469
28492
  replaceNBSP: true,
28470
28493
  replaceOldTags: {
28471
28494
  i: 'em',
@@ -36727,6 +36750,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
36727
36750
  jodit.history.snapshot.restore(snapshot);
36728
36751
  const textWasChanged = getSelectionText() !== content_input.value.trim();
36729
36752
  const ci = jodit.createInside;
36753
+ let caretAfter = null;
36730
36754
  if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(jodit.editor, link)) {
36731
36755
  if (!jodit.s.isCollapsed()) {
36732
36756
  const node = jodit.s.current();
@@ -36743,6 +36767,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
36743
36767
  links = [
36744
36768
  a
36745
36769
  ];
36770
+ caretAfter = a;
36746
36771
  }
36747
36772
  links.forEach((link)=>jodit.s.select(link));
36748
36773
  } else {
@@ -36775,6 +36800,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
36775
36800
  }
36776
36801
  jodit.e.fire('applyLink', jodit, a, form);
36777
36802
  });
36803
+ // A brand-new link inserted at a collapsed caret used to stay
36804
+ // *selected*. Safari does not paint that selection, so the next
36805
+ // Enter silently replaced the link instead of starting a new line.
36806
+ // Put the caret right after the link instead.
36807
+ if (caretAfter) {
36808
+ jodit.s.setCursorAfter(caretAfter);
36809
+ }
36778
36810
  jodit.synchronizeValues();
36779
36811
  close();
36780
36812
  return false;