jodit 4.15.3 → 4.15.5
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 +12 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +4 -4
- package/es2015/jodit.js +90 -27
- package/es2015/jodit.min.js +6 -6
- 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 +4 -4
- package/es2018/jodit.min.js +6 -6
- 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 +89 -27
- package/es2021/jodit.min.js +6 -6
- 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 +89 -27
- package/es2021.en/jodit.min.js +11 -11
- 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 +118 -48
- 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/config.d.ts +9 -0
- package/esm/core/constants.js +1 -1
- package/esm/modules/file-browser/data-provider.d.ts +9 -0
- package/esm/modules/file-browser/data-provider.js +45 -3
- package/esm/plugins/clean-html/clean-html.d.ts +9 -0
- package/esm/plugins/clean-html/clean-html.js +27 -0
- package/esm/plugins/clean-html/config.d.ts +9 -0
- package/esm/plugins/clean-html/config.js +1 -0
- package/package.json +1 -1
- package/types/config.d.ts +9 -0
- package/types/modules/file-browser/data-provider.d.ts +9 -0
- package/types/plugins/clean-html/clean-html.d.ts +9 -0
- package/types/plugins/clean-html/config.d.ts +9 -0
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
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 `"` in the editor value
|
|
1039
|
+
* (`font-family: "Open Sans", 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
|
*/
|
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.15.
|
|
6
|
+
export const APP_VERSION = "4.15.5";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { IFileBrowserAnswer, IFileBrowserDataProvider, IFileBrowserDataProviderItemsMods, IFileBrowserItem, IFileBrowserOptions, ImageBox, IPermissions, ISourcesFiles, IViewBased, Nullable } from "../../types/index";
|
|
10
10
|
export declare const DEFAULT_SOURCE_NAME = "default";
|
|
11
|
+
/**
|
|
12
|
+
* Validate the connector answer for the `files` / `folders` actions and
|
|
13
|
+
* normalise it. A hand-written backend that returns the wrong shape used to
|
|
14
|
+
* crash deep inside the UI with a bare `TypeError: ... reading 'forEach'`;
|
|
15
|
+
* now it fails right here with a message that names the action, the option
|
|
16
|
+
* and the missing field. Missing `files` / `folders` lists are treated as
|
|
17
|
+
* empty instead of throwing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function assertSourcesAnswer(resp: unknown, action: 'files' | 'folders', option: 'items' | 'folder'): IFileBrowserAnswer;
|
|
11
20
|
export default class DataProvider implements IFileBrowserDataProvider {
|
|
12
21
|
readonly parent: IViewBased;
|
|
13
22
|
readonly options: IFileBrowserOptions;
|
|
@@ -15,7 +15,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
15
15
|
};
|
|
16
16
|
import { IS_PROD } from "../../core/constants.js";
|
|
17
17
|
import { autobind } from "../../core/decorators/autobind/autobind.js";
|
|
18
|
+
import { isArray } from "../../core/helpers/checker/is-array.js";
|
|
18
19
|
import { isFunction } from "../../core/helpers/checker/is-function.js";
|
|
20
|
+
import { isPlainObject } from "../../core/helpers/checker/is-plain-object.js";
|
|
19
21
|
import { normalizeRelativePath } from "../../core/helpers/normalize/normalize-relative-path.js";
|
|
20
22
|
import { ConfigProto } from "../../core/helpers/utils/config-proto.js";
|
|
21
23
|
import { abort, error } from "../../core/helpers/utils/error/index.js";
|
|
@@ -38,6 +40,43 @@ const possibleRules = new Set([
|
|
|
38
40
|
'allowImageResize',
|
|
39
41
|
'allowImageCrop'
|
|
40
42
|
]);
|
|
43
|
+
const DOCS_URL = 'https://xdsoft.net/jodit/docs/modules/file_browser.html';
|
|
44
|
+
/**
|
|
45
|
+
* Validate the connector answer for the `files` / `folders` actions and
|
|
46
|
+
* normalise it. A hand-written backend that returns the wrong shape used to
|
|
47
|
+
* crash deep inside the UI with a bare `TypeError: ... reading 'forEach'`;
|
|
48
|
+
* now it fails right here with a message that names the action, the option
|
|
49
|
+
* and the missing field. Missing `files` / `folders` lists are treated as
|
|
50
|
+
* empty instead of throwing.
|
|
51
|
+
*/
|
|
52
|
+
export function assertSourcesAnswer(resp, action, option) {
|
|
53
|
+
const fail = (what) => {
|
|
54
|
+
throw new Error(`File browser: the connector answer for action "${action}" (option "filebrowser.${option}") ${what}. See ${DOCS_URL}`);
|
|
55
|
+
};
|
|
56
|
+
if (!isPlainObject(resp) || !isPlainObject(resp.data)) {
|
|
57
|
+
return fail('has no "data" object');
|
|
58
|
+
}
|
|
59
|
+
const { sources } = resp.data;
|
|
60
|
+
if (!isArray(sources)) {
|
|
61
|
+
return fail(sources === undefined
|
|
62
|
+
? 'has no "data.sources" array'
|
|
63
|
+
: `must contain "data.sources" as an array of sources, got ${isPlainObject(sources)
|
|
64
|
+
? 'an object keyed by source name'
|
|
65
|
+
: typeof sources}`);
|
|
66
|
+
}
|
|
67
|
+
sources.forEach((source, index) => {
|
|
68
|
+
if (!isPlainObject(source)) {
|
|
69
|
+
return fail(`has a non-object entry at "data.sources[${index}]"`);
|
|
70
|
+
}
|
|
71
|
+
if (!isArray(source.files)) {
|
|
72
|
+
source.files = [];
|
|
73
|
+
}
|
|
74
|
+
if (!isArray(source.folders)) {
|
|
75
|
+
source.folders = [];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return resp;
|
|
79
|
+
}
|
|
41
80
|
export default class DataProvider {
|
|
42
81
|
constructor(parent, options) {
|
|
43
82
|
this.parent = parent;
|
|
@@ -100,6 +139,7 @@ export default class DataProvider {
|
|
|
100
139
|
this.o.permissions.data.source = source;
|
|
101
140
|
if (this.o.permissions.url) {
|
|
102
141
|
return this.get('permissions').then(resp => {
|
|
142
|
+
var _a;
|
|
103
143
|
if (this.parent.isInDestruct) {
|
|
104
144
|
throw abort();
|
|
105
145
|
}
|
|
@@ -109,7 +149,9 @@ export default class DataProvider {
|
|
|
109
149
|
}
|
|
110
150
|
if (process) {
|
|
111
151
|
const respData = process.call(self, resp);
|
|
112
|
-
|
|
152
|
+
// The permissions answer is optional and may come back without
|
|
153
|
+
// a `data` object at all from a minimal backend.
|
|
154
|
+
if ((_a = respData === null || respData === void 0 ? void 0 : respData.data) === null || _a === void 0 ? void 0 : _a.permissions) {
|
|
113
155
|
this.parent.events.fire(this, 'changePermissions', this.__currentPermissions, respData.data.permissions);
|
|
114
156
|
this.__currentPermissions = respData.data.permissions;
|
|
115
157
|
}
|
|
@@ -150,7 +192,7 @@ export default class DataProvider {
|
|
|
150
192
|
if (process) {
|
|
151
193
|
resp = process.call(self, resp);
|
|
152
194
|
}
|
|
153
|
-
return onResult(resp);
|
|
195
|
+
return onResult(assertSourcesAnswer(resp, 'files', 'items'));
|
|
154
196
|
});
|
|
155
197
|
}
|
|
156
198
|
/**
|
|
@@ -216,7 +258,7 @@ export default class DataProvider {
|
|
|
216
258
|
if (process) {
|
|
217
259
|
resp = process.call(self, resp);
|
|
218
260
|
}
|
|
219
|
-
return resp.data.sources;
|
|
261
|
+
return assertSourcesAnswer(resp, 'folders', 'folder').data.sources;
|
|
220
262
|
});
|
|
221
263
|
}
|
|
222
264
|
/**
|
|
@@ -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 `"…"`, 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 `"…"`, 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('"')) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
data.value = data.value.replace(/\sstyle="([^"]*)"/gi, (attribute, css) => {
|
|
131
|
+
if (!css.includes('"') || !/font-family/i.test(css)) {
|
|
132
|
+
return attribute;
|
|
133
|
+
}
|
|
134
|
+
const normalized = css.replace(
|
|
135
|
+
// `"` itself ends with `;`, so the entity has to be
|
|
136
|
+
// consumed as a unit or the declaration stops inside it.
|
|
137
|
+
/font-family\s*:(?:"|[^;])*/gi, (declaration) => declaration.includes("'")
|
|
138
|
+
? declaration
|
|
139
|
+
: declaration.replace(/"/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 `"` in the editor value
|
|
38
|
+
* (`font-family: "Open Sans", 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
|
*/
|
package/package.json
CHANGED
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 `"` in the editor value
|
|
1039
|
+
* (`font-family: "Open Sans", 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
|
*/
|
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { IFileBrowserAnswer, IFileBrowserDataProvider, IFileBrowserDataProviderItemsMods, IFileBrowserItem, IFileBrowserOptions, ImageBox, IPermissions, ISourcesFiles, IViewBased, Nullable } from "../../types/index";
|
|
10
10
|
export declare const DEFAULT_SOURCE_NAME = "default";
|
|
11
|
+
/**
|
|
12
|
+
* Validate the connector answer for the `files` / `folders` actions and
|
|
13
|
+
* normalise it. A hand-written backend that returns the wrong shape used to
|
|
14
|
+
* crash deep inside the UI with a bare `TypeError: ... reading 'forEach'`;
|
|
15
|
+
* now it fails right here with a message that names the action, the option
|
|
16
|
+
* and the missing field. Missing `files` / `folders` lists are treated as
|
|
17
|
+
* empty instead of throwing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function assertSourcesAnswer(resp: unknown, action: 'files' | 'folders', option: 'items' | 'folder'): IFileBrowserAnswer;
|
|
11
20
|
export default class DataProvider implements IFileBrowserDataProvider {
|
|
12
21
|
readonly parent: IViewBased;
|
|
13
22
|
readonly options: IFileBrowserOptions;
|
|
@@ -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 `"…"`, 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 `"` in the editor value
|
|
38
|
+
* (`font-family: "Open Sans", 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
|
*/
|