jodit 4.17.6 → 4.18.1

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 (102) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/es2015/jodit.css +87 -3
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +8 -8
  5. package/es2015/jodit.js +808 -132
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +16 -16
  8. package/es2015/plugins/debug/debug.css +1 -1
  9. package/es2015/plugins/debug/debug.js +1 -1
  10. package/es2015/plugins/debug/debug.min.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +8 -8
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +8 -8
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +87 -3
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +14 -14
  23. package/es2021/jodit.js +788 -132
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +14 -14
  26. package/es2021/plugins/debug/debug.css +1 -1
  27. package/es2021/plugins/debug/debug.js +1 -1
  28. package/es2021/plugins/debug/debug.min.js +1 -1
  29. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  32. package/es2021.en/jodit.css +87 -3
  33. package/es2021.en/jodit.fat.min.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +26 -26
  35. package/es2021.en/jodit.js +788 -132
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +12 -12
  38. package/es2021.en/plugins/debug/debug.css +1 -1
  39. package/es2021.en/plugins/debug/debug.js +1 -1
  40. package/es2021.en/plugins/debug/debug.min.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  44. package/es5/jodit.css +92 -6
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +1073 -192
  48. package/es5/jodit.min.css +3 -3
  49. package/es5/jodit.min.js +2 -2
  50. package/es5/plugins/debug/debug.css +1 -1
  51. package/es5/plugins/debug/debug.js +1 -1
  52. package/es5/plugins/debug/debug.min.js +1 -1
  53. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  56. package/es5/polyfills.fat.min.js +1 -1
  57. package/es5/polyfills.js +1 -1
  58. package/es5/polyfills.min.js +1 -1
  59. package/esm/config.d.ts +65 -2
  60. package/esm/config.js +29 -2
  61. package/esm/core/constants.js +1 -1
  62. package/esm/core/helpers/utils/align.d.ts +11 -5
  63. package/esm/core/helpers/utils/align.js +28 -8
  64. package/esm/core/helpers/utils/index.d.ts +1 -0
  65. package/esm/core/helpers/utils/index.js +1 -0
  66. package/esm/core/helpers/utils/media-wrapper.d.ts +29 -0
  67. package/esm/core/helpers/utils/media-wrapper.js +63 -0
  68. package/esm/core/selection/selection.js +3 -3
  69. package/esm/modules/toolbar/button/button.d.ts +18 -0
  70. package/esm/modules/toolbar/button/button.js +75 -5
  71. package/esm/plugins/dtd/after-insert/remove-extra-br.js +6 -1
  72. package/esm/plugins/dtd/before-insert/check-block-nesting.js +16 -1
  73. package/esm/plugins/dtd/config.js +3 -0
  74. package/esm/plugins/font/config.d.ts +12 -0
  75. package/esm/plugins/font/config.js +25 -10
  76. package/esm/plugins/font/font-picker.d.ts +51 -0
  77. package/esm/plugins/font/font-picker.js +238 -0
  78. package/esm/plugins/font/font.js +12 -0
  79. package/esm/plugins/font/google-fonts.d.ts +65 -0
  80. package/esm/plugins/font/google-fonts.js +143 -0
  81. package/esm/plugins/image-properties/readers/index.js +2 -1
  82. package/esm/plugins/image-properties/writers/index.js +2 -2
  83. package/esm/plugins/inline-popup/config/items/img.js +10 -8
  84. package/esm/plugins/inline-popup/inline-popup.js +13 -6
  85. package/esm/plugins/media/config.d.ts +26 -1
  86. package/esm/plugins/media/config.js +1 -3
  87. package/esm/plugins/media/media.js +12 -4
  88. package/esm/plugins/video/config.js +24 -4
  89. package/esm/types/toolbar.d.ts +2 -0
  90. package/esm/types/types.d.ts +13 -1
  91. package/package.json +1 -1
  92. package/types/config.d.ts +65 -2
  93. package/types/core/helpers/utils/align.d.ts +11 -5
  94. package/types/core/helpers/utils/index.d.ts +1 -0
  95. package/types/core/helpers/utils/media-wrapper.d.ts +29 -0
  96. package/types/modules/toolbar/button/button.d.ts +18 -0
  97. package/types/plugins/font/config.d.ts +12 -0
  98. package/types/plugins/font/font-picker.d.ts +51 -0
  99. package/types/plugins/font/google-fonts.d.ts +65 -0
  100. package/types/plugins/media/config.d.ts +26 -1
  101. package/types/types/toolbar.d.ts +2 -0
  102. package/types/types/types.d.ts +13 -1
@@ -77,6 +77,23 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
77
77
  * `ArrowUp` on the first item close it and give the focus back to the button
78
78
  */
79
79
  private __onPopupKeyDown;
80
+ /**
81
+ * The mouse opens a dropdown without taking the focus out of the editor.
82
+ * While a dropdown list is open, typing there searches the list, as in an
83
+ * open `<select>`, instead of writing into the content
84
+ */
85
+ private __onEditorKeyDown;
86
+ private __typed;
87
+ private __typedAt;
88
+ private __typedTo;
89
+ /**
90
+ * Typing in a dropdown list focuses the next item whose label starts with
91
+ * the typed text, whatever their case and accents, and repeating one letter
92
+ * cycles through the items that start with it, like the WAI-ARIA menu
93
+ * pattern's type-ahead. The typed text starts again after a pause, or once
94
+ * the focus has moved on
95
+ */
96
+ private __typeAhead;
80
97
  /**
81
98
  * Visible controls of the opened dropdown that can take the focus
82
99
  */
@@ -86,6 +103,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
86
103
  * Create an open popup list
87
104
  */
88
105
  private __openControlList;
106
+ private __openMenu;
89
107
  protected onOutsideClick(e: MouseEvent): void;
90
108
  private openPopup;
91
109
  private __closePopup;
@@ -6,6 +6,18 @@
6
6
  declare module 'jodit/config' {
7
7
  interface Config {
8
8
  defaultFontSizePoints: 'px' | 'pt';
9
+ font: {
10
+ googleFonts: {
11
+ /**
12
+ * Adds the Google Fonts library to the font family dropdown, which then
13
+ * also lists the theme's fonts and the fonts the content uses. The
14
+ * address answers with the JSON of the Google Fonts Developer API:
15
+ * the API itself (`https://www.googleapis.com/webfonts/v1/webfonts?key=…`)
16
+ * or a proxy of it. Empty leaves the dropdown as it is
17
+ */
18
+ url: string;
19
+ };
20
+ };
9
21
  }
10
22
  }
11
23
  export {};
@@ -0,0 +1,51 @@
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 plugins/font
8
+ */
9
+ import type { IJodit, IToolbarButton } from "../../types/index";
10
+ import { UIElement } from "../../core/ui/element";
11
+ /**
12
+ * The font family dropdown with Google Fonts. Under their own headings it
13
+ * lists the fonts the editor's styles give text and headings, the fonts the
14
+ * content uses, the control's list and the Google Fonts library
15
+ */
16
+ export declare class UIFontPicker extends UIElement<IJodit> {
17
+ private readonly __button;
18
+ private readonly __close;
19
+ className(): string;
20
+ private readonly __googleFonts;
21
+ private readonly __fonts;
22
+ private __observer;
23
+ constructor(jodit: IJodit, __button: IToolbarButton, __close: () => void);
24
+ private __render;
25
+ /**
26
+ * The fonts the editor's styles give text and each heading
27
+ */
28
+ private __themeFonts;
29
+ /**
30
+ * The fonts the content sets
31
+ */
32
+ private __usedFonts;
33
+ private __append;
34
+ /**
35
+ * Shows the names of the Google Fonts in view, and those just below it,
36
+ * in their own fonts. Setting every item's font up front would have the
37
+ * browser look for each of the library's families among the installed
38
+ * fonts the first time the list opens
39
+ */
40
+ private __observeGoogleFonts;
41
+ /**
42
+ * Keeps the editor's selection, as the toolbar buttons do
43
+ */
44
+ protected onMouseDown(e: MouseEvent): void;
45
+ protected onClick(e: MouseEvent): void;
46
+ /**
47
+ * The font the selected text has without a font of its own: its block's
48
+ */
49
+ private __blockFont;
50
+ destruct(): void;
51
+ }
@@ -0,0 +1,65 @@
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 plugins/font
8
+ */
9
+ import type { IJodit } from "../../types/index";
10
+ import { ViewComponent } from "../../core/component/view-component";
11
+ /**
12
+ * A font as the Google Fonts Developer API describes it
13
+ */
14
+ export interface IGoogleFont {
15
+ family: string;
16
+ category: string;
17
+ variants: string[];
18
+ }
19
+ /**
20
+ * The first family of a `font-family` value, unquoted and in lower case for
21
+ * comparing
22
+ */
23
+ export declare function firstFamily(fontFamily: string): string;
24
+ /**
25
+ * Loads fonts from Google Fonts: the whole of each font the content uses into
26
+ * the editor's document, and just the letters of its name for the font list
27
+ */
28
+ export declare class GoogleFonts extends ViewComponent<IJodit> {
29
+ className(): string;
30
+ /**
31
+ * The library by lower-case family, empty until it arrives
32
+ */
33
+ readonly fonts: Map<string, IGoogleFont>;
34
+ readonly ready: Promise<void>;
35
+ private readonly __links;
36
+ private readonly __loaded;
37
+ private readonly __previewed;
38
+ constructor(jodit: IJodit);
39
+ /**
40
+ * The library's font named first in a `font-family` value
41
+ */
42
+ find(fontFamily: string): IGoogleFont | undefined;
43
+ /**
44
+ * The `font-family` value that applies a font
45
+ */
46
+ value(font: IGoogleFont): string;
47
+ /**
48
+ * Loads the regular, italic, bold and bold italic styles that a font has
49
+ * into the editor's document
50
+ */
51
+ load(font: IGoogleFont): void;
52
+ /**
53
+ * Loads every font of the library that the content uses
54
+ */
55
+ loadUsed(): void;
56
+ /**
57
+ * Loads into the page just the letters of each font's name, so the font
58
+ * list can show the name in its font
59
+ */
60
+ preview(fonts: IGoogleFont[]): void;
61
+ private __loadedInto;
62
+ private __family;
63
+ private __append;
64
+ destruct(): void;
65
+ }
@@ -3,6 +3,10 @@
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
+ /**
7
+ * @module plugins/media
8
+ */
9
+ import type { IDictionary, MediaWrapper } from "../../types/index";
6
10
  declare module 'jodit/config' {
7
11
  interface Config {
8
12
  /**
@@ -17,6 +21,27 @@ declare module 'jodit/config' {
17
21
  * Media tags
18
22
  */
19
23
  mediaBlocks: string[];
24
+ /**
25
+ * Wrappers that media keep in the content, by the media's tag name, such as
26
+ * Froala's `<span class="fr-video">` around video, audio and embeds. An
27
+ * element with a wrapper for its tag:
28
+ * - is wrapped in it instead of the editor-only `mediaFakeTag` when its tag
29
+ * is one of `mediaBlocks`, or left in it when it's already in one
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
32
+ * - opens the media popup for its wrapper when clicked, whose Align and
33
+ * Delete act on the wrapper
34
+ *
35
+ * A wrapper is given `contenteditable="false"` and `draggable="true"`,
36
+ * which stay in the value.
37
+ * ```javascript
38
+ * const frVideo = { tag: 'span', className: 'fr-video' };
39
+ *
40
+ * Jodit.make('#editor', {
41
+ * mediaWrappers: { video: frVideo, audio: frVideo, iframe: frVideo }
42
+ * });
43
+ * ```
44
+ */
45
+ mediaWrappers: IDictionary<MediaWrapper>;
20
46
  }
21
47
  }
22
- export {};
@@ -193,6 +193,8 @@ interface IControlType<T extends IViewBased = IJodit | IViewBased | IFileBrowser
193
193
  childTemplate?: (jodit: T, key: string, value: string, button: IToolbarButton) => string;
194
194
  /**
195
195
  * After click on the button it will show popup element which consist value that this function returned
196
+ * For a control with a `list`, the returned content replaces the list's buttons in its dropdown,
197
+ * and `false` keeps them
196
198
  * @example
197
199
  * ```javascript
198
200
  * var editor = Jodit.make('.editor', {
@@ -187,10 +187,22 @@ export interface ImageEditorOptions {
187
187
  export type InsertMode = 'insert_as_html' | 'insert_as_text' | 'insert_clear_html' | 'insert_only_text';
188
188
  export type ImageAction = 'resize' | 'crop';
189
189
  export type ImageHAlign = 'normal' | 'left' | 'right' | 'center' | '';
190
+ /**
191
+ * Class names for each alignment, see `alignClasses`. An alignment can list
192
+ * several sets of class names to recognise; aligning writes the first
193
+ */
194
+ export type HAlignClasses = Partial<Record<Exclude<ImageHAlign, ''>, string | string[]>>;
190
195
  /**
191
196
  * Class names for each image alignment, see `imageAlignClasses`
192
197
  */
193
- export type ImageAlignClasses = Partial<Record<Exclude<ImageHAlign, ''>, string>>;
198
+ export type ImageAlignClasses = HAlignClasses;
199
+ /**
200
+ * A wrapper that media keep in the content, see `mediaWrappers`
201
+ */
202
+ export interface MediaWrapper {
203
+ tag: string;
204
+ className: string;
205
+ }
194
206
  export interface ImageBox {
195
207
  w: number;
196
208
  h: number;