jodit 4.2.39 → 4.2.41

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 (99) hide show
  1. package/CHANGELOG.md +51 -9
  2. package/es2015/jodit.css +7 -1
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +2 -2
  5. package/es2015/jodit.js +85 -54
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +2 -2
  8. package/es2015/plugins/debug/debug.css +53 -0
  9. package/es2015/plugins/debug/debug.js +162 -24
  10. package/es2015/plugins/debug/debug.min.css +1 -0
  11. package/es2015/plugins/debug/debug.min.js +2 -2
  12. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  14. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  15. package/es2018/jodit.css +7 -1
  16. package/es2018/jodit.fat.min.css +1 -1
  17. package/es2018/jodit.fat.min.js +2 -2
  18. package/es2018/jodit.js +85 -54
  19. package/es2018/jodit.min.css +1 -1
  20. package/es2018/jodit.min.js +2 -2
  21. package/es2018/plugins/debug/debug.css +53 -0
  22. package/es2018/plugins/debug/debug.js +162 -24
  23. package/es2018/plugins/debug/debug.min.css +1 -0
  24. package/es2018/plugins/debug/debug.min.js +2 -2
  25. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  26. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  27. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  28. package/es2021/jodit.css +7 -1
  29. package/es2021/jodit.fat.min.css +1 -1
  30. package/es2021/jodit.fat.min.js +2 -2
  31. package/es2021/jodit.js +85 -53
  32. package/es2021/jodit.min.css +1 -1
  33. package/es2021/jodit.min.js +2 -2
  34. package/es2021/plugins/debug/debug.css +53 -0
  35. package/es2021/plugins/debug/debug.js +161 -24
  36. package/es2021/plugins/debug/debug.min.css +1 -0
  37. package/es2021/plugins/debug/debug.min.js +2 -2
  38. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  39. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  40. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  41. package/es2021.en/jodit.css +7 -1
  42. package/es2021.en/jodit.fat.min.css +1 -1
  43. package/es2021.en/jodit.fat.min.js +2 -2
  44. package/es2021.en/jodit.js +85 -53
  45. package/es2021.en/jodit.min.css +1 -1
  46. package/es2021.en/jodit.min.js +2 -2
  47. package/es2021.en/plugins/debug/debug.css +53 -0
  48. package/es2021.en/plugins/debug/debug.js +161 -24
  49. package/es2021.en/plugins/debug/debug.min.css +1 -0
  50. package/es2021.en/plugins/debug/debug.min.js +2 -2
  51. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  52. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  53. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  54. package/es5/164.fat.min.js +1 -1
  55. package/es5/164.min.js +1 -1
  56. package/es5/5.fat.min.js +1 -1
  57. package/es5/5.min.js +1 -1
  58. package/es5/jodit.css +11 -2
  59. package/es5/jodit.fat.min.css +1 -1
  60. package/es5/jodit.fat.min.js +2 -2
  61. package/es5/jodit.js +92 -65
  62. package/es5/jodit.min.css +3 -3
  63. package/es5/jodit.min.js +2 -2
  64. package/es5/plugins/debug/debug.css +53 -0
  65. package/es5/plugins/debug/debug.js +161 -24
  66. package/es5/plugins/debug/debug.min.css +1 -0
  67. package/es5/plugins/debug/debug.min.js +2 -2
  68. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  69. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  70. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  71. package/esm/core/constants.js +1 -1
  72. package/esm/core/helpers/utils/convert-media-url-to-video-embed.d.ts +4 -1
  73. package/esm/core/helpers/utils/convert-media-url-to-video-embed.js +7 -3
  74. package/esm/core/ui/button/tooltip/tooltip.d.ts +1 -0
  75. package/esm/core/ui/button/tooltip/tooltip.js +19 -8
  76. package/esm/core/view/view-with-toolbar.d.ts +1 -0
  77. package/esm/core/view/view-with-toolbar.js +3 -0
  78. package/esm/modules/toolbar/collection/collection.d.ts +0 -1
  79. package/esm/modules/toolbar/collection/collection.js +1 -4
  80. package/esm/plugins/clean-html/config.d.ts +9 -0
  81. package/esm/plugins/debug/debug.d.ts +1 -0
  82. package/esm/plugins/enter/helpers/check-br.js +2 -0
  83. package/esm/plugins/index.js +1 -0
  84. package/esm/plugins/inline-popup/inline-popup.d.ts +0 -1
  85. package/esm/plugins/inline-popup/inline-popup.js +7 -7
  86. package/esm/plugins/link/link.js +6 -2
  87. package/esm/plugins/video/config.d.ts +29 -0
  88. package/esm/plugins/video/config.js +26 -17
  89. package/esm/plugins/wrap-nodes/config.d.ts +5 -1
  90. package/package.json +1 -1
  91. package/types/core/helpers/utils/convert-media-url-to-video-embed.d.ts +4 -1
  92. package/types/core/ui/button/tooltip/tooltip.d.ts +1 -0
  93. package/types/core/view/view-with-toolbar.d.ts +1 -0
  94. package/types/modules/toolbar/collection/collection.d.ts +0 -1
  95. package/types/plugins/clean-html/config.d.ts +9 -0
  96. package/types/plugins/debug/debug.d.ts +1 -0
  97. package/types/plugins/inline-popup/inline-popup.d.ts +0 -1
  98. package/types/plugins/video/config.d.ts +29 -0
  99. package/types/plugins/wrap-nodes/config.d.ts +5 -1
@@ -3,4 +3,33 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
+ declare module 'jodit/config' {
7
+ interface Config {
8
+ video: {
9
+ /**
10
+ * Custom function for parsing video URL to embed code
11
+ * ```javascript
12
+ * Jodit.make('#editor', {
13
+ * video: {
14
+ * // Defaul behavior
15
+ * parseUrlToVideoEmbed: (url, size) => Jodit.modules.Helpers.convertMediaUrlToVideoEmbed(url, size)
16
+ * }
17
+ * });
18
+ * ```
19
+ */
20
+ parseUrlToVideoEmbed?: (url: string, { width, height }?: {
21
+ width?: number;
22
+ height?: number;
23
+ }) => string;
24
+ /**
25
+ * Default width for video iframe. Default: 400
26
+ */
27
+ defaultWidth?: number;
28
+ /**
29
+ * Default height for video iframe. Default: 345
30
+ */
31
+ defaultHeight?: number;
32
+ };
33
+ }
34
+ }
6
35
  export {};
@@ -3,19 +3,24 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import { convertMediaUrlToVideoEmbed } from "../../core/helpers/index.js";
6
+ import { call, convertMediaUrlToVideoEmbed } from "../../core/helpers/index.js";
7
7
  import { Button } from "../../core/ui/button/index.js";
8
8
  import { UIBlock, UIForm, UIInput, UITextArea } from "../../core/ui/form/index.js";
9
9
  import { Icon } from "../../core/ui/icon.js";
10
10
  import { Config } from "../../config.js";
11
11
  import { TabsWidget } from "../../modules/widget/index.js";
12
12
  import videoIcon from "./video.svg.js";
13
+ Config.prototype.video = {
14
+ parseUrlToVideoEmbed: convertMediaUrlToVideoEmbed,
15
+ defaultWidth: 400,
16
+ defaultHeight: 345
17
+ };
13
18
  Icon.set('video', videoIcon);
14
19
  Config.prototype.controls.video = {
15
- popup: (editor, current, close) => {
16
- const formLink = new UIForm(editor, [
17
- new UIBlock(editor, [
18
- new UIInput(editor, {
20
+ popup: (jodit, current, close) => {
21
+ const formLink = new UIForm(jodit, [
22
+ new UIBlock(jodit, [
23
+ new UIInput(jodit, {
19
24
  name: 'url',
20
25
  required: true,
21
26
  label: 'URL',
@@ -23,26 +28,26 @@ Config.prototype.controls.video = {
23
28
  validators: ['url']
24
29
  })
25
30
  ]),
26
- new UIBlock(editor, [
27
- Button(editor, '', 'Insert', 'primary').onAction(() => formLink.submit())
31
+ new UIBlock(jodit, [
32
+ Button(jodit, '', 'Insert', 'primary').onAction(() => formLink.submit())
28
33
  ])
29
- ]), formCode = new UIForm(editor, [
30
- new UIBlock(editor, [
31
- new UITextArea(editor, {
34
+ ]), formCode = new UIForm(jodit, [
35
+ new UIBlock(jodit, [
36
+ new UITextArea(jodit, {
32
37
  name: 'code',
33
38
  required: true,
34
39
  label: 'Embed code'
35
40
  })
36
41
  ]),
37
- new UIBlock(editor, [
38
- Button(editor, '', 'Insert', 'primary').onAction(() => formCode.submit())
42
+ new UIBlock(jodit, [
43
+ Button(jodit, '', 'Insert', 'primary').onAction(() => formCode.submit())
39
44
  ])
40
45
  ]), tabs = [], insertCode = (code) => {
41
- editor.s.restore();
42
- editor.s.insertHTML(code);
46
+ jodit.s.restore();
47
+ jodit.s.insertHTML(code);
43
48
  close();
44
49
  };
45
- editor.s.save();
50
+ jodit.s.save();
46
51
  tabs.push({
47
52
  icon: 'link',
48
53
  name: 'Link',
@@ -53,12 +58,16 @@ Config.prototype.controls.video = {
53
58
  content: formCode.container
54
59
  });
55
60
  formLink.onSubmit(data => {
56
- insertCode(convertMediaUrlToVideoEmbed(data.url));
61
+ insertCode(call(jodit.o.video?.parseUrlToVideoEmbed ??
62
+ convertMediaUrlToVideoEmbed, data.url, {
63
+ width: jodit.o.video?.defaultWidth,
64
+ height: jodit.o.video?.defaultHeight
65
+ }));
57
66
  });
58
67
  formCode.onSubmit(data => {
59
68
  insertCode(data.code);
60
69
  });
61
- return TabsWidget(editor, tabs);
70
+ return TabsWidget(jodit, tabs);
62
71
  },
63
72
  tags: ['iframe'],
64
73
  tooltip: 'Insert youtube/vimeo video'
@@ -10,10 +10,13 @@ import type { HTMLTagNames } from "../../types";
10
10
  declare module 'jodit/config' {
11
11
  interface Config {
12
12
  wrapNodes: {
13
+ /**
14
+ * List of tags that should not be wrapped
15
+ * Default: `new Set(['hr', 'style', 'br'])`
16
+ */
13
17
  exclude: Set<HTMLTagNames>;
14
18
  /**
15
19
  * If the editor is empty, then insert an empty paragraph into it
16
- * @example
17
20
  * ```javascript
18
21
  * Jodit.make('#editor', {
19
22
  * wrapNodes: {
@@ -21,6 +24,7 @@ declare module 'jodit/config' {
21
24
  * }
22
25
  * });
23
26
  * ```
27
+ * Default: `true`
24
28
  */
25
29
  emptyBlockAfterInit: boolean;
26
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.2.39",
3
+ "version": "4.2.41",
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",
@@ -6,4 +6,7 @@
6
6
  /**
7
7
  * Javascript url pattern converter replace youtube/vimeo url in embed code.
8
8
  */
9
- export declare const convertMediaUrlToVideoEmbed: (url: string, width?: number, height?: number) => string;
9
+ export declare const convertMediaUrlToVideoEmbed: (url: string, { width, height }?: {
10
+ width?: number;
11
+ height?: number;
12
+ }) => string;
@@ -16,6 +16,7 @@ export declare class UITooltip extends UIElement {
16
16
  className(): string;
17
17
  protected render(): string;
18
18
  constructor(view: IViewBased);
19
+ private __attachedContainers;
19
20
  private __onAttach;
20
21
  private __listenClose;
21
22
  private __addListenersOnEnter;
@@ -41,6 +41,7 @@ export declare abstract class ViewWithToolbar extends View implements IViewWithT
41
41
  */
42
42
  private beforeToolbarBuild;
43
43
  readonly isJodit: boolean;
44
+ private __tooltip;
44
45
  /** @override **/
45
46
  protected constructor(options?: Partial<IViewOptions>, isJodit?: boolean);
46
47
  destruct(): void;
@@ -39,7 +39,6 @@ export declare class ToolbarCollection<T extends IViewWithToolbar = IViewWithToo
39
39
  * Set direction
40
40
  */
41
41
  setDirection(direction: 'rtl' | 'ltr'): void;
42
- private __tooltip;
43
42
  constructor(jodit: IViewBased);
44
43
  protected __initEvents(): void;
45
44
  hide(): void;
@@ -15,8 +15,17 @@ declare module 'jodit/config' {
15
15
  * Replace &amp;nbsp; to plain space
16
16
  */
17
17
  replaceNBSP: boolean;
18
+ /**
19
+ * Remove empty P tags, if they are not in the beginning of the text
20
+ */
18
21
  fillEmptyParagraph: boolean;
22
+ /**
23
+ * Remove empty elements
24
+ */
19
25
  removeEmptyElements: boolean;
26
+ /**
27
+ * Replace old tags to new eg. <i> to <em>, <b> to <strong>
28
+ */
20
29
  replaceOldTags: IDictionary<HTMLTagNames> | false;
21
30
  /**
22
31
  * You can use an iframe with the sandbox attribute to safely paste and test HTML code.
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type { IJodit } from "../../types";
12
12
  import { Plugin } from "../../core/plugin/plugin";
13
+
13
14
  export declare class Debug extends Plugin {
14
15
  protected afterInit(jodit: IJodit): void;
15
16
  protected beforeDestruct(jodit: IJodit): void;
@@ -57,7 +57,6 @@ export declare class inlinePopup extends Plugin {
57
57
  /**
58
58
  * Shortcut for Table module
59
59
  */
60
- private get tableModule();
61
60
  /** @override **/
62
61
  protected beforeDestruct(jodit: IJodit): void;
63
62
  private elmsList;
@@ -3,4 +3,33 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
+ declare module 'jodit/config' {
7
+ interface Config {
8
+ video: {
9
+ /**
10
+ * Custom function for parsing video URL to embed code
11
+ * ```javascript
12
+ * Jodit.make('#editor', {
13
+ * video: {
14
+ * // Defaul behavior
15
+ * parseUrlToVideoEmbed: (url, size) => Jodit.modules.Helpers.convertMediaUrlToVideoEmbed(url, size)
16
+ * }
17
+ * });
18
+ * ```
19
+ */
20
+ parseUrlToVideoEmbed?: (url: string, { width, height }?: {
21
+ width?: number;
22
+ height?: number;
23
+ }) => string;
24
+ /**
25
+ * Default width for video iframe. Default: 400
26
+ */
27
+ defaultWidth?: number;
28
+ /**
29
+ * Default height for video iframe. Default: 345
30
+ */
31
+ defaultHeight?: number;
32
+ };
33
+ }
34
+ }
6
35
  export {};
@@ -10,10 +10,13 @@ import type { HTMLTagNames } from "../../types";
10
10
  declare module 'jodit/config' {
11
11
  interface Config {
12
12
  wrapNodes: {
13
+ /**
14
+ * List of tags that should not be wrapped
15
+ * Default: `new Set(['hr', 'style', 'br'])`
16
+ */
13
17
  exclude: Set<HTMLTagNames>;
14
18
  /**
15
19
  * If the editor is empty, then insert an empty paragraph into it
16
- * @example
17
20
  * ```javascript
18
21
  * Jodit.make('#editor', {
19
22
  * wrapNodes: {
@@ -21,6 +24,7 @@ declare module 'jodit/config' {
21
24
  * }
22
25
  * });
23
26
  * ```
27
+ * Default: `true`
24
28
  */
25
29
  emptyBlockAfterInit: boolean;
26
30
  };