jodit 4.18.1 → 4.18.3

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 +30 -0
  2. package/es2015/jodit.css +7 -6
  3. package/es2015/jodit.fat.min.js +10 -10
  4. package/es2015/jodit.js +492 -189
  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 +9 -9
  13. package/es2018/jodit.min.js +9 -9
  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 +7 -6
  17. package/es2021/jodit.fat.min.js +16 -16
  18. package/es2021/jodit.js +432 -135
  19. package/es2021/jodit.min.js +16 -16
  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 +7 -6
  27. package/es2021.en/jodit.fat.min.js +16 -16
  28. package/es2021.en/jodit.js +432 -135
  29. package/es2021.en/jodit.min.js +16 -16
  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 +8 -7
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +555 -215
  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 +4 -2
  51. package/esm/core/constants.js +1 -1
  52. package/esm/core/helpers/utils/index.d.ts +1 -0
  53. package/esm/core/helpers/utils/index.js +1 -0
  54. package/esm/core/helpers/utils/prepare-media.d.ts +19 -0
  55. package/esm/core/helpers/utils/prepare-media.js +31 -0
  56. package/esm/core/selection/style/api/wrap-unwrapped-text.js +3 -2
  57. package/esm/modules/history/history.d.ts +17 -2
  58. package/esm/modules/history/history.js +41 -19
  59. package/esm/modules/table/table.js +7 -2
  60. package/esm/modules/widget/file-selector/file-selector.js +2 -2
  61. package/esm/plugins/backspace/backspace.js +4 -0
  62. package/esm/plugins/clean-html/clean-html.d.ts +9 -1
  63. package/esm/plugins/clean-html/clean-html.js +41 -7
  64. package/esm/plugins/clean-html/helpers/visitor/filters/replace-old-tags.js +26 -1
  65. package/esm/plugins/dtd/before-insert/check-block-nesting.d.ts +2 -1
  66. package/esm/plugins/dtd/before-insert/check-block-nesting.js +26 -5
  67. package/esm/plugins/enter/helpers/move-cursor-out-from-specal-tags.js +8 -0
  68. package/esm/plugins/focus/focus.js +3 -0
  69. package/esm/plugins/hr/hr.js +21 -5
  70. package/esm/plugins/iframe/config.js +8 -3
  71. package/esm/plugins/inline-popup/inline-popup.d.ts +5 -0
  72. package/esm/plugins/inline-popup/inline-popup.js +26 -2
  73. package/esm/plugins/link/link.js +5 -2
  74. package/esm/plugins/media/config.d.ts +2 -1
  75. package/esm/plugins/media/media.js +21 -2
  76. package/esm/plugins/paste/helpers.d.ts +8 -0
  77. package/esm/plugins/paste/helpers.js +18 -1
  78. package/esm/plugins/paste/paste.js +2 -2
  79. package/esm/plugins/resizer/resizer.js +8 -3
  80. package/esm/plugins/select-cells/select-cells.d.ts +10 -0
  81. package/esm/plugins/select-cells/select-cells.js +54 -6
  82. package/esm/plugins/table/config.js +51 -1
  83. package/esm/plugins/table-keyboard-navigation/table-keyboard-navigation.js +1 -1
  84. package/esm/plugins/video/config.js +6 -22
  85. package/package.json +1 -1
  86. package/types/config.d.ts +4 -2
  87. package/types/core/helpers/utils/index.d.ts +1 -0
  88. package/types/core/helpers/utils/prepare-media.d.ts +19 -0
  89. package/types/modules/history/history.d.ts +17 -2
  90. package/types/plugins/clean-html/clean-html.d.ts +9 -1
  91. package/types/plugins/dtd/before-insert/check-block-nesting.d.ts +2 -1
  92. package/types/plugins/inline-popup/inline-popup.d.ts +5 -0
  93. package/types/plugins/media/config.d.ts +2 -1
  94. package/types/plugins/paste/helpers.d.ts +8 -0
  95. package/types/plugins/select-cells/select-cells.d.ts +10 -0
package/types/config.d.ts CHANGED
@@ -989,7 +989,8 @@ interface Config {
989
989
  */
990
990
  maxHistoryLength: number;
991
991
  /**
992
- * Delay on every change
992
+ * How long a step stays open after its first change, in
993
+ * milliseconds. The changes made in that time are undone together.
993
994
  */
994
995
  timeout: number;
995
996
  };
@@ -1597,7 +1598,8 @@ interface Config {
1597
1598
  * - is wrapped in it instead of the editor-only `mediaFakeTag` when its tag
1598
1599
  * is one of `mediaBlocks`, or left in it when it's already in one
1599
1600
  * - goes in inside it when the video popup inserts it, as an upload, a
1600
- * link's embed or embed code that is one element
1601
+ * link's embed or embed code that is one element, and when a pasted
1602
+ * video link is turned into its embed
1601
1603
  * - opens the media popup for its wrapper when clicked, whose Align and
1602
1604
  * Delete act on the wrapper
1603
1605
  *
@@ -28,6 +28,7 @@ export * from "./is-unsafe-proto-key";
28
28
  export * from "./mark-deprecated";
29
29
  export * from "./media-wrapper";
30
30
  export * from "./parse-query";
31
+ export * from "./prepare-media";
31
32
  export * from "./print";
32
33
  export * from "./reset";
33
34
  export * from "./scroll-into-view";
@@ -0,0 +1,19 @@
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
+ import type { IJodit } from "../../../types/index";
10
+ /**
11
+ * Puts new media in its wrapper (see `mediaWrappers`) and aligns it with
12
+ * `mediaDefaultAlign`. Returns the wrapper, or `element` when there is none
13
+ */
14
+ export declare function prepareMedia(jodit: IJodit, element: HTMLElement): HTMLElement;
15
+ /**
16
+ * Embed code that is one element is prepared as media (see `prepareMedia`);
17
+ * other code is returned as it is
18
+ */
19
+ export declare function prepareEmbedCode(jodit: IJodit, code: string): string | HTMLElement;
@@ -21,7 +21,8 @@ declare module 'jodit/config' {
21
21
  */
22
22
  maxHistoryLength: number;
23
23
  /**
24
- * Delay on every change
24
+ * How long a step stays open after its first change, in
25
+ * milliseconds. The changes made in that time are undone together.
25
26
  */
26
27
  timeout: number;
27
28
  };
@@ -52,15 +53,29 @@ export declare class History extends ViewComponent<IJodit> implements IHistory {
52
53
  snapshot: ISnapshot & IDestructible;
53
54
  constructor(editor: IJodit, stack?: Stack, snapshot?: Snapshot);
54
55
  private updateTick;
56
+ /**
57
+ * A step is open: changes have come in that are not in the stack yet
58
+ */
59
+ private __hasPendingChanges;
60
+ /**
61
+ * Records the open step `history.timeout` after its first change
62
+ */
63
+ private __timer;
55
64
  /**
56
65
  * Update change counter
57
66
  * @internal
58
67
  */
59
68
  protected __upTick(): void;
60
69
  /**
61
- * Push new command in stack on some changes
70
+ * Push new command in stack on some changes. The first change opens a
71
+ * step, and later ones join it until `history.timeout` has passed,
72
+ * however close together they come.
62
73
  */
63
74
  private onChange;
75
+ /**
76
+ * Push the open step's changes now
77
+ */
78
+ private __processPendingChanges;
64
79
  /**
65
80
  * @internal
66
81
  */
@@ -14,8 +14,9 @@ import "./config";
14
14
  export declare class cleanHtml extends Plugin {
15
15
  /** @override */
16
16
  buttons: Plugin['buttons'];
17
+ constructor(jodit: IJodit);
17
18
  /** @override */
18
- protected afterInit(jodit: IJodit): void;
19
+ protected afterInit(): void;
19
20
  private get isEditMode();
20
21
  /**
21
22
  * Clean HTML code on every change
@@ -39,6 +40,13 @@ export declare class cleanHtml extends Plugin {
39
40
  protected onBeforeSetNativeEditorValue(data: {
40
41
  value: string;
41
42
  }): boolean;
43
+ /**
44
+ * Replace old tags (`<b>` with `<strong>`, `<i>` with `<em>`) in an
45
+ * assigned value straight away. The walker would get to them only after
46
+ * every node before them, seconds later on a long document, and until
47
+ * then Bold does not treat `<b>` as bold, and the swap can move the caret.
48
+ */
49
+ private __replaceOldTags;
42
50
  /**
43
51
  * Collapse a value that holds only a single empty block (e.g.
44
52
  * `<p><br></p>` left after deleting all content) to an empty string —
@@ -10,7 +10,8 @@
10
10
  import type { IJodit, Nullable } from "../../../types/index";
11
11
  /**
12
12
  * Checks whether the insertion of an element at the current location is allowed,
13
- * if it is not allowed, it deletes an empty block element or moves the cursor after it
13
+ * if it is not allowed, it deletes an empty block element, moves the cursor
14
+ * before or after it, or splits it at the cursor
14
15
  * @internal
15
16
  */
16
17
  export declare function checkBlockNesting(jodit: IJodit, node: Nullable<Node>): void;
@@ -20,6 +20,11 @@ export declare class inlinePopup extends Plugin {
20
20
  private get popup();
21
21
  private get toolbar();
22
22
  private onClick;
23
+ /**
24
+ * The box the popup opens beside: the target's, with room for the
25
+ * resizer's handles when the target gets them, so it doesn't cover them
26
+ */
27
+ private __bound;
23
28
  /**
24
29
  * Show inline popup with some toolbar
25
30
  *
@@ -28,7 +28,8 @@ declare module 'jodit/config' {
28
28
  * - is wrapped in it instead of the editor-only `mediaFakeTag` when its tag
29
29
  * is one of `mediaBlocks`, or left in it when it's already in one
30
30
  * - goes in inside it when the video popup inserts it, as an upload, a
31
- * link's embed or embed code that is one element
31
+ * link's embed or embed code that is one element, and when a pasted
32
+ * video link is turned into its embed
32
33
  * - opens the media popup for its wrapper when clicked, whose Align and
33
34
  * Delete act on the wrapper
34
35
  *
@@ -8,6 +8,14 @@
8
8
  */
9
9
  import type { IDialog, IJodit, InsertMode, IUIOption, Nullable } from "../../types/index";
10
10
  import type { PasteEvent } from "./interface";
11
+ /**
12
+ * Google Docs wraps the copied content in
13
+ * `<b style="font-weight:normal;" id="docs-internal-guid-…">`. Kept, the
14
+ * wrapper holds the pasted blocks, and without its style it makes the whole
15
+ * paste bold
16
+ * @private
17
+ */
18
+ export declare function removeGoogleDocsWrapper(html: string): string;
11
19
  /**
12
20
  * One insert point for clipboard plugins
13
21
  * @private
@@ -52,10 +52,20 @@ export declare class selectCells extends Plugin {
52
52
  * Execute custom commands for table
53
53
  */
54
54
  private onExecCommand;
55
+ /**
56
+ * The cell that takes the caret when rows or columns are deleted: the next
57
+ * one in the same column (or row) that is not deleted, else the previous one
58
+ */
59
+ private __nearestCell;
55
60
  /**
56
61
  * Add some align after native command
57
62
  */
58
63
  private onAfterCommand;
64
+ /**
65
+ * Remove the table and put the caret where it stood: at the start of what
66
+ * follows it, else at the end of what precedes it
67
+ */
68
+ private __removeTable;
59
69
  /** @override */
60
70
  protected beforeDestruct(jodit: IJodit): void;
61
71
  }