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
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
package/es5/polyfills.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
  */
@@ -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
  */
package/esm/config.d.ts CHANGED
@@ -1033,6 +1033,15 @@ interface Config {
1033
1033
  * it to `''` for form submission.
1034
1034
  */
1035
1035
  collapseEmptyValueToEmptyString: boolean;
1036
+ /**
1037
+ * Browsers serialise quoted font names in a `style` attribute with
1038
+ * double quotes, which end up as `&quot;` in the editor value
1039
+ * (`font-family: &quot;Open Sans&quot;, sans-serif`). Some back ends
1040
+ * HTML-decode the value before storing it and turn that into invalid
1041
+ * markup. With this option (default) the value getter rewrites such
1042
+ * names with single quotes: `font-family: 'Open Sans', sans-serif`.
1043
+ */
1044
+ singleQuotesInFontFamily: boolean;
1036
1045
  /**
1037
1046
  * Replace old tags to new eg. <i> to <em>, <b> to <strong>
1038
1047
  */
@@ -3,7 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export const APP_VERSION = "4.15.4";
6
+ export const APP_VERSION = "4.15.6";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -42,6 +42,15 @@ export declare class cleanHtml extends Plugin {
42
42
  protected onAfterGetValueFromEditor(data: {
43
43
  value: string;
44
44
  }): void;
45
+ /**
46
+ * Rewrite double-quoted font names inside `style` attributes with single
47
+ * quotes. The DOM always serialises them as `&quot;…&quot;`, and back ends
48
+ * that HTML-decode the value before storing it then produce
49
+ * `style="font-family: "Open Sans", …"` — broken markup. Single quotes
50
+ * survive that round trip. Names that already contain an apostrophe are
51
+ * left alone.
52
+ */
53
+ private __singleQuotesInFontFamily;
45
54
  protected onSafeHTML(sandBox: HTMLElement): void;
46
55
  /** @override */
47
56
  protected beforeDestruct(): void;
@@ -106,6 +106,7 @@ export class cleanHtml extends Plugin {
106
106
  * opt-in via `cleanHTML.collapseEmptyValueToEmptyString`. See #1149
107
107
  */
108
108
  onAfterGetValueFromEditor(data) {
109
+ this.__singleQuotesInFontFamily(data);
109
110
  if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
110
111
  return;
111
112
  }
@@ -113,6 +114,32 @@ export class cleanHtml extends Plugin {
113
114
  data.value = '';
114
115
  }
115
116
  }
117
+ /**
118
+ * Rewrite double-quoted font names inside `style` attributes with single
119
+ * quotes. The DOM always serialises them as `&quot;…&quot;`, and back ends
120
+ * that HTML-decode the value before storing it then produce
121
+ * `style="font-family: "Open Sans", …"` — broken markup. Single quotes
122
+ * survive that round trip. Names that already contain an apostrophe are
123
+ * left alone.
124
+ */
125
+ __singleQuotesInFontFamily(data) {
126
+ if (!this.j.o.cleanHTML.singleQuotesInFontFamily ||
127
+ !data.value.includes('&quot;')) {
128
+ return;
129
+ }
130
+ data.value = data.value.replace(/\sstyle="([^"]*)"/gi, (attribute, css) => {
131
+ if (!css.includes('&quot;') || !/font-family/i.test(css)) {
132
+ return attribute;
133
+ }
134
+ const normalized = css.replace(
135
+ // `&quot;` itself ends with `;`, so the entity has to be
136
+ // consumed as a unit or the declaration stops inside it.
137
+ /font-family\s*:(?:&quot;|[^;])*/gi, (declaration) => declaration.includes("'")
138
+ ? declaration
139
+ : declaration.replace(/&quot;/g, "'"));
140
+ return attribute.replace(css, normalized);
141
+ });
142
+ }
116
143
  onSafeHTML(sandBox) {
117
144
  const sanitizer = this.j.o.cleanHTML.sanitizer;
118
145
  if (sanitizer) {
@@ -32,6 +32,15 @@ declare module 'jodit/config' {
32
32
  * it to `''` for form submission.
33
33
  */
34
34
  collapseEmptyValueToEmptyString: boolean;
35
+ /**
36
+ * Browsers serialise quoted font names in a `style` attribute with
37
+ * double quotes, which end up as `&quot;` in the editor value
38
+ * (`font-family: &quot;Open Sans&quot;, sans-serif`). Some back ends
39
+ * HTML-decode the value before storing it and turn that into invalid
40
+ * markup. With this option (default) the value getter rewrites such
41
+ * names with single quotes: `font-family: 'Open Sans', sans-serif`.
42
+ */
43
+ singleQuotesInFontFamily: boolean;
35
44
  /**
36
45
  * Replace old tags to new eg. <i> to <em>, <b> to <strong>
37
46
  */
@@ -11,6 +11,7 @@ Config.prototype.cleanHTML = {
11
11
  removeEmptyElements: true,
12
12
  fillEmptyParagraph: true,
13
13
  collapseEmptyValueToEmptyString: false,
14
+ singleQuotesInFontFamily: true,
14
15
  replaceNBSP: true,
15
16
  replaceOldTags: {
16
17
  i: 'em',
@@ -204,6 +204,7 @@ export class link extends Plugin {
204
204
  jodit.history.snapshot.restore(snapshot);
205
205
  const textWasChanged = getSelectionText() !== content_input.value.trim();
206
206
  const ci = jodit.createInside;
207
+ let caretAfter = null;
207
208
  if (!link || !Dom.isOrContains(jodit.editor, link)) {
208
209
  if (!jodit.s.isCollapsed()) {
209
210
  const node = jodit.s.current();
@@ -218,6 +219,7 @@ export class link extends Plugin {
218
219
  const a = ci.element('a');
219
220
  jodit.s.insertNode(a, false, false);
220
221
  links = [a];
222
+ caretAfter = a;
221
223
  }
222
224
  links.forEach(link => jodit.s.select(link));
223
225
  }
@@ -252,6 +254,13 @@ export class link extends Plugin {
252
254
  }
253
255
  jodit.e.fire('applyLink', jodit, a, form);
254
256
  });
257
+ // A brand-new link inserted at a collapsed caret used to stay
258
+ // *selected*. Safari does not paint that selection, so the next
259
+ // Enter silently replaced the link instead of starting a new line.
260
+ // Put the caret right after the link instead.
261
+ if (caretAfter) {
262
+ jodit.s.setCursorAfter(caretAfter);
263
+ }
255
264
  jodit.synchronizeValues();
256
265
  close();
257
266
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.15.4",
3
+ "version": "4.15.6",
4
4
  "description": "Jodit is an awesome and useful wysiwyg editor with filebrowser",
5
5
  "main": "esm/index.js",
6
6
  "types": "types/index.d.ts",
package/types/config.d.ts CHANGED
@@ -1033,6 +1033,15 @@ interface Config {
1033
1033
  * it to `''` for form submission.
1034
1034
  */
1035
1035
  collapseEmptyValueToEmptyString: boolean;
1036
+ /**
1037
+ * Browsers serialise quoted font names in a `style` attribute with
1038
+ * double quotes, which end up as `&quot;` in the editor value
1039
+ * (`font-family: &quot;Open Sans&quot;, sans-serif`). Some back ends
1040
+ * HTML-decode the value before storing it and turn that into invalid
1041
+ * markup. With this option (default) the value getter rewrites such
1042
+ * names with single quotes: `font-family: 'Open Sans', sans-serif`.
1043
+ */
1044
+ singleQuotesInFontFamily: boolean;
1036
1045
  /**
1037
1046
  * Replace old tags to new eg. <i> to <em>, <b> to <strong>
1038
1047
  */
@@ -42,6 +42,15 @@ export declare class cleanHtml extends Plugin {
42
42
  protected onAfterGetValueFromEditor(data: {
43
43
  value: string;
44
44
  }): void;
45
+ /**
46
+ * Rewrite double-quoted font names inside `style` attributes with single
47
+ * quotes. The DOM always serialises them as `&quot;…&quot;`, and back ends
48
+ * that HTML-decode the value before storing it then produce
49
+ * `style="font-family: "Open Sans", …"` — broken markup. Single quotes
50
+ * survive that round trip. Names that already contain an apostrophe are
51
+ * left alone.
52
+ */
53
+ private __singleQuotesInFontFamily;
45
54
  protected onSafeHTML(sandBox: HTMLElement): void;
46
55
  /** @override */
47
56
  protected beforeDestruct(): void;
@@ -32,6 +32,15 @@ declare module 'jodit/config' {
32
32
  * it to `''` for form submission.
33
33
  */
34
34
  collapseEmptyValueToEmptyString: boolean;
35
+ /**
36
+ * Browsers serialise quoted font names in a `style` attribute with
37
+ * double quotes, which end up as `&quot;` in the editor value
38
+ * (`font-family: &quot;Open Sans&quot;, sans-serif`). Some back ends
39
+ * HTML-decode the value before storing it and turn that into invalid
40
+ * markup. With this option (default) the value getter rewrites such
41
+ * names with single quotes: `font-family: 'Open Sans', sans-serif`.
42
+ */
43
+ singleQuotesInFontFamily: boolean;
35
44
  /**
36
45
  * Replace old tags to new eg. <i> to <em>, <b> to <strong>
37
46
  */