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.
- package/CHANGELOG.md +8 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +6 -6
- package/es2015/jodit.js +138 -85
- package/es2015/jodit.min.js +3 -3
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.js +3 -3
- package/es2018/jodit.min.js +3 -3
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +4 -4
- package/es2021/jodit.js +138 -85
- package/es2021/jodit.min.js +4 -4
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.fat.min.js +4 -4
- package/es2021.en/jodit.js +114 -61
- package/es2021.en/jodit.min.js +4 -4
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +162 -88
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/global.d.ts +6 -0
- package/esm/core/global.js +21 -4
- package/esm/core/helpers/html/safe-html.js +26 -0
- package/esm/jodit.d.ts +4 -0
- package/esm/jodit.js +5 -1
- package/esm/languages.js +7 -1
- package/package.json +1 -1
- package/types/core/global.d.ts +6 -0
- package/types/jodit.d.ts +4 -0
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/core/constants.js
CHANGED
|
@@ -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.
|
|
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;
|
package/esm/core/global.d.ts
CHANGED
|
@@ -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/esm/core/global.js
CHANGED
|
@@ -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
|
-
|
|
42
|
-
|
|
51
|
+
const pack = unwrapModule(langs[key]);
|
|
52
|
+
if (isUnsafeProtoKey(key) || !isPlainObject(pack)) {
|
|
53
|
+
return;
|
|
43
54
|
}
|
|
44
|
-
|
|
45
|
-
lang[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
|
-
|
|
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
package/types/core/global.d.ts
CHANGED
|
@@ -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
|
};
|