jodit 4.11.13 → 4.11.15
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 +34 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +5 -5
- package/es2015/jodit.js +286 -40
- package/es2015/jodit.min.js +5 -5
- 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 +7 -7
- package/es2018/jodit.min.js +26 -26
- 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 +12 -8
- package/es2021/jodit.js +102 -4
- package/es2021/jodit.min.js +25 -21
- 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 +10 -6
- package/es2021.en/jodit.js +102 -4
- package/es2021.en/jodit.min.js +9 -5
- 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 +403 -47
- 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/request/ajax.d.ts +1 -0
- package/esm/core/request/ajax.js +104 -0
- package/esm/plugins/image-properties/ui/ui-image-main-tab.js +2 -2
- package/esm/types/ajax.d.ts +9 -0
- package/package.json +1 -1
- package/types/core/request/ajax.d.ts +1 -0
- package/types/types/ajax.d.ts +9 -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.11.
|
|
6
|
+
export const APP_VERSION = "4.11.15";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -23,6 +23,7 @@ export declare class Ajax<T extends object = any> implements IAjax<T> {
|
|
|
23
23
|
private __isFulfilled;
|
|
24
24
|
private __activated;
|
|
25
25
|
send(): RejectablePromise<IResponse<T>>;
|
|
26
|
+
stream(): AsyncGenerator<string>;
|
|
26
27
|
prepareRequest(): IRequest;
|
|
27
28
|
private __isDestructed;
|
|
28
29
|
destruct(): void;
|
package/esm/core/request/ajax.js
CHANGED
|
@@ -129,6 +129,110 @@ export class Ajax {
|
|
|
129
129
|
}, 0);
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
+
async *stream() {
|
|
133
|
+
var _a;
|
|
134
|
+
this.__activated = true;
|
|
135
|
+
const { xhr, o } = this;
|
|
136
|
+
const request = this.prepareRequest();
|
|
137
|
+
let lastIndex = 0;
|
|
138
|
+
let buffer = '';
|
|
139
|
+
const queue = [];
|
|
140
|
+
let waitResolve = null;
|
|
141
|
+
let done = false;
|
|
142
|
+
let streamError = null;
|
|
143
|
+
const notify = () => {
|
|
144
|
+
if (waitResolve) {
|
|
145
|
+
const r = waitResolve;
|
|
146
|
+
waitResolve = null;
|
|
147
|
+
r();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const processChunk = (final) => {
|
|
151
|
+
var _a;
|
|
152
|
+
const text = xhr.responseText;
|
|
153
|
+
buffer += text.substring(lastIndex);
|
|
154
|
+
lastIndex = text.length;
|
|
155
|
+
const events = buffer.split('\n\n');
|
|
156
|
+
buffer = final ? '' : ((_a = events.pop()) !== null && _a !== void 0 ? _a : '');
|
|
157
|
+
for (const event of events) {
|
|
158
|
+
const trimmed = event.trim();
|
|
159
|
+
if (!trimmed) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const dataLines = [];
|
|
163
|
+
for (const line of trimmed.split('\n')) {
|
|
164
|
+
if (line.startsWith('data: ')) {
|
|
165
|
+
dataLines.push(line.slice(6));
|
|
166
|
+
}
|
|
167
|
+
else if (line.startsWith('data:')) {
|
|
168
|
+
dataLines.push(line.slice(5));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (dataLines.length) {
|
|
172
|
+
queue.push(dataLines.join('\n'));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
notify();
|
|
176
|
+
};
|
|
177
|
+
xhr.onprogress = () => processChunk(false);
|
|
178
|
+
xhr.onload = () => {
|
|
179
|
+
processChunk(true);
|
|
180
|
+
done = true;
|
|
181
|
+
this.__isFulfilled = true;
|
|
182
|
+
notify();
|
|
183
|
+
};
|
|
184
|
+
xhr.onerror = () => {
|
|
185
|
+
streamError = error.connection('Connection error');
|
|
186
|
+
done = true;
|
|
187
|
+
this.__isFulfilled = true;
|
|
188
|
+
notify();
|
|
189
|
+
};
|
|
190
|
+
xhr.onabort = () => {
|
|
191
|
+
streamError = error.abort('Abort connection');
|
|
192
|
+
done = true;
|
|
193
|
+
this.__isFulfilled = true;
|
|
194
|
+
notify();
|
|
195
|
+
};
|
|
196
|
+
xhr.withCredentials = (_a = o.withCredentials) !== null && _a !== void 0 ? _a : false;
|
|
197
|
+
const { url, data, method } = request;
|
|
198
|
+
xhr.open(method, url, true);
|
|
199
|
+
if (o.contentType && xhr.setRequestHeader) {
|
|
200
|
+
xhr.setRequestHeader('Content-type', o.contentType);
|
|
201
|
+
}
|
|
202
|
+
let { headers } = o;
|
|
203
|
+
if (isFunction(headers)) {
|
|
204
|
+
headers = await headers.call(this);
|
|
205
|
+
}
|
|
206
|
+
if (headers && xhr.setRequestHeader) {
|
|
207
|
+
Object.keys(headers).forEach(key => {
|
|
208
|
+
xhr.setRequestHeader(key, headers[key]);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
xhr.send(data ? this.__buildParams(data) : undefined);
|
|
212
|
+
try {
|
|
213
|
+
while (true) {
|
|
214
|
+
if (queue.length > 0) {
|
|
215
|
+
yield queue.shift();
|
|
216
|
+
}
|
|
217
|
+
else if (done) {
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
await new Promise(r => {
|
|
222
|
+
waitResolve = r;
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
if (!this.__isFulfilled) {
|
|
229
|
+
this.abort();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (streamError) {
|
|
233
|
+
throw streamError;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
132
236
|
prepareRequest() {
|
|
133
237
|
if (!this.o.url) {
|
|
134
238
|
throw error.error('Need URL for AJAX request');
|
|
@@ -37,8 +37,8 @@ let UIImageMainTab = class UIImageMainTab extends UIGroup {
|
|
|
37
37
|
<div class="jodit-input_group">
|
|
38
38
|
<input class="jodit-input &__imageSrc" type="text"/>
|
|
39
39
|
<div class="jodit-input_group-buttons &__fixImage">
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
<a class="jodit-button &__changeImage" data-ref="changeImage">*image*</a>
|
|
41
|
+
<a class="jodit-button &__editImage" data-ref="editImage">*crop*</a>
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
44
44
|
</div>
|
package/esm/types/ajax.d.ts
CHANGED
|
@@ -27,6 +27,15 @@ export interface IAjax<T> extends IDestructible {
|
|
|
27
27
|
o: this['options'];
|
|
28
28
|
abort(): IAjax<T>;
|
|
29
29
|
send(): Promise<IResponse<T>>;
|
|
30
|
+
/**
|
|
31
|
+
* Send request and stream SSE (Server-Sent Events) data incrementally.
|
|
32
|
+
* Uses XHR onprogress to read responseText as it grows,
|
|
33
|
+
* parses SSE `data:` lines and yields each event's data as a string.
|
|
34
|
+
*
|
|
35
|
+
* Aborting the XHR (via abort/destruct) or breaking out of the loop
|
|
36
|
+
* will properly terminate the stream.
|
|
37
|
+
*/
|
|
38
|
+
stream(): AsyncGenerator<string>;
|
|
30
39
|
prepareRequest(): IRequest;
|
|
31
40
|
}
|
|
32
41
|
export interface AjaxOptions {
|
package/package.json
CHANGED
|
@@ -23,6 +23,7 @@ export declare class Ajax<T extends object = any> implements IAjax<T> {
|
|
|
23
23
|
private __isFulfilled;
|
|
24
24
|
private __activated;
|
|
25
25
|
send(): RejectablePromise<IResponse<T>>;
|
|
26
|
+
stream(): AsyncGenerator<string>;
|
|
26
27
|
prepareRequest(): IRequest;
|
|
27
28
|
private __isDestructed;
|
|
28
29
|
destruct(): void;
|
package/types/types/ajax.d.ts
CHANGED
|
@@ -27,6 +27,15 @@ export interface IAjax<T> extends IDestructible {
|
|
|
27
27
|
o: this['options'];
|
|
28
28
|
abort(): IAjax<T>;
|
|
29
29
|
send(): Promise<IResponse<T>>;
|
|
30
|
+
/**
|
|
31
|
+
* Send request and stream SSE (Server-Sent Events) data incrementally.
|
|
32
|
+
* Uses XHR onprogress to read responseText as it grows,
|
|
33
|
+
* parses SSE `data:` lines and yields each event's data as a string.
|
|
34
|
+
*
|
|
35
|
+
* Aborting the XHR (via abort/destruct) or breaking out of the loop
|
|
36
|
+
* will properly terminate the stream.
|
|
37
|
+
*/
|
|
38
|
+
stream(): AsyncGenerator<string>;
|
|
30
39
|
prepareRequest(): IRequest;
|
|
31
40
|
}
|
|
32
41
|
export interface AjaxOptions {
|