jodit 4.12.23 → 4.12.25

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 (79) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +8 -8
  4. package/es2015/jodit.js +145 -20
  5. package/es2015/jodit.min.js +7 -7
  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 +8 -8
  13. package/es2018/jodit.min.js +7 -7
  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 +8 -8
  18. package/es2021/jodit.js +144 -20
  19. package/es2021/jodit.min.js +7 -7
  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 +7 -7
  28. package/es2021.en/jodit.js +144 -20
  29. package/es2021.en/jodit.min.js +8 -8
  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 +191 -52
  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/config.d.ts +30 -0
  51. package/esm/core/constants.js +1 -1
  52. package/esm/modules/image-editor/image-editor.js +5 -0
  53. package/esm/modules/uploader/helpers/send-files.js +9 -0
  54. package/esm/plugins/backspace/backspace.js +7 -3
  55. package/esm/plugins/backspace/cases/index.d.ts +19 -3
  56. package/esm/plugins/backspace/cases/index.js +18 -13
  57. package/esm/plugins/backspace/config.d.ts +15 -0
  58. package/esm/plugins/clean-html/clean-html.d.ts +8 -0
  59. package/esm/plugins/clean-html/clean-html.js +16 -0
  60. package/esm/plugins/clean-html/config.d.ts +9 -0
  61. package/esm/plugins/clean-html/config.js +1 -0
  62. package/esm/plugins/font/config.js +19 -0
  63. package/esm/plugins/link/config.d.ts +6 -0
  64. package/esm/plugins/link/config.js +1 -0
  65. package/esm/plugins/link/link.js +8 -1
  66. package/esm/plugins/link/template.js +10 -1
  67. package/esm/plugins/select-cells/select-cells.d.ts +1 -1
  68. package/esm/plugins/select-cells/select-cells.js +29 -2
  69. package/esm/plugins/source/config.js +1 -1
  70. package/esm/types/uploader.d.ts +23 -0
  71. package/package.json +1 -1
  72. package/types/config.d.ts +30 -0
  73. package/types/plugins/backspace/cases/index.d.ts +19 -3
  74. package/types/plugins/backspace/config.d.ts +15 -0
  75. package/types/plugins/clean-html/clean-html.d.ts +8 -0
  76. package/types/plugins/clean-html/config.d.ts +9 -0
  77. package/types/plugins/link/config.d.ts +6 -0
  78. package/types/plugins/select-cells/select-cells.d.ts +1 -1
  79. package/types/types/uploader.d.ts +23 -0
@@ -3,9 +3,25 @@
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
- import { checkRemoveChar } from "./check-remove-char";
7
- import { checkRemoveContentNotEditable } from "./check-remove-content-not-editable";
6
+ /**
7
+ * @module plugins/backspace
8
+ */
9
+ import type { IJodit } from "../../../types/index";
10
+ import type { DeleteMode } from "../interface";
11
+ type CaseFn = (jodit: IJodit, fakeNode: any, backspace: boolean, mode: DeleteMode) => void | boolean;
12
+ /**
13
+ * Ordered delete/backspace cases with stable keys. The first one returning
14
+ * `true` wins. The keys are stable across minified builds (function names are
15
+ * mangled by terser) so they can be referenced by `delete.disableCases`.
16
+ * @private
17
+ */
18
+ export declare const casesMap: ReadonlyArray<readonly [
19
+ string,
20
+ CaseFn
21
+ ]>;
8
22
  /**
9
23
  * @private
24
+ * @deprecated Use `casesMap` to also get the stable case keys.
10
25
  */
11
- export declare const cases: (typeof checkRemoveContentNotEditable | typeof checkRemoveChar)[];
26
+ export declare const cases: CaseFn[];
27
+ export {};
@@ -17,6 +17,21 @@ declare module 'jodit/config' {
17
17
  backspaceWord: string[];
18
18
  backspaceSentence: string[];
19
19
  };
20
+ /**
21
+ * Disable specific Backspace/Delete cleanup cases by their stable
22
+ * key, so the plugin no longer applies that particular behavior.
23
+ * Available keys: `remove-unbreakable`, `remove-not-editable`,
24
+ * `remove-char`, `table-cell`, `remove-empty-parent`,
25
+ * `remove-empty-neighbor`, `join-two-lists`, `join-neighbors`,
26
+ * `unwrap-first-list-item`.
27
+ *
28
+ * ```javascript
29
+ * Jodit.make('#editor', {
30
+ * delete: { disableCases: new Set(['remove-empty-parent']) }
31
+ * });
32
+ * ```
33
+ */
34
+ disableCases?: Set<string>;
20
35
  };
21
36
  }
22
37
  }
@@ -34,6 +34,14 @@ export declare class cleanHtml extends Plugin {
34
34
  protected onBeforeSetNativeEditorValue(data: {
35
35
  value: string;
36
36
  }): boolean;
37
+ /**
38
+ * Collapse a value that holds only a single empty block (e.g.
39
+ * `<p><br></p>` left after deleting all content) to an empty string —
40
+ * opt-in via `cleanHTML.collapseEmptyValueToEmptyString`. See #1149
41
+ */
42
+ protected onAfterGetValueFromEditor(data: {
43
+ value: string;
44
+ }): void;
37
45
  protected onSafeHTML(sandBox: HTMLElement): void;
38
46
  /** @override */
39
47
  protected beforeDestruct(): void;
@@ -23,6 +23,15 @@ declare module 'jodit/config' {
23
23
  * Remove empty elements
24
24
  */
25
25
  removeEmptyElements: boolean;
26
+ /**
27
+ * Return an empty string from `editor.value` (and the synced source
28
+ * element) when the editor holds only a single empty block — e.g.
29
+ * `<p><br></p>` left after the user deletes all the content.
30
+ * `contenteditable` keeps that caret container in the DOM, so by
31
+ * default the value getter returns it as-is; enable this to collapse
32
+ * it to `''` for form submission.
33
+ */
34
+ collapseEmptyValueToEmptyString: boolean;
26
35
  /**
27
36
  * Replace old tags to new eg. <i> to <em>, <b> to <strong>
28
37
  */
@@ -39,6 +39,12 @@ declare module 'jodit/config' {
39
39
  * Default value for the `Open in new tab` checkbox when inserting a new link.
40
40
  */
41
41
  openInNewTabCheckboxDefaultChecked: boolean;
42
+ /**
43
+ * Show an `aria-label` text input in the link dialog so an
44
+ * accessible name can be set on the `<a>` (useful when several
45
+ * links share the same visible text, e.g. "here"). Default: false.
46
+ */
47
+ ariaLabelInput: boolean;
42
48
  /**
43
49
  * Use an input text to ask the classname or a select or not ask
44
50
  */
@@ -29,7 +29,7 @@ export declare class selectCells extends Plugin {
29
29
  /**
30
30
  * Mouse click inside the table
31
31
  */
32
- protected onStartSelection(cell: HTMLTableCellElement): void | false;
32
+ protected onStartSelection(cell: HTMLTableCellElement, event?: MouseEvent): void | false;
33
33
  protected onOutsideClick(): void;
34
34
  protected onChange(): void;
35
35
  /**
@@ -80,6 +80,29 @@ export interface IUploaderOptions<T> {
80
80
  getDisplayName(this: T, baseurl: string, filename: string): string;
81
81
  pathVariableName: string;
82
82
  withCredentials: boolean;
83
+ /**
84
+ * Called with the list of files right before they are uploaded (or read as
85
+ * base64). Return `false` to abort the whole upload — useful for client
86
+ * side validation (size, type, count). Throwing an Error also aborts and
87
+ * routes the message through the uploader error handler.
88
+ *
89
+ * ```javascript
90
+ * Jodit.make('#editor', {
91
+ * uploader: {
92
+ * url: '...',
93
+ * beforeUpload(files) {
94
+ * for (const file of files) {
95
+ * if (file.size > 2 * 1024 * 1024) {
96
+ * this.jodit.message.error('Max 2MB');
97
+ * return false;
98
+ * }
99
+ * }
100
+ * }
101
+ * }
102
+ * });
103
+ * ```
104
+ */
105
+ beforeUpload?: (this: T, files: File[]) => boolean | void;
83
106
  prepareData: (this: T, formData: FormData) => any;
84
107
  buildData?: (this: T, formData: any) => BuildDataResult;
85
108
  queryBuild?: (obj: string | IDictionary<string | object> | FormData, prefix?: string) => string | FormData;