jodit 4.2.40 → 4.2.43

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 (116) hide show
  1. package/CHANGELOG.md +52 -5
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +118 -53
  5. package/es2015/jodit.min.js +2 -2
  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.css +1 -1
  13. package/es2018/jodit.fat.min.js +2 -2
  14. package/es2018/jodit.js +118 -53
  15. package/es2018/jodit.min.js +2 -2
  16. package/es2018/plugins/debug/debug.css +1 -1
  17. package/es2018/plugins/debug/debug.js +1 -1
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  20. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  22. package/es2021/jodit.css +1 -1
  23. package/es2021/jodit.fat.min.js +2 -2
  24. package/es2021/jodit.js +118 -53
  25. package/es2021/jodit.min.js +2 -2
  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 +1 -1
  33. package/es2021.en/jodit.fat.min.js +2 -2
  34. package/es2021.en/jodit.js +118 -53
  35. package/es2021.en/jodit.min.js +2 -2
  36. package/es2021.en/plugins/debug/debug.css +1 -1
  37. package/es2021.en/plugins/debug/debug.js +1 -1
  38. package/es2021.en/plugins/debug/debug.min.js +1 -1
  39. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  40. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  42. package/es5/164.fat.min.js +1 -1
  43. package/es5/164.min.js +1 -1
  44. package/es5/5.fat.min.js +1 -1
  45. package/es5/5.min.js +1 -1
  46. package/es5/jodit.css +2 -2
  47. package/es5/jodit.fat.min.js +2 -2
  48. package/es5/jodit.js +119 -55
  49. package/es5/jodit.min.css +2 -2
  50. package/es5/jodit.min.js +2 -2
  51. package/es5/plugins/debug/debug.css +1 -1
  52. package/es5/plugins/debug/debug.js +1 -1
  53. package/es5/plugins/debug/debug.min.js +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  56. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  57. package/esm/core/constants.js +1 -1
  58. package/esm/core/helpers/utils/complete-url.d.ts +0 -3
  59. package/esm/core/helpers/utils/complete-url.js +1 -1
  60. package/esm/core/helpers/utils/convert-media-url-to-video-embed.d.ts +4 -1
  61. package/esm/core/helpers/utils/convert-media-url-to-video-embed.js +7 -3
  62. package/esm/core/selection/style/api/extract.js +1 -0
  63. package/esm/jodit.d.ts +11 -1
  64. package/esm/jodit.js +11 -1
  65. package/esm/modules/history/snapshot.d.ts +1 -0
  66. package/esm/modules/history/snapshot.js +8 -1
  67. package/esm/modules/toolbar/button/button.js +18 -9
  68. package/esm/plugins/ai-assistant/langs/index.d.ts +3 -0
  69. package/esm/plugins/ai-assistant/langs/index.js +3 -0
  70. package/esm/plugins/clean-html/config.d.ts +9 -0
  71. package/esm/plugins/image-properties/readers/align.d.ts +3 -1
  72. package/esm/plugins/image-properties/readers/align.js +3 -1
  73. package/esm/plugins/image-properties/readers/index.d.ts +3 -0
  74. package/esm/plugins/image-properties/readers/link.d.ts +3 -0
  75. package/esm/plugins/image-properties/readers/margin.js +3 -0
  76. package/esm/plugins/image-properties/readers/size.js +3 -0
  77. package/esm/plugins/image-properties/ui/ui-image-form.d.ts +3 -0
  78. package/esm/plugins/image-properties/ui/ui-image-main-tab.d.ts +3 -0
  79. package/esm/plugins/image-properties/ui/ui-image-position-tab.d.ts +3 -0
  80. package/esm/plugins/image-properties/utils/open-image-editor.d.ts +3 -0
  81. package/esm/plugins/image-properties/utils/open-image-popup.d.ts +3 -0
  82. package/esm/plugins/image-properties/utils/utils.js +3 -0
  83. package/esm/plugins/image-properties/writers/index.d.ts +3 -0
  84. package/esm/plugins/image-properties/writers/link.d.ts +3 -0
  85. package/esm/plugins/image-properties/writers/margin.d.ts +3 -0
  86. package/esm/plugins/image-properties/writers/size.js +3 -0
  87. package/esm/plugins/link/link.js +6 -2
  88. package/esm/plugins/symbols/config.js +6 -7
  89. package/esm/plugins/symbols/symbols.d.ts +1 -3
  90. package/esm/plugins/symbols/symbols.js +16 -11
  91. package/esm/plugins/video/config.d.ts +29 -0
  92. package/esm/plugins/video/config.js +26 -17
  93. package/esm/plugins/wrap-nodes/config.d.ts +5 -1
  94. package/esm/types/history.d.ts +3 -0
  95. package/package.json +1 -1
  96. package/types/core/helpers/utils/complete-url.d.ts +0 -3
  97. package/types/core/helpers/utils/convert-media-url-to-video-embed.d.ts +4 -1
  98. package/types/jodit.d.ts +11 -1
  99. package/types/modules/history/snapshot.d.ts +1 -0
  100. package/types/plugins/ai-assistant/langs/index.d.ts +3 -0
  101. package/types/plugins/clean-html/config.d.ts +9 -0
  102. package/types/plugins/image-properties/readers/align.d.ts +3 -1
  103. package/types/plugins/image-properties/readers/index.d.ts +3 -0
  104. package/types/plugins/image-properties/readers/link.d.ts +3 -0
  105. package/types/plugins/image-properties/ui/ui-image-form.d.ts +3 -0
  106. package/types/plugins/image-properties/ui/ui-image-main-tab.d.ts +3 -0
  107. package/types/plugins/image-properties/ui/ui-image-position-tab.d.ts +3 -0
  108. package/types/plugins/image-properties/utils/open-image-editor.d.ts +3 -0
  109. package/types/plugins/image-properties/utils/open-image-popup.d.ts +3 -0
  110. package/types/plugins/image-properties/writers/index.d.ts +3 -0
  111. package/types/plugins/image-properties/writers/link.d.ts +3 -0
  112. package/types/plugins/image-properties/writers/margin.d.ts +3 -0
  113. package/types/plugins/symbols/symbols.d.ts +1 -3
  114. package/types/plugins/video/config.d.ts +29 -0
  115. package/types/plugins/wrap-nodes/config.d.ts +5 -1
  116. package/types/types/history.d.ts +3 -0
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.40
4
+ * Version: v4.2.43
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.40
4
+ * Version: v4.2.43
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.40
4
+ * Version: v4.2.43
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.40
4
+ * Version: v4.2.43
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.40
4
+ * Version: v4.2.43
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.40
4
+ * Version: v4.2.43
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -3,7 +3,7 @@
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
- export const APP_VERSION = "4.2.40";
6
+ export const APP_VERSION = "4.2.43";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -3,7 +3,4 @@
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
- /**
7
- * @module helpers/utils
8
- */
9
6
  export declare const completeUrl: (url: string) => string;
@@ -3,10 +3,10 @@
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 { globalWindow } from "../../constants.js";
7
6
  /**
8
7
  * @module helpers/utils
9
8
  */
9
+ import { globalWindow } from "../../constants.js";
10
10
  export const completeUrl = (url) => {
11
11
  if (globalWindow.location.protocol === 'file:' && /^\/\//.test(url)) {
12
12
  url = 'https:' + url;
@@ -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;
@@ -12,11 +12,12 @@ import { parseQuery } from "./parse-query.js";
12
12
  /**
13
13
  * Javascript url pattern converter replace youtube/vimeo url in embed code.
14
14
  */
15
- export const convertMediaUrlToVideoEmbed = (url, width = 400, height = 345) => {
15
+ export const convertMediaUrlToVideoEmbed = (url, { width = 400, height = 345 } = {}) => {
16
16
  if (!isURL(url)) {
17
17
  return url;
18
18
  }
19
- const parser = globalDocument.createElement('a'), pattern1 = /(?:http?s?:\/\/)?(?:www\.)?(?:vimeo\.com)\/?(.+)/g;
19
+ const parser = globalDocument.createElement('a');
20
+ const pattern1 = /(?:http?s?:\/\/)?(?:www\.)?(?:vimeo\.com)\/?(.+)/g;
20
21
  parser.href = url;
21
22
  if (!width) {
22
23
  width = 400;
@@ -43,7 +44,10 @@ export const convertMediaUrlToVideoEmbed = (url, width = 400, height = 345) => {
43
44
  case 'www.youtu.be': {
44
45
  const query = parser.search
45
46
  ? parseQuery(parser.search)
46
- : { v: parser.pathname.substr(1) };
47
+ : { v: parser.pathname.substring(1) };
48
+ if (/^embed\/.*/.test(query.v)) {
49
+ query.v = query.v.substring(6);
50
+ }
47
51
  return query.v
48
52
  ? '<iframe width="' +
49
53
  width +
@@ -40,6 +40,7 @@ export function extractSelectedPart(wrapper, font, jodit) {
40
40
  }
41
41
  /**
42
42
  * Retrieves content before after the selected area, clears it if it is empty, and inserts before after the framed selection
43
+ * @private
43
44
  */
44
45
  function extractAndMove(wrapper, range, left) {
45
46
  const fragment = range.extractContents();
package/esm/jodit.d.ts CHANGED
@@ -49,7 +49,17 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
49
49
  */
50
50
  get defaultTimeout(): number;
51
51
  /**
52
- * Method wrap usual Has Object in Object helper for prevent deep object merging in options*
52
+ * Method wrap usual object in Object helper for prevent deep object merging in options*
53
+ * ```js
54
+ * const editor = Jodit.make('#editor', {
55
+ * controls: {
56
+ * fontsize: {
57
+ * list: Jodit.atom([8, 9, 10])
58
+ * }
59
+ * }
60
+ * });
61
+ * ```
62
+ * In this case, the array [8, 9, 10] will not be combined with other arrays, but will replace them
53
63
  */
54
64
  static atom<T>(object: T): T;
55
65
  /**
package/esm/jodit.js CHANGED
@@ -75,7 +75,17 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
75
75
  : Config.defaultOptions.defaultTimeout;
76
76
  }
77
77
  /**
78
- * Method wrap usual Has Object in Object helper for prevent deep object merging in options*
78
+ * Method wrap usual object in Object helper for prevent deep object merging in options*
79
+ * ```js
80
+ * const editor = Jodit.make('#editor', {
81
+ * controls: {
82
+ * fontsize: {
83
+ * list: Jodit.atom([8, 9, 10])
84
+ * }
85
+ * }
86
+ * });
87
+ * ```
88
+ * In this case, the array [8, 9, 10] will not be combined with other arrays, but will replace them
79
89
  */
80
90
  static atom(object) {
81
91
  return markAsAtomic(object);
@@ -37,6 +37,7 @@ export declare class Snapshot extends ViewComponent<IJodit> implements ISnapshot
37
37
  private __isBlocked;
38
38
  get isBlocked(): boolean;
39
39
  private __block;
40
+ private __levelOfTransaction;
40
41
  transaction(changes: () => void): void;
41
42
  /**
42
43
  * Creates object a snapshot of editor: html and the current selection. Current selection calculate by
@@ -13,6 +13,7 @@ export class Snapshot extends ViewComponent {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  this.__isBlocked = false;
16
+ this.__levelOfTransaction = 0;
16
17
  }
17
18
  /** @override */
18
19
  className() {
@@ -93,6 +94,7 @@ export class Snapshot extends ViewComponent {
93
94
  }
94
95
  transaction(changes) {
95
96
  this.__block(true);
97
+ this.__levelOfTransaction += 1;
96
98
  try {
97
99
  changes();
98
100
  }
@@ -101,7 +103,12 @@ export class Snapshot extends ViewComponent {
101
103
  throw e;
102
104
  }
103
105
  }
104
- this.__block(false);
106
+ finally {
107
+ this.__levelOfTransaction -= 1;
108
+ if (this.__levelOfTransaction === 0) {
109
+ this.__block(false);
110
+ }
111
+ }
105
112
  }
106
113
  /**
107
114
  * Creates object a snapshot of editor: html and the current selection. Current selection calculate by
@@ -221,17 +221,26 @@ let ToolbarButton = class ToolbarButton extends UIButton {
221
221
  if (isFunction(ctr.popup)) {
222
222
  const popup = this.openPopup();
223
223
  popup.parentElement = this;
224
- if (this.j.e.fire(camelCase(`before-${ctr.name}-open-popup`), this.target, ctr, popup) !== false) {
225
- const target = this.toolbar?.getTarget(this) ?? this.target ?? null;
226
- const elm = ctr.popup(this.j, target, this.__closePopup, this);
227
- if (elm) {
228
- popup
229
- .setContent(isString(elm) ? this.j.c.fromHTML(elm) : elm)
230
- .open(() => position(this.container), false, this.j.o.allowTabNavigation
231
- ? this.container
232
- : undefined);
224
+ try {
225
+ if (this.j.e.fire(camelCase(`before-${ctr.name}-open-popup`), this.target, ctr, popup) !== false) {
226
+ const target = this.toolbar?.getTarget(this) ?? this.target ?? null;
227
+ const elm = ctr.popup(this.j, target, this.__closePopup, this);
228
+ if (elm) {
229
+ popup
230
+ .setContent(isString(elm) ? this.j.c.fromHTML(elm) : elm)
231
+ .open(() => position(this.container), false, this.j.o.allowTabNavigation
232
+ ? this.container
233
+ : undefined);
234
+ }
235
+ else {
236
+ this.__closePopup();
237
+ }
233
238
  }
234
239
  }
240
+ catch (e) {
241
+ this.__closePopup();
242
+ throw e;
243
+ }
235
244
  /**
236
245
  * Fired after the popup was opened for some control button
237
246
  */
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/ai-assistant
8
+ */
6
9
  import * as en from "./en.js";
7
10
  import * as es from "./es.js";
8
11
  export { en, es };
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/ai-assistant
8
+ */
6
9
  import * as en from "./en.js";
7
10
  import * as es from "./es.js";
8
11
  export { en, es };
@@ -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.
@@ -4,5 +4,7 @@
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import type { EditValues } from "../interface";
7
- /** @private */
7
+ /**
8
+ * @private
9
+ */
8
10
  export declare function readAlign(image: HTMLImageElement, values: EditValues): void;
@@ -4,7 +4,9 @@
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { css } from "../../../core/helpers/utils/css.js";
7
- /** @private */
7
+ /**
8
+ * @private
9
+ */
8
10
  export function readAlign(image, values) {
9
11
  // Align
10
12
  if (image.style.cssFloat &&
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import type { ImagePropertiesState } from "../interface";
8
11
  /**
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import type { EditValues, ImagePropertiesState } from "../interface";
8
11
  /** @private */
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import { kebabCase } from "../../../core/helpers/string/kebab-case.js";
7
10
  /** @private */
8
11
  export function readMargins(image, values, state) {
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import { isNumeric } from "../../../core/helpers/checker/is-numeric.js";
7
10
  import { attr } from "../../../core/helpers/utils/attr.js";
8
11
  import { css } from "../../../core/helpers/utils/css.js";
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IComponent, IContainer, IElms, IJodit, Nullable } from "../../../types";
7
10
  import { UIGroup } from "../../../core/ui/group/group";
8
11
  import type { ImagePropertiesAPI, ImagePropertiesState } from "../interface";
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import { UIGroup } from "../../../core/ui/group/group";
8
11
  import type { ImagePropertiesAPI, ImagePropertiesState } from "../interface";
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import { UIElement } from "../../../core/ui/element";
8
11
  import type { ImagePropertiesAPI, ImagePropertiesState } from "../interface";
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import type { ImagePropertiesState } from "../interface";
8
11
  /**
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IDialog, IJodit } from "../../../types";
7
10
  import type { ImagePropertiesState } from "../interface";
8
11
  /** @private */
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import { isNumber } from "../../../core/helpers/checker/is-number.js";
7
10
  import { trim } from "../../../core/helpers/string/trim.js";
8
11
  /** @private */
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import type { ImagePropertiesState } from "../interface";
8
11
  /**
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  /** @private */
8
11
  export declare function applyLink(j: IJodit, image: HTMLImageElement, imageLink: string, imageLinkOpenInNewTab: boolean): void;
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  /** @private */
8
11
  export declare function applyMargin(j: IJodit, marginTop: number | string, marginRight: number | string, marginBottom: number | string, marginLeft: number | string, image: HTMLImageElement, marginIsLocked: boolean): void;
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import { isNumeric } from "../../../core/helpers/checker/is-numeric.js";
7
10
  import { attr } from "../../../core/helpers/utils/attr.js";
8
11
  import { css } from "../../../core/helpers/utils/css.js";
@@ -16,7 +16,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
16
16
  import { autobind } from "../../core/decorators/index.js";
17
17
  import { Dom } from "../../core/dom/index.js";
18
18
  import { pluginSystem } from "../../core/global.js";
19
- import { attr, convertMediaUrlToVideoEmbed, isString, isURL, refs, stripTags } from "../../core/helpers/index.js";
19
+ import { attr, call, convertMediaUrlToVideoEmbed, isString, isURL, refs, stripTags } from "../../core/helpers/index.js";
20
20
  import { Plugin } from "../../core/plugin/index.js";
21
21
  import "./config.js";
22
22
  /**
@@ -78,7 +78,11 @@ export class link extends Plugin {
78
78
  }
79
79
  jodit.e.stopPropagation('processPaste');
80
80
  if (jodit.o.link.processVideoLink) {
81
- const embed = convertMediaUrlToVideoEmbed(html);
81
+ const embed = call(jodit.o.video?.parseUrlToVideoEmbed ??
82
+ convertMediaUrlToVideoEmbed, html, {
83
+ width: jodit.o.video?.defaultWidth,
84
+ height: jodit.o.video?.defaultHeight
85
+ });
82
86
  if (embed !== html) {
83
87
  return jodit.createInside.fromHTML(embed);
84
88
  }
@@ -233,13 +233,12 @@ Config.prototype.controls.symbols = {
233
233
  editor.e.on(container, 'close_dialog', close);
234
234
  return box;
235
235
  }
236
- else {
237
- editor
238
- .alert(container, 'Select Special Character', undefined, 'jodit-symbols')
239
- .bindDestruct(editor);
240
- const a = container.querySelector('a');
241
- a && a.focus();
242
- }
236
+ editor
237
+ .alert(container, 'Select Special Character', undefined, 'jodit-symbols')
238
+ .bindDestruct(editor);
239
+ const a = container.querySelector('a');
240
+ a && a.focus();
243
241
  }
242
+ return;
244
243
  }
245
244
  };
@@ -16,11 +16,9 @@ import "./config";
16
16
  * The plugin inserts characters that are not part of the standard keyboard.
17
17
  */
18
18
  export declare class symbols extends Plugin {
19
- /** @override */
20
19
  buttons: Plugin['buttons'];
21
- private countInRow;
20
+ private __countInRow;
22
21
  constructor(jodit: IJodit);
23
- /** @override */
24
22
  afterInit(jodit: IJodit): void;
25
23
  /** @override */
26
24
  protected beforeDestruct(jodit: IJodit): void;
@@ -16,17 +16,15 @@ import * as langs from "./langs/index.js";
16
16
  export class symbols extends Plugin {
17
17
  constructor(jodit) {
18
18
  super(jodit);
19
- /** @override */
20
19
  this.buttons = [
21
20
  {
22
21
  name: 'symbols',
23
22
  group: 'insert'
24
23
  }
25
24
  ];
26
- this.countInRow = 17;
25
+ this.__countInRow = 17;
27
26
  extendLang(langs);
28
27
  }
29
- /** @override */
30
28
  afterInit(jodit) {
31
29
  jodit.e.on('generateSpecialCharactersTable.symbols', () => {
32
30
  const container = jodit.c.fromHTML(`<div class="jodit-symbols__container">
@@ -36,10 +34,15 @@ export class symbols extends Plugin {
36
34
  <div class="jodit-symbols__container_preview">
37
35
  <div class="jodit-symbols__preview"></div>
38
36
  </div>
39
- </div>`), preview = container.querySelector('.jodit-symbols__preview'), table = container.querySelector('table'), body = table.tBodies[0], chars = [];
37
+ </div>`);
38
+ const preview = container.querySelector('.jodit-symbols__preview');
39
+ const table = container.querySelector('table');
40
+ const body = table.tBodies[0];
41
+ const chars = [];
40
42
  for (let i = 0; i < jodit.o.specialCharacters.length;) {
41
43
  const tr = jodit.c.element('tr');
42
- for (let j = 0; j < this.countInRow && i < jodit.o.specialCharacters.length; j += 1, i += 1) {
44
+ for (let j = 0; j < this.__countInRow &&
45
+ i < jodit.o.specialCharacters.length; j += 1, i += 1) {
43
46
  const td = jodit.c.element('td'), a = jodit.c.fromHTML(`<a
44
47
  data-index="${i}"
45
48
  data-index-j="${j}"
@@ -61,7 +64,9 @@ export class symbols extends Plugin {
61
64
  if (Dom.isTag(this, 'a')) {
62
65
  jodit.s.focus();
63
66
  jodit.s.insertHTML(this.innerHTML);
64
- jodit.e.fire(this, 'close_dialog');
67
+ if (!e?.shiftKey) {
68
+ jodit.e.fire(this, 'close_dialog');
69
+ }
65
70
  e && e.preventDefault();
66
71
  e && e.stopImmediatePropagation();
67
72
  }
@@ -81,18 +86,18 @@ export class symbols extends Plugin {
81
86
  case KEY_DOWN:
82
87
  newIndex =
83
88
  e.key === KEY_UP
84
- ? index - self.countInRow
85
- : index + self.countInRow;
89
+ ? index - self.__countInRow
90
+ : index + self.__countInRow;
86
91
  if (chars[newIndex] === undefined) {
87
92
  newIndex =
88
93
  e.key === KEY_UP
89
94
  ? Math.floor(chars.length /
90
- self.countInRow) *
91
- self.countInRow +
95
+ self.__countInRow) *
96
+ self.__countInRow +
92
97
  jIndex
93
98
  : jIndex;
94
99
  if (newIndex > chars.length - 1) {
95
- newIndex -= self.countInRow;
100
+ newIndex -= self.__countInRow;
96
101
  }
97
102
  }
98
103
  chars[newIndex] && chars[newIndex].focus();
@@ -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 {};