jodit 4.16.1 → 4.17.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 (71) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +7 -7
  4. package/es2015/jodit.js +173 -34
  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 +7 -7
  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 +165 -33
  19. package/es2021/jodit.min.js +8 -8
  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 +8 -8
  28. package/es2021.en/jodit.js +165 -33
  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 +182 -34
  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 +40 -1
  51. package/esm/core/constants.js +1 -1
  52. package/esm/core/helpers/html/safe-html.d.ts +1 -1
  53. package/esm/core/helpers/html/safe-html.js +8 -1
  54. package/esm/modules/widget/file-selector/file-selector.d.ts +10 -1
  55. package/esm/modules/widget/file-selector/file-selector.js +30 -18
  56. package/esm/plugins/drag-and-drop/drag-and-drop.js +16 -4
  57. package/esm/plugins/file/file.d.ts +24 -1
  58. package/esm/plugins/file/file.js +17 -1
  59. package/esm/plugins/inline-popup/config/items/img.js +22 -1
  60. package/esm/plugins/source/editor/engines/ace.js +2 -1
  61. package/esm/plugins/source/source.d.ts +17 -0
  62. package/esm/plugins/source/source.js +60 -8
  63. package/esm/plugins/video/config.d.ts +21 -1
  64. package/esm/plugins/video/config.js +22 -2
  65. package/package.json +1 -1
  66. package/types/config.d.ts +40 -1
  67. package/types/core/helpers/html/safe-html.d.ts +1 -1
  68. package/types/modules/widget/file-selector/file-selector.d.ts +10 -1
  69. package/types/plugins/file/file.d.ts +24 -1
  70. package/types/plugins/source/source.d.ts +17 -0
  71. package/types/plugins/video/config.d.ts +21 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.16.1",
3
+ "version": "4.17.1",
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",
package/types/config.d.ts CHANGED
@@ -8,9 +8,10 @@ import type { HTMLTagNames } from "./types/index";
8
8
  import type { AiAssistantSettings } from "./plugins/ai-assistant/interface";
9
9
  import type { IDictionary } from "./types/index";
10
10
  import type { Nullable } from "./types/index";
11
+ import type { IJodit } from "./types/index";
12
+ import type { IUploaderData } from "./types/index";
11
13
  import type { ImagePropertiesOptions } from "./plugins/image-properties/interface";
12
14
  import type { IControlType } from "./types/index";
13
- import type { IJodit } from "./types/index";
14
15
  import type { formTemplate } from "./plugins/link/template";
15
16
  import type { IUIForm } from "./types/index";
16
17
  import type { IUIOption } from "./types/index";
@@ -1264,6 +1265,27 @@ interface Config {
1264
1265
  blockLimits: IDictionary<1>;
1265
1266
  };
1266
1267
  }
1268
+ interface Config {
1269
+ file: {
1270
+ /**
1271
+ * Inserts the files uploaded from the file popup's Upload tab. By default
1272
+ * each one goes in as a link, an image as well, the way
1273
+ * `uploader.defaultHandlerSuccess` inserts a file that isn't an image.
1274
+ * ```javascript
1275
+ * Jodit.make('#editor', {
1276
+ * file: {
1277
+ * defaultHandlerSuccess(data) {
1278
+ * data.files.forEach(file => {
1279
+ * this.s.insertHTML(`<a class="file" href="${data.baseurl + file}">${file}</a>`);
1280
+ * });
1281
+ * }
1282
+ * }
1283
+ * });
1284
+ * ```
1285
+ */
1286
+ defaultHandlerSuccess?: (this: IJodit, data: IUploaderData) => void;
1287
+ };
1288
+ }
1267
1289
  interface Config {
1268
1290
  autofocus: boolean;
1269
1291
  cursorAfterAutofocus: 'start' | 'end';
@@ -1971,6 +1993,23 @@ interface Config {
1971
1993
  * Default height for video iframe. Default: 345
1972
1994
  */
1973
1995
  defaultHeight?: number;
1996
+ /**
1997
+ * Inserts the videos uploaded from the popup's Upload tab, which is shown
1998
+ * when `uploader.url` or `uploader.customUploadFunction` is set. By default
1999
+ * each one goes in as `<video controls src="…">`.
2000
+ * ```javascript
2001
+ * Jodit.make('#editor', {
2002
+ * video: {
2003
+ * defaultHandlerSuccess(data) {
2004
+ * data.files.forEach(file => {
2005
+ * this.s.insertHTML(`<video controls preload="metadata" src="${data.baseurl + file}"></video>`);
2006
+ * });
2007
+ * }
2008
+ * }
2009
+ * });
2010
+ * ```
2011
+ */
2012
+ defaultHandlerSuccess?: (this: IJodit, data: IUploaderData) => void;
1974
2013
  };
1975
2014
  }
1976
2015
  interface Config {
@@ -13,4 +13,4 @@ export type safeOptions = {
13
13
  * Removes dangerous constructs from HTML
14
14
  */
15
15
  export declare function safeHTML(box: HTMLElement | DocumentFragment, options: safeOptions): void;
16
- export declare function sanitizeHTMLElement(elm: Element | DocumentFragment, { safeJavaScriptLink, removeOnError }?: safeOptions): boolean;
16
+ export declare function sanitizeHTMLElement(elm: Element | DocumentFragment, { safeJavaScriptLink, removeOnError, removeEventAttributes }?: safeOptions): boolean;
@@ -8,7 +8,8 @@
8
8
  * @packageDocumentation
9
9
  * @module modules/widget/file-selector
10
10
  */
11
- import type { IFileBrowserCallBackData, IJodit } from "../../../types/index";
11
+ import type { IFileBrowserCallBackData, IJodit, IUploaderData } from "../../../types/index";
12
+ import { type TabOption } from "../tabs/tabs";
12
13
  interface ImageSelectorCallbacks {
13
14
  /**
14
15
  * Function that will be called when the user enters the URL of the tab image and alternative text for images
@@ -34,4 +35,12 @@ interface ImageSelectorCallbacks {
34
35
  * functions with different parameters
35
36
  */
36
37
  export declare const FileSelectorWidget: (editor: IJodit, callbacks: ImageSelectorCallbacks, elm: HTMLElement | null, close: () => void, isImage?: boolean) => HTMLDivElement;
38
+ /**
39
+ * The Upload tab: a box that uploads the files dropped on it or chosen in its
40
+ * file input, then passes the uploader's answer to `onSuccess` and closes the popup
41
+ */
42
+ export declare const UploadTab: (editor: IJodit, onSuccess: (this: IJodit, data: IUploaderData) => void, { label, accept }: {
43
+ label: string;
44
+ accept: string;
45
+ }) => TabOption;
37
46
  export {};
@@ -8,5 +8,28 @@
8
8
  * @packageDocumentation
9
9
  * @module plugins/file
10
10
  */
11
- import type { IJodit } from "../../types/index";
11
+ import type { IJodit, IUploaderData } from "../../types/index";
12
+ declare module 'jodit/config' {
13
+ interface Config {
14
+ file: {
15
+ /**
16
+ * Inserts the files uploaded from the file popup's Upload tab. By default
17
+ * each one goes in as a link, an image as well, the way
18
+ * `uploader.defaultHandlerSuccess` inserts a file that isn't an image.
19
+ * ```javascript
20
+ * Jodit.make('#editor', {
21
+ * file: {
22
+ * defaultHandlerSuccess(data) {
23
+ * data.files.forEach(file => {
24
+ * this.s.insertHTML(`<a class="file" href="${data.baseurl + file}">${file}</a>`);
25
+ * });
26
+ * }
27
+ * }
28
+ * });
29
+ * ```
30
+ */
31
+ defaultHandlerSuccess?: (this: IJodit, data: IUploaderData) => void;
32
+ };
33
+ }
34
+ }
12
35
  export declare function file(editor: IJodit): void;
@@ -21,6 +21,11 @@ export declare class source extends Plugin {
21
21
  private mirrorContainer;
22
22
  private __lock;
23
23
  private __oldMirrorValue;
24
+ /**
25
+ * What the source view was last filled with from WYSIWYG, read back from
26
+ * the editor; while the view still holds it, nothing has been typed there
27
+ */
28
+ private __filledValue;
24
29
  private tempMarkerStart;
25
30
  private tempMarkerStartReg;
26
31
  private tempMarkerEnd;
@@ -50,6 +55,18 @@ export declare class source extends Plugin {
50
55
  afterInit(editor: IJodit): void;
51
56
  private syncValueFromWYSIWYG;
52
57
  private initSourceEditor;
58
+ /**
59
+ * Replaces the source editor (the textarea shown while ACE loads) with
60
+ * the one that just became ready, carrying its text, selection and focus
61
+ * over. Filling the new editor from WYSIWYG instead would drop what was
62
+ * typed since the last, debounced, sync and normalise half-typed markup.
63
+ */
64
+ private takeOver;
65
+ /**
66
+ * The beautifier arrived after the source view was opened: format the
67
+ * view if nothing has been typed into it, otherwise leave the typing alone
68
+ */
69
+ private beautifyUntouched;
53
70
  /** @override */
54
71
  beforeDestruct(): void;
55
72
  }
@@ -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/video
8
+ */
9
+ import type { IJodit, IUploaderData } from "../../types/index";
6
10
  declare module 'jodit/config' {
7
11
  interface Config {
8
12
  video: {
@@ -29,7 +33,23 @@ declare module 'jodit/config' {
29
33
  * Default height for video iframe. Default: 345
30
34
  */
31
35
  defaultHeight?: number;
36
+ /**
37
+ * Inserts the videos uploaded from the popup's Upload tab, which is shown
38
+ * when `uploader.url` or `uploader.customUploadFunction` is set. By default
39
+ * each one goes in as `<video controls src="…">`.
40
+ * ```javascript
41
+ * Jodit.make('#editor', {
42
+ * video: {
43
+ * defaultHandlerSuccess(data) {
44
+ * data.files.forEach(file => {
45
+ * this.s.insertHTML(`<video controls preload="metadata" src="${data.baseurl + file}"></video>`);
46
+ * });
47
+ * }
48
+ * }
49
+ * });
50
+ * ```
51
+ */
52
+ defaultHandlerSuccess?: (this: IJodit, data: IUploaderData) => void;
32
53
  };
33
54
  }
34
55
  }
35
- export {};