jodit 4.19.12 → 4.19.14

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 +8 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +6 -6
  4. package/es2015/jodit.js +138 -85
  5. package/es2015/jodit.min.js +3 -3
  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 +3 -3
  13. package/es2018/jodit.min.js +3 -3
  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 +138 -85
  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 +114 -61
  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 +162 -88
  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/core/constants.js +1 -1
  51. package/esm/core/global.d.ts +6 -0
  52. package/esm/core/global.js +21 -4
  53. package/esm/core/helpers/html/safe-html.js +26 -0
  54. package/esm/jodit.d.ts +4 -0
  55. package/esm/jodit.js +5 -1
  56. package/esm/languages.js +7 -1
  57. package/package.json +1 -1
  58. package/types/core/global.d.ts +6 -0
  59. package/types/jodit.d.ts +4 -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.19.12
4
+ * Version: v4.19.14
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.19.12
4
+ * Version: v4.19.14
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.19.12
4
+ * Version: v4.19.14
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.19.12
4
+ * Version: v4.19.14
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.19.12
4
+ * Version: v4.19.14
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.19.12
4
+ * Version: v4.19.14
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.19.12
4
+ * Version: v4.19.14
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.19.12
4
+ * Version: v4.19.14
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.19.12
4
+ * Version: v4.19.14
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.19.12";
6
+ export const APP_VERSION = "4.19.14";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -15,6 +15,12 @@ export declare const instances: IDictionary<IJodit>;
15
15
  export declare function uniqueUid(): string;
16
16
  export declare const pluginSystem: PluginSystem;
17
17
  export declare const modules: IDictionary<Function>;
18
+ /**
19
+ * Merge language packs into the global `lang` registry
20
+ *
21
+ * `__proto__`, `constructor` and `prototype` are skipped on both levels, so a
22
+ * pack parsed from untrusted JSON cannot reach `Object.prototype` (CWE-1321).
23
+ */
18
24
  export declare const extendLang: (langs: IDictionary) => void;
19
25
  /**
20
26
  * Create unique box(HTMLCotainer) and remove it after destroy
@@ -4,12 +4,14 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { isJoditObject } from "./helpers/checker/is-jodit-object.js";
7
+ import { isPlainObject } from "./helpers/checker/is-plain-object.js";
7
8
  import { isString } from "./helpers/checker/is-string.js";
8
9
  import { isViewObject } from "./helpers/checker/is-view-object.js";
9
10
  import { kebabCase } from "./helpers/string/kebab-case.js";
10
11
  import { attr } from "./helpers/utils/attr.js";
11
12
  import { css } from "./helpers/utils/css.js";
12
13
  import { getClassName } from "./helpers/utils/get-class-name.js";
14
+ import { isUnsafeProtoKey } from "./helpers/utils/is-unsafe-proto-key.js";
13
15
  import { PluginSystem } from "./plugin/plugin-system.js";
14
16
  import { eventEmitter as globalEventEmitter } from "./event-emitter/global.js";
15
17
  import { lang } from "./constants.js";
@@ -36,14 +38,29 @@ export const pluginSystem = new PluginSystem({
36
38
  getContainer
37
39
  });
38
40
  export const modules = {};
41
+ // A CommonJS pack imported as a namespace carries the dictionary in `default`; a translation of the word is a string
42
+ const unwrapModule = (pack) => isPlainObject(pack) && isPlainObject(pack.default) ? pack.default : pack;
43
+ /**
44
+ * Merge language packs into the global `lang` registry
45
+ *
46
+ * `__proto__`, `constructor` and `prototype` are skipped on both levels, so a
47
+ * pack parsed from untrusted JSON cannot reach `Object.prototype` (CWE-1321).
48
+ */
39
49
  export const extendLang = (langs) => {
40
50
  Object.keys(langs).forEach(key => {
41
- if (lang[key]) {
42
- Object.assign(lang[key], langs[key]);
51
+ const pack = unwrapModule(langs[key]);
52
+ if (isUnsafeProtoKey(key) || !isPlainObject(pack)) {
53
+ return;
43
54
  }
44
- else {
45
- lang[key] = langs[key];
55
+ if (!Object.prototype.hasOwnProperty.call(lang, key) ||
56
+ !isPlainObject(lang[key])) {
57
+ lang[key] = {};
46
58
  }
59
+ Object.keys(pack).forEach(name => {
60
+ if (!isUnsafeProtoKey(name)) {
61
+ lang[key][name] = pack[name];
62
+ }
63
+ });
47
64
  });
48
65
  };
49
66
  const boxes = new WeakMap();
@@ -139,6 +139,18 @@ const URL_ATTRIBUTES = [
139
139
  'background',
140
140
  'xlink:href'
141
141
  ];
142
+ /**
143
+ * SVG animation elements can write a URL attribute at run time, as
144
+ * `<animate attributeName="href" values="javascript:…">` does, and the
145
+ * attributes below carry the values they write.
146
+ */
147
+ const ANIMATION_TAGS = new Set([
148
+ 'animate',
149
+ 'set',
150
+ 'animatemotion',
151
+ 'animatetransform'
152
+ ]);
153
+ const ANIMATION_VALUE_ATTRIBUTES = ['values', 'from', 'to', 'by'];
142
154
  /**
143
155
  * Tags that load their URL as a *document* (scripts inside run). An SVG data
144
156
  * URL is only an XSS vector here — as an `<img>` source it renders inertly.
@@ -209,6 +221,20 @@ export function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError, re
209
221
  effected = true;
210
222
  }
211
223
  }
224
+ // SMIL sets the attribute on click time, after the static check above:
225
+ // `<svg><a><animate attributeName="href" values="javascript:…">` ran
226
+ // in Chromium and Safari. Drop the values that hold a dangerous
227
+ // scheme; `values` is a `;` list. See GHSA-6wrw-v5gj-6xg7
228
+ if (ANIMATION_TAGS.has(tagName)) {
229
+ for (const name of ANIMATION_VALUE_ATTRIBUTES) {
230
+ const value = attrRaw(elm, name);
231
+ if (value &&
232
+ value.split(';').some(part => isDangerousUrl(part, 'a'))) {
233
+ attr(elm, name, null);
234
+ effected = true;
235
+ }
236
+ }
237
+ }
212
238
  }
213
239
  return effected;
214
240
  }
package/esm/jodit.d.ts CHANGED
@@ -131,6 +131,10 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
131
131
  static readonly constants: typeof constants;
132
132
  static readonly instances: IDictionary<IJodit>;
133
133
  static readonly lang: any;
134
+ /**
135
+ * Merge language packs into `Jodit.lang`; prototype keys are ignored
136
+ */
137
+ static readonly extendLang: (langs: IDictionary) => void;
134
138
  static readonly core: {
135
139
  Plugin: typeof Modules.Plugin;
136
140
  };
package/esm/jodit.js CHANGED
@@ -17,7 +17,7 @@ var Jodit_1;
17
17
  import * as constants from "./core/constants.js";
18
18
  import { FAT_MODE, IS_PROD, KEY_BACKSPACE, KEY_DELETE, KEY_ENTER, lang } from "./core/constants.js";
19
19
  import { autobind, cache, cached, derive, throttle, watch } from "./core/decorators/index.js";
20
- import { eventEmitter, instances, modules, pluginSystem } from "./core/global.js";
20
+ import { eventEmitter, extendLang, instances, modules, pluginSystem } from "./core/global.js";
21
21
  import { asArray, attr, callPromise, ConfigMerge, ConfigProto, css, error, isFunction, isJoditObject, isNumber, isPromise, isString, isVoid, kebabCase, markAsAtomic, normalizeKeyAliases, resolveElement, toArray, ucfirst } from "./core/helpers/index.js";
22
22
  import { removeEmptyMarkedTags } from "./core/helpers/html/tag-scan.js";
23
23
  import { cssInline } from "./core/helpers/utils/css.js";
@@ -1404,6 +1404,10 @@ Jodit.decorators = {};
1404
1404
  Jodit.constants = constants;
1405
1405
  Jodit.instances = instances;
1406
1406
  Jodit.lang = lang;
1407
+ /**
1408
+ * Merge language packs into `Jodit.lang`; prototype keys are ignored
1409
+ */
1410
+ Jodit.extendLang = extendLang;
1407
1411
  Jodit.core = {
1408
1412
  Plugin
1409
1413
  };
package/esm/languages.js CHANGED
@@ -4,6 +4,7 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { isArray } from "./core/helpers/checker/is-array.js";
7
+ import { isPlainObject } from "./core/helpers/checker/is-plain-object.js";
7
8
  import ar from "./langs/ar.js";
8
9
  import az from "./langs/az.js";
9
10
  import cs_cz from "./langs/cs_cz.js";
@@ -63,7 +64,12 @@ exp = {
63
64
  zh_tw
64
65
  };
65
66
  /* Unpack array to hash */
66
- const get = (value) => value ? value.default || value : {}, hashLang = {};
67
+ // Unwrap a module (`default` is the dictionary or the packed array), but keep a dictionary whose `default` is a translation (`no.js`)
68
+ const get = (value) => value
69
+ ? isArray(value.default) || isPlainObject(value.default)
70
+ ? value.default
71
+ : value
72
+ : {}, hashLang = {};
67
73
  if (isArray(get(keys))) {
68
74
  get(keys).forEach((key, index) => {
69
75
  hashLang[index] = key;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.19.12",
3
+ "version": "4.19.14",
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",
@@ -15,6 +15,12 @@ export declare const instances: IDictionary<IJodit>;
15
15
  export declare function uniqueUid(): string;
16
16
  export declare const pluginSystem: PluginSystem;
17
17
  export declare const modules: IDictionary<Function>;
18
+ /**
19
+ * Merge language packs into the global `lang` registry
20
+ *
21
+ * `__proto__`, `constructor` and `prototype` are skipped on both levels, so a
22
+ * pack parsed from untrusted JSON cannot reach `Object.prototype` (CWE-1321).
23
+ */
18
24
  export declare const extendLang: (langs: IDictionary) => void;
19
25
  /**
20
26
  * Create unique box(HTMLCotainer) and remove it after destroy
package/types/jodit.d.ts CHANGED
@@ -131,6 +131,10 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
131
131
  static readonly constants: typeof constants;
132
132
  static readonly instances: IDictionary<IJodit>;
133
133
  static readonly lang: any;
134
+ /**
135
+ * Merge language packs into `Jodit.lang`; prototype keys are ignored
136
+ */
137
+ static readonly extendLang: (langs: IDictionary) => void;
134
138
  static readonly core: {
135
139
  Plugin: typeof Modules.Plugin;
136
140
  };