jodit 4.19.6 → 4.19.8

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 (95) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +10 -10
  4. package/es2015/jodit.js +787 -200
  5. package/es2015/jodit.min.js +10 -10
  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 +10 -10
  13. package/es2018/jodit.min.js +10 -10
  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 +12 -12
  18. package/es2021/jodit.js +709 -143
  19. package/es2021/jodit.min.js +12 -12
  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 +18 -18
  28. package/es2021.en/jodit.js +709 -143
  29. package/es2021.en/jodit.min.js +18 -18
  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 +947 -208
  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.d.ts +1 -0
  51. package/esm/core/constants.js +3 -1
  52. package/esm/core/helpers/utils/error/error.d.ts +1 -0
  53. package/esm/core/helpers/utils/error/error.js +4 -1
  54. package/esm/core/helpers/utils/error/errors/answer-error.d.ts +13 -0
  55. package/esm/core/helpers/utils/error/errors/answer-error.js +17 -0
  56. package/esm/core/helpers/utils/error/errors/index.d.ts +1 -0
  57. package/esm/core/helpers/utils/error/errors/index.js +1 -0
  58. package/esm/core/request/ajax.d.ts +1 -0
  59. package/esm/core/request/ajax.js +20 -1
  60. package/esm/core/selection/style/apply-style.js +31 -2
  61. package/esm/jodit.js +14 -2
  62. package/esm/modules/file-browser/data-provider.js +5 -3
  63. package/esm/modules/uploader/config.js +4 -0
  64. package/esm/modules/uploader/helpers/send-files.d.ts +2 -2
  65. package/esm/modules/uploader/helpers/send-files.js +76 -9
  66. package/esm/modules/uploader/helpers/upload-error.d.ts +15 -0
  67. package/esm/modules/uploader/helpers/upload-error.js +16 -0
  68. package/esm/modules/uploader/uploader.js +15 -3
  69. package/esm/plugins/backspace/cases/check-join-neighbors.js +36 -7
  70. package/esm/plugins/backspace/cases/check-remove-empty-parent.js +3 -1
  71. package/esm/plugins/bold/bold.js +4 -1
  72. package/esm/plugins/delete/delete.d.ts +12 -0
  73. package/esm/plugins/delete/delete.js +50 -1
  74. package/esm/plugins/resize-cells/resize-cells.d.ts +25 -1
  75. package/esm/plugins/resize-cells/resize-cells.js +84 -15
  76. package/esm/plugins/select/select.d.ts +35 -0
  77. package/esm/plugins/select/select.js +153 -1
  78. package/esm/plugins/select-cells/select-cells.d.ts +24 -0
  79. package/esm/plugins/select-cells/select-cells.js +81 -18
  80. package/esm/types/style.d.ts +5 -0
  81. package/esm/types/uploader.d.ts +117 -11
  82. package/package.json +2 -2
  83. package/types/core/constants.d.ts +1 -0
  84. package/types/core/helpers/utils/error/error.d.ts +1 -0
  85. package/types/core/helpers/utils/error/errors/answer-error.d.ts +13 -0
  86. package/types/core/helpers/utils/error/errors/index.d.ts +1 -0
  87. package/types/core/request/ajax.d.ts +1 -0
  88. package/types/modules/uploader/helpers/send-files.d.ts +2 -2
  89. package/types/modules/uploader/helpers/upload-error.d.ts +15 -0
  90. package/types/plugins/delete/delete.d.ts +12 -0
  91. package/types/plugins/resize-cells/resize-cells.d.ts +25 -1
  92. package/types/plugins/select/select.d.ts +35 -0
  93. package/types/plugins/select-cells/select-cells.d.ts +24 -0
  94. package/types/types/style.d.ts +5 -0
  95. package/types/types/uploader.d.ts +117 -11
@@ -23,7 +23,6 @@ import { isMoved } from "../../core/selection/helpers/index.js";
23
23
  import { Table } from "../../modules/table/table.js";
24
24
  import "./config.js";
25
25
  const key = 'table_processor_observer';
26
- const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
27
26
  export class selectCells extends Plugin {
28
27
  constructor() {
29
28
  super(...arguments);
@@ -44,6 +43,15 @@ export class selectCells extends Plugin {
44
43
  * User is selecting cells now
45
44
  */
46
45
  this.__isSelectionMode = false;
46
+ /**
47
+ * The cell the marks were last drawn to
48
+ */
49
+ this.__movedTo = null;
50
+ /**
51
+ * A drag let go outside the table ends in a click on the editor, which
52
+ * would unmark its cells
53
+ */
54
+ this.__keepMarks = false;
47
55
  }
48
56
  /**
49
57
  * Shortcut for Jodit.modules.Table
@@ -59,6 +67,7 @@ export class selectCells extends Plugin {
59
67
  // Handlers without a namespace run first, ahead of those that
60
68
  // move the caret, as table-keyboard-navigation's do
61
69
  .on('keydown', this.__onKeyDown, { top: true })
70
+ .on('clickEditor', this.__onClickAfterDrag, { top: true })
62
71
  .on('keydown.select-cells', (event) => {
63
72
  if (event.key === KEY_TAB) {
64
73
  this.unselectCells();
@@ -192,21 +201,36 @@ export class selectCells extends Plugin {
192
201
  }
193
202
  this.__isSelectionMode = true;
194
203
  this.__selectedCell = cell;
204
+ this.__movedTo = cell;
195
205
  this.__tableModule.addSelection(cell);
196
206
  this.j.e
197
- .on(table, 'mousemove.select-cells touchmove.select-cells',
198
- // Don't use decorator because need clear label on mouseup
199
- this.j.async.throttle(this.__onMove.bind(this, table), {
200
- label: MOUSE_MOVE_LABEL,
201
- timeout: this.j.defaultTimeout / 2
202
- }))
207
+ .on(table, 'mousemove.select-cells touchmove.select-cells', this.__onMove.bind(this, table))
203
208
  .on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
209
+ new Set([this.j.ew, this.j.ow]).forEach(win => this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', this.__onRelease.bind(this, table)));
204
210
  return false;
205
211
  }
206
212
  onOutsideClick() {
207
213
  this.__selectedCell = null;
208
214
  this.__onRemoveSelection();
209
215
  }
216
+ onMouseDown() {
217
+ this.__keepMarks = false;
218
+ }
219
+ /**
220
+ * The click that ends a drag let go outside the table, and inside the
221
+ * editor, lands on the editor. Taken on, it would unmark the cells and
222
+ * close their popup. As for the click on a row after a drag over the
223
+ * cells, the browser's own selection from the drag goes
224
+ */
225
+ __onClickAfterDrag() {
226
+ var _a;
227
+ if (this.__keepMarks) {
228
+ this.__keepMarks = false;
229
+ (_a = this.j.s.sel) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
230
+ this.j.e.stopPropagation('clickEditor');
231
+ return false;
232
+ }
233
+ }
210
234
  onChange() {
211
235
  if (!this.j.isLocked && !this.__isSelectionMode) {
212
236
  this.__onRemoveSelection();
@@ -226,13 +250,17 @@ export class selectCells extends Plugin {
226
250
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
227
251
  // host, so the lookup must start from the shadow root
228
252
  const node = ((_a = this.j.o.shadowRoot) !== null && _a !== void 0 ? _a : this.j.ed).elementFromPoint(e.clientX, e.clientY);
229
- if (!node) {
253
+ const cell = node && Dom.closest(node, ['td', 'th'], table);
254
+ if (!cell || !this.__selectedCell) {
230
255
  return;
231
256
  }
232
- const cell = Dom.closest(node, ['td', 'th'], table);
233
- if (!cell || !this.__selectedCell) {
257
+ // The marks change only when the mouse goes into another cell, and then
258
+ // at once rather than throttled, as the browser's own selection from
259
+ // the drag shows in the cells between until they do (#1778)
260
+ if (cell === this.__movedTo) {
234
261
  return;
235
262
  }
263
+ this.__movedTo = cell;
236
264
  if (cell !== this.__selectedCell) {
237
265
  this.j.lock(key);
238
266
  }
@@ -273,7 +301,7 @@ export class selectCells extends Plugin {
273
301
  * Stop a selection process
274
302
  */
275
303
  __onStopSelection(table, e) {
276
- var _a, _b, _c;
304
+ var _a;
277
305
  if (!this.__selectedCell) {
278
306
  return;
279
307
  }
@@ -293,11 +321,33 @@ export class selectCells extends Plugin {
293
321
  if (ownTable && ownTable !== table) {
294
322
  return; // Nested tables
295
323
  }
296
- const bound = this.__tableModule.getSelectedBound(table, [
297
- cell,
298
- this.__selectedCell
299
- ]), box = this.__tableModule.formalMatrix(table);
300
- const max = (_b = box[bound[1][0]]) === null || _b === void 0 ? void 0 : _b[bound[1][1]], min = (_c = box[bound[0][0]]) === null || _c === void 0 ? void 0 : _c[bound[0][1]];
324
+ this.__showCellsPopup(table, [cell, this.__selectedCell]);
325
+ this.__stopListening();
326
+ }
327
+ /**
328
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
329
+ * the window's ends it, leaving the cells marked as they were (#1774)
330
+ */
331
+ __onRelease(table, e) {
332
+ if (this.__isSelectionMode) {
333
+ this.__isSelectionMode = false;
334
+ if (!this.j.isLockedNotBy(key)) {
335
+ this.j.unlock();
336
+ }
337
+ const cells = this.__tableModule.getAllSelectedCells();
338
+ // One let go outside the editor clicks outside it, which unmarks them
339
+ if (cells.length > 1 &&
340
+ Dom.isOrContains(this.j.editor, e.target)) {
341
+ this.__keepMarks = true;
342
+ this.__showCellsPopup(table, cells);
343
+ }
344
+ }
345
+ this.__stopListening();
346
+ }
347
+ __showCellsPopup(table, cells) {
348
+ var _a, _b;
349
+ const bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
350
+ const max = (_a = box[bound[1][0]]) === null || _a === void 0 ? void 0 : _a[bound[1][1]], min = (_b = box[bound[0][0]]) === null || _b === void 0 ? void 0 : _b[bound[0][1]];
301
351
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
302
352
  // selected cells belong to this table's matrix — e.g. after a
303
353
  // drag-and-drop that moved/removed the cells, leaving a stale anchor and
@@ -316,10 +366,13 @@ export class selectCells extends Plugin {
316
366
  height: maxOffset.top - minOffset.top + maxOffset.height
317
367
  };
318
368
  }, 'cells');
369
+ }
370
+ __stopListening() {
319
371
  $$('table', this.j.editor).forEach(table => {
320
372
  this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
321
373
  });
322
- this.j.async.clearTimeout(MOUSE_MOVE_LABEL);
374
+ new Set([this.j.ew, this.j.ow]).forEach(win => this.j.e.off(win, 'mouseup.select-cells touchend.select-cells'));
375
+ this.__movedTo = null;
323
376
  }
324
377
  /**
325
378
  * Remove selection for all cells
@@ -504,7 +557,11 @@ export class selectCells extends Plugin {
504
557
  /** @override */
505
558
  beforeDestruct(jodit) {
506
559
  this.__onRemoveSelection();
507
- jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
560
+ this.__stopListening();
561
+ jodit.e
562
+ .off('.select-cells')
563
+ .off('keydown', this.__onKeyDown)
564
+ .off('clickEditor', this.__onClickAfterDrag);
508
565
  }
509
566
  }
510
567
  selectCells.requires = ['select'];
@@ -520,6 +577,12 @@ __decorate([
520
577
  __decorate([
521
578
  watch(':outsideClick')
522
579
  ], selectCells.prototype, "onOutsideClick", null);
580
+ __decorate([
581
+ watch([':mousedown', ':touchstart'])
582
+ ], selectCells.prototype, "onMouseDown", null);
583
+ __decorate([
584
+ autobind
585
+ ], selectCells.prototype, "__onClickAfterDrag", null);
523
586
  __decorate([
524
587
  watch(':change')
525
588
  ], selectCells.prototype, "onChange", null);
@@ -17,6 +17,11 @@ export interface IStyleOptions {
17
17
  element?: HTMLTagNames;
18
18
  attributes?: IAttributes;
19
19
  defaultTag?: HTMLTagNames;
20
+ /**
21
+ * Tags the element takes the place of: the selection is taken out of
22
+ * them first, as subscript and superscript take each other's place
23
+ */
24
+ exclude?: HTMLTagNames[];
20
25
  hooks?: {
21
26
  beforeWrapList?(mode: CommitMode, li: HTMLElement, style: ICommitStyle): void;
22
27
  afterWrapList?(mode: CommitMode, li: HTMLElement, style: ICommitStyle): void;
@@ -10,6 +10,7 @@ import type { CanPromise, IDictionary, IViewComponent } from "./types";
10
10
  import type { IViewBased } from "./view";
11
11
  import type { IAjax } from "./ajax";
12
12
  interface IUploaderData {
13
+ code?: number;
13
14
  messages?: string[];
14
15
  files: string[];
15
16
  isImages?: boolean[];
@@ -29,6 +30,23 @@ interface IUploaderAnswer {
29
30
  data: IUploaderData;
30
31
  }
31
32
  export type HandlerSuccess = (resp: IUploaderData) => void;
33
+ /**
34
+ * Error the handler gets when the connector refused an upload: the answer,
35
+ * its `code`, the sent `files` and `retry` to send them again, changed
36
+ */
37
+ export interface IUploadError extends Error {
38
+ code?: number;
39
+ answer: IUploaderAnswer;
40
+ files: File[];
41
+ retry(plan?: Partial<IUploadPlan>): Promise<unknown>;
42
+ }
43
+ /**
44
+ * What `beforeUpload` decided: the files to send and extra fields of the request
45
+ */
46
+ export interface IUploadPlan {
47
+ files: File[];
48
+ data?: IDictionary<string>;
49
+ }
32
50
  export type HandlerError = (e: Error) => void;
33
51
  export type BuildDataResult = FormData | IDictionary<string> | Promise<FormData | IDictionary<string>> | string;
34
52
  export interface IUploaderOptions<T> {
@@ -103,28 +121,56 @@ export interface IUploaderOptions<T> {
103
121
  pathVariableName: string;
104
122
  withCredentials: boolean;
105
123
  /**
106
- * Called with the list of files right before they are uploaded (or read as
107
- * base64). Return `false` to abort the whole upload — useful for client
108
- * side validation (size, type, count). Throwing an Error also aborts and
109
- * routes the message through the uploader error handler.
124
+ * Called with the files right before they are sent (or read as base64).
125
+ * What it returns decides what happens:
126
+ *
127
+ * - `false` cancels the upload, the error handler gets `Upload canceled`
128
+ * - `undefined` (or `true`) sends the files as they are
129
+ * - an array of `File` sends those files instead, so files can be renamed
130
+ * with `new File([file], 'other.png', { type: file.type })` or left out
131
+ * - an object `{ files, data }` ({@link IUploadPlan}) sends those files
132
+ * and adds the fields of `data` to the request
133
+ * - a promise of any of the above is awaited, so the user can be asked first
134
+ *
135
+ * Throwing an error cancels the upload and routes the message through
136
+ * the error handler.
137
+ *
138
+ * Client-side validation (size, type, count):
110
139
  *
111
140
  * ```javascript
112
141
  * Jodit.make('#editor', {
113
142
  * uploader: {
114
- * url: '...',
143
+ * url: 'https://example.com/connector/?action=fileUpload',
115
144
  * beforeUpload(files) {
116
- * for (const file of files) {
117
- * if (file.size > 2 * 1024 * 1024) {
118
- * this.jodit.message.error('Max 2MB');
119
- * return false;
120
- * }
145
+ * if (files.some(file => file.size > 2 * 1024 * 1024)) {
146
+ * this.j.message.error('Max 2MB');
147
+ * return false;
121
148
  * }
122
149
  * }
123
150
  * }
124
151
  * });
125
152
  * ```
153
+ *
154
+ * Ask the user, say for a target folder the connector takes as a field:
155
+ *
156
+ * ```javascript
157
+ * Jodit.make('#editor', {
158
+ * uploader: {
159
+ * url: 'https://example.com/connector/?action=fileUpload',
160
+ * beforeUpload(files) {
161
+ * return new Promise(resolve =>
162
+ * this.j.prompt('Folder', 'Upload to', folder =>
163
+ * resolve({ files, data: { path: folder } })
164
+ * )
165
+ * );
166
+ * }
167
+ * }
168
+ * });
169
+ * ```
170
+ *
171
+ * A name that is already taken is not this hook's job: see `promptOnExists`.
126
172
  */
127
- beforeUpload?: (this: T, files: File[]) => boolean | void;
173
+ beforeUpload?: (this: T, files: File[]) => CanPromise<boolean | void | File[] | IUploadPlan>;
128
174
  prepareData: (this: T, formData: FormData) => any;
129
175
  buildData?: (this: T, formData: any) => BuildDataResult;
130
176
  queryBuild?: (obj: string | IDictionary<string | object> | FormData, prefix?: string) => string | FormData;
@@ -133,7 +179,67 @@ export interface IUploaderOptions<T> {
133
179
  process: (this: T, resp: IUploaderAnswer) => IUploaderData;
134
180
  error: (this: T, e: Error) => void;
135
181
  defaultHandlerSuccess: HandlerSuccess;
182
+ /**
183
+ * Shows a failed upload. When the connector refused it, the error is an
184
+ * {@link IUploadError}: `message` is the connector's text (`getMessage`),
185
+ * `answer` the whole answer, `code` its `data.code`, `files` the files
186
+ * that were sent and `retry(plan)` sends them again with other files or
187
+ * extra request fields, without running `beforeUpload` a second time.
188
+ *
189
+ * Connectors answer `409` when an uploaded name is already taken and
190
+ * `saveSameFileNameStrategy` is `error` (jodit-nodejs 2.1.1, PHP 3.0.61,
191
+ * jodit-python). With `promptOnExists` off, ask the user here:
192
+ *
193
+ * ```javascript
194
+ * Jodit.make('#editor', {
195
+ * uploader: {
196
+ * url: 'https://example.com/connector/?action=fileUpload',
197
+ * promptOnExists: false,
198
+ * defaultHandlerError(e) {
199
+ * if (e.code === 409) {
200
+ * this.j.confirm('Replace?', yes => yes && e.retry({ data: { onExists: 'replace' } }));
201
+ * return;
202
+ * }
203
+ *
204
+ * this.j.message.error(e.message);
205
+ * }
206
+ * }
207
+ * });
208
+ * ```
209
+ *
210
+ * Or keep both files under another name:
211
+ *
212
+ * ```javascript
213
+ * e.retry({
214
+ * files: e.files.map(file => new File([file], 'copy-' + file.name, { type: file.type }))
215
+ * });
216
+ * ```
217
+ */
136
218
  defaultHandlerError: HandlerError;
219
+ /**
220
+ * When the connector answers `409` (the name is already taken), ask the
221
+ * user for another name in a prompt and send the file again under it,
222
+ * before the error handler gets a say: this is part of the upload, not a
223
+ * failure. The prompt comes with `promptOnExistsSuggestName(name)` filled
224
+ * in; Cancel drops the file. A refused batch (the connector stores nothing
225
+ * and does not say which name is taken) is sent again one file at a time,
226
+ * so the free ones are stored and only the taken ones ask.
227
+ *
228
+ * ```javascript
229
+ * Jodit.make('#editor', {
230
+ * uploader: {
231
+ * url: 'https://example.com/connector/?action=fileUpload',
232
+ * promptOnExists: true,
233
+ * promptOnExistsSuggestName: name => name.replace(/(\.\w+)?$/, '-copy$1')
234
+ * }
235
+ * });
236
+ * ```
237
+ */
238
+ promptOnExists: boolean;
239
+ /**
240
+ * The name the `promptOnExists` prompt offers for a taken name. Default: the same name
241
+ */
242
+ promptOnExistsSuggestName: (this: T, name: string) => string;
137
243
  contentType: (this: T, requestData: any) => string | false;
138
244
  /**
139
245
  * This method can be used to replace the function of uploading files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.19.6",
3
+ "version": "4.19.8",
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",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "devDependencies": {},
39
39
  "overrides": {
40
- "qs": "6.16.0"
40
+ "qs": "6.16.1"
41
41
  },
42
42
  "module": "esm/index.js",
43
43
  "dependencies": {}
@@ -130,6 +130,7 @@ export declare const INSERT_AS_TEXT = "insert_as_text";
130
130
  */
131
131
  export declare const INSERT_ONLY_TEXT = "insert_only_text";
132
132
  export declare const SAFE_COUNT_CHANGE_CALL = 10;
133
+ export declare const ERROR_CODE_CONFLICT = 409;
133
134
  export declare const IS_MAC: boolean;
134
135
  export declare const KEY_ALIASES: IDictionary<string>;
135
136
  /**
@@ -9,3 +9,4 @@
9
9
  export declare function error(message: string): Error;
10
10
  export declare function connection(message: string): Error;
11
11
  export declare function options(message: string): Error;
12
+ export declare function answer<T>(message: string, resp: T, code?: number): Error;
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * @module helpers/utils
8
+ */
9
+ export declare class AnswerError<T = unknown> extends Error {
10
+ readonly answer: T;
11
+ readonly code?: number | undefined;
12
+ constructor(message: string, answer: T, code?: number | undefined);
13
+ }
@@ -7,5 +7,6 @@
7
7
  * @module helpers/utils
8
8
  */
9
9
  export * from "./abort-error";
10
+ export * from "./answer-error";
10
11
  export * from "./connection-error";
11
12
  export * from "./options-error";
@@ -21,6 +21,7 @@ export declare class Ajax<T extends object = any> implements IAjax<T> {
21
21
  get o(): this['options'];
22
22
  abort(): Ajax;
23
23
  private __isFulfilled;
24
+ private __hasAnswerEnvelope;
24
25
  private __activated;
25
26
  send(): RejectablePromise<IResponse<T>>;
26
27
  stream(): AsyncGenerator<string>;
@@ -6,8 +6,8 @@
6
6
  /**
7
7
  * @module modules/uploader
8
8
  */
9
- import type { HandlerError, HandlerSuccess, IUploader } from "../../../types/index";
9
+ import type { HandlerError, HandlerSuccess, IUploader, IUploadPlan } from "../../../types/index";
10
10
  /**
11
11
  * Send files to server
12
12
  */
13
- export declare function sendFiles(uploader: IUploader, files: FileList | File[] | null, handlerSuccess?: HandlerSuccess, handlerError?: HandlerError, process?: (form: FormData) => void): Promise<any>;
13
+ export declare function sendFiles(uploader: IUploader, files: FileList | File[] | null, handlerSuccess?: HandlerSuccess, handlerError?: HandlerError, process?: (form: FormData) => void, retryOf?: Partial<IUploadPlan>): Promise<any>;
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * @module modules/uploader
8
+ */
9
+ import type { IUploaderAnswer, IUploadError, IUploadPlan } from "../../../types/index";
10
+ import { AnswerError } from "../../../core/helpers/utils/error/index";
11
+ export declare class UploadError extends AnswerError<IUploaderAnswer> implements IUploadError {
12
+ readonly files: File[];
13
+ readonly retry: (plan?: Partial<IUploadPlan>) => Promise<unknown>;
14
+ constructor(message: string, answer: IUploaderAnswer, files: File[], retry: (plan?: Partial<IUploadPlan>) => Promise<unknown>);
15
+ }
@@ -31,6 +31,18 @@ export declare class deleteCommand extends Plugin {
31
31
  */
32
32
  private __clearSelectedCells;
33
33
  private __moveContentInLeftSibling;
34
+ /**
35
+ * A plain space the deletion leaves at an edge of the block, before a line
36
+ * break or next to another space isn't shown, and the browser drops it when
37
+ * the next char is typed. It becomes non-breaking, as in the browsers' own
38
+ * delete and in Backspace without a selection (#1522)
39
+ */
40
+ private __keepSpacesVisible;
41
+ /**
42
+ * The text, line break or other element next to the caret in its block,
43
+ * looking inside inline elements
44
+ */
45
+ private __findNeighbor;
34
46
  /**
35
47
  * If left sibling is list - return last leaf
36
48
  */
@@ -39,11 +39,24 @@ export declare class resizeCells extends Plugin {
39
39
  private startX;
40
40
  /**
41
41
  * The table's and its cells' styles as a column drag started, put back
42
- * before each new width
42
+ * as it ends, before the final widths
43
43
  */
44
44
  private startStyles;
45
45
  private startLeft;
46
46
  private startEdge;
47
+ /**
48
+ * For each of the two columns a drag resizes, the cell whose width
49
+ * `setColumnWidthByDelta` sets, with its width as the drag started, and
50
+ * the cells below it, whose widths it clears
51
+ */
52
+ private startWidths;
53
+ /**
54
+ * The table's width as the drag started, and for a drag of its edge, the
55
+ * width inside what holds it and its margin on that side
56
+ */
57
+ private startTableWidth;
58
+ private startParentWidth;
59
+ private startMargin;
47
60
  /**
48
61
  * The row whose height the handle sets, or null while it sets a width
49
62
  */
@@ -88,10 +101,21 @@ export declare class resizeCells extends Plugin {
88
101
  * row's scroller in view, scrolls it on, and the row's border with it
89
102
  */
90
103
  private scrollAlong;
104
+ /**
105
+ * The two columns a column drag resizes: the work cell's last, and the
106
+ * next cell's first
107
+ */
108
+ private resizedColumns;
91
109
  /**
92
110
  * Resize only one column
93
111
  */
94
112
  private resizeColumns;
113
+ /**
114
+ * Sets the widths `resizeColumns` would while the handle is dragged, from
115
+ * the widths the drag started with, so that a move doesn't put back every
116
+ * cell's style and lay the table out again to measure them
117
+ */
118
+ private setColumnWidths;
95
119
  /**
96
120
  * Resize whole table
97
121
  */
@@ -46,6 +46,41 @@ export declare class select extends Plugin {
46
46
  * of the end (#1296); move it to the end of the item's own text.
47
47
  */
48
48
  protected onClickRightOfNestedListItem(e: MouseEvent): void;
49
+ /**
50
+ * The row a press to its right was beside, and the caret it put there,
51
+ * while the button is down
52
+ */
53
+ private __pressBesideRow;
54
+ /**
55
+ * The table row the mouse is to the right of
56
+ */
57
+ private __rowBeside;
58
+ /**
59
+ * A press to the right of a table row puts the caret where Word's typing
60
+ * goes from there: the start of the next row's first cell, or of the block
61
+ * after the table for the last row (#1770). The browsers put it after the
62
+ * table, whichever row it's beside, so typing starts a new line below it.
63
+ * Their own press is stopped, as its drag would start after the table and
64
+ * take in the rows below first
65
+ */
66
+ protected onMouseDownBesideTableRow(e: MouseEvent): void;
67
+ /**
68
+ * A drag from beside a row selects from the end of the row to the mouse,
69
+ * and back beside the row it's the caret again
70
+ */
71
+ private __onDragFromRow;
72
+ /**
73
+ * In iframe mode, a press in an editor without the focus puts the caret at
74
+ * its end, so a release that selected nothing puts it back
75
+ */
76
+ private __onReleaseFromRow;
77
+ private __endPressBesideRow;
78
+ /**
79
+ * A double click beside a row is two clicks there, so add-new-line,
80
+ * which adds a line on a double click with a caret, doesn't see it
81
+ */
82
+ private __onDblClickBesideRow;
83
+ private __putCaretBesideRow;
49
84
  /**
50
85
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
51
86
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -49,11 +49,28 @@ export declare class selectCells extends Plugin {
49
49
  * User is selecting cells now
50
50
  */
51
51
  private __isSelectionMode;
52
+ /**
53
+ * The cell the marks were last drawn to
54
+ */
55
+ private __movedTo;
56
+ /**
57
+ * A drag let go outside the table ends in a click on the editor, which
58
+ * would unmark its cells
59
+ */
60
+ private __keepMarks;
52
61
  /**
53
62
  * Mouse click inside the table
54
63
  */
55
64
  protected onStartSelection(cell: HTMLTableCellElement, event?: MouseEvent): void | false;
56
65
  protected onOutsideClick(): void;
66
+ protected onMouseDown(): void;
67
+ /**
68
+ * The click that ends a drag let go outside the table, and inside the
69
+ * editor, lands on the editor. Taken on, it would unmark the cells and
70
+ * close their popup. As for the click on a row after a drag over the
71
+ * cells, the browser's own selection from the drag goes
72
+ */
73
+ private __onClickAfterDrag;
57
74
  protected onChange(): void;
58
75
  /**
59
76
  * Mouse move inside the table
@@ -67,6 +84,13 @@ export declare class selectCells extends Plugin {
67
84
  * Stop a selection process
68
85
  */
69
86
  private __onStopSelection;
87
+ /**
88
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
89
+ * the window's ends it, leaving the cells marked as they were (#1774)
90
+ */
91
+ private __onRelease;
92
+ private __showCellsPopup;
93
+ private __stopListening;
70
94
  /**
71
95
  * Remove selection for all cells
72
96
  */
@@ -17,6 +17,11 @@ export interface IStyleOptions {
17
17
  element?: HTMLTagNames;
18
18
  attributes?: IAttributes;
19
19
  defaultTag?: HTMLTagNames;
20
+ /**
21
+ * Tags the element takes the place of: the selection is taken out of
22
+ * them first, as subscript and superscript take each other's place
23
+ */
24
+ exclude?: HTMLTagNames[];
20
25
  hooks?: {
21
26
  beforeWrapList?(mode: CommitMode, li: HTMLElement, style: ICommitStyle): void;
22
27
  afterWrapList?(mode: CommitMode, li: HTMLElement, style: ICommitStyle): void;