jodit 4.2.27 → 4.2.33

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 (162) hide show
  1. package/.nvmrc +1 -1
  2. package/CHANGELOG.md +110 -5
  3. package/es2015/jodit.css +11 -1
  4. package/es2015/jodit.fat.min.css +1 -1
  5. package/es2015/jodit.fat.min.js +2 -2
  6. package/es2015/jodit.js +354 -243
  7. package/es2015/jodit.min.css +1 -1
  8. package/es2015/jodit.min.js +2 -2
  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 +25 -18
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +2 -2
  14. package/es2018/jodit.css +11 -1
  15. package/es2018/jodit.fat.min.css +1 -1
  16. package/es2018/jodit.fat.min.js +2 -2
  17. package/es2018/jodit.js +347 -236
  18. package/es2018/jodit.min.css +1 -1
  19. package/es2018/jodit.min.js +2 -2
  20. package/es2018/plugins/debug/debug.js +1 -1
  21. package/es2018/plugins/debug/debug.min.js +1 -1
  22. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  23. package/es2018/plugins/speech-recognize/speech-recognize.js +25 -18
  24. package/es2018/plugins/speech-recognize/speech-recognize.min.js +2 -2
  25. package/es2021/jodit.css +11 -1
  26. package/es2021/jodit.fat.min.css +1 -1
  27. package/es2021/jodit.fat.min.js +2 -2
  28. package/es2021/jodit.js +347 -236
  29. package/es2021/jodit.min.css +1 -1
  30. package/es2021/jodit.min.js +2 -2
  31. package/es2021/plugins/debug/debug.js +1 -1
  32. package/es2021/plugins/debug/debug.min.js +1 -1
  33. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021/plugins/speech-recognize/speech-recognize.js +25 -18
  35. package/es2021/plugins/speech-recognize/speech-recognize.min.js +2 -2
  36. package/es2021.en/jodit.css +11 -1
  37. package/es2021.en/jodit.fat.min.css +1 -1
  38. package/es2021.en/jodit.fat.min.js +2 -2
  39. package/es2021.en/jodit.js +322 -230
  40. package/es2021.en/jodit.min.css +1 -1
  41. package/es2021.en/jodit.min.js +2 -2
  42. package/es2021.en/plugins/debug/debug.js +1 -1
  43. package/es2021.en/plugins/debug/debug.min.js +1 -1
  44. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es2021.en/plugins/speech-recognize/speech-recognize.js +25 -18
  46. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +2 -2
  47. package/es5/164.fat.min.js +10 -0
  48. package/es5/164.js +4939 -0
  49. package/es5/164.min.js +10 -0
  50. package/es5/5.fat.min.js +10 -0
  51. package/es5/5.js +76 -0
  52. package/es5/5.min.js +10 -0
  53. package/es5/jodit.css +12 -2
  54. package/es5/jodit.fat.min.css +1 -1
  55. package/es5/jodit.fat.min.js +2 -2
  56. package/es5/jodit.js +777 -5685
  57. package/es5/jodit.min.css +3 -3
  58. package/es5/jodit.min.js +2 -2
  59. package/es5/plugins/debug/debug.js +1 -1
  60. package/es5/plugins/debug/debug.min.js +1 -1
  61. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  62. package/es5/plugins/speech-recognize/speech-recognize.js +26 -19
  63. package/es5/plugins/speech-recognize/speech-recognize.min.js +2 -2
  64. package/esm/config.js +3 -7
  65. package/esm/core/async/async.js +2 -1
  66. package/esm/core/constants.d.ts +2 -0
  67. package/esm/core/constants.js +10 -6
  68. package/esm/core/decorators/watch/watch.js +0 -1
  69. package/esm/core/dom/dom.js +2 -2
  70. package/esm/core/event-emitter/event-emitter.js +3 -3
  71. package/esm/core/global.js +13 -3
  72. package/esm/core/helpers/array/to-array.d.ts +1 -6
  73. package/esm/core/helpers/array/to-array.js +1 -1
  74. package/esm/core/helpers/async/set-timeout.d.ts +0 -3
  75. package/esm/core/helpers/async/set-timeout.js +3 -2
  76. package/esm/core/helpers/checker/has-browser-color-picker.d.ts +0 -3
  77. package/esm/core/helpers/checker/has-browser-color-picker.js +2 -1
  78. package/esm/core/helpers/checker/is-url.d.ts +0 -3
  79. package/esm/core/helpers/checker/is-url.js +2 -1
  80. package/esm/core/helpers/html/apply-styles.js +3 -3
  81. package/esm/core/helpers/html/clean-from-word.js +2 -1
  82. package/esm/core/helpers/html/htmlspecialchars.d.ts +0 -3
  83. package/esm/core/helpers/html/htmlspecialchars.js +2 -1
  84. package/esm/core/helpers/normalize/normalize-size.d.ts +1 -1
  85. package/esm/core/helpers/size/get-scroll-parent.js +3 -2
  86. package/esm/core/helpers/utils/complete-url.js +2 -1
  87. package/esm/core/helpers/utils/convert-media-url-to-video-embed.js +2 -1
  88. package/esm/core/helpers/utils/default-language.js +3 -2
  89. package/esm/core/helpers/utils/reset.js +3 -3
  90. package/esm/core/request/ajax.js +2 -1
  91. package/esm/core/selection/selection.js +1 -0
  92. package/esm/core/selection/style/api/has-same-style.js +15 -10
  93. package/esm/core/selection/style/api/toggle-attributes.js +2 -1
  94. package/esm/core/selection/style/commit-style.d.ts +1 -1
  95. package/esm/core/ui/form/inputs/file/file.d.ts +1 -0
  96. package/esm/core/ui/form/inputs/file/file.js +1 -0
  97. package/esm/core/ui/form/validators/input.d.ts +3 -3
  98. package/esm/core/ui/form/validators/select.d.ts +1 -1
  99. package/esm/jodit.js +3 -0
  100. package/esm/modules/file-browser/config.js +9 -1
  101. package/esm/modules/file-browser/data-provider.js +0 -1
  102. package/esm/modules/file-browser/file-browser.js +0 -1
  103. package/esm/modules/table/table.js +0 -1
  104. package/esm/modules/toolbar/button/button.d.ts +1 -1
  105. package/esm/plugins/backspace/cases/check-remove-char.js +1 -0
  106. package/esm/plugins/clean-html/config.d.ts +3 -3
  107. package/esm/plugins/iframe/config.d.ts +15 -3
  108. package/esm/plugins/iframe/config.js +1 -0
  109. package/esm/plugins/iframe/iframe.js +3 -0
  110. package/esm/plugins/indent/helpers.d.ts +1 -1
  111. package/esm/plugins/inline-popup/config/items/a.d.ts +2 -2
  112. package/esm/plugins/inline-popup/config/items/cells.d.ts +1 -1
  113. package/esm/plugins/inline-popup/config/items/img.d.ts +1 -1
  114. package/esm/plugins/search/config.js +2 -2
  115. package/esm/plugins/search/helpers/highlight-text-ranges.d.ts +2 -1
  116. package/esm/plugins/search/helpers/highlight-text-ranges.js +15 -4
  117. package/esm/plugins/search/search.d.ts +2 -2
  118. package/esm/plugins/search/search.js +8 -7
  119. package/esm/plugins/search/ui/search.js +3 -3
  120. package/esm/plugins/source/editor/engines/ace.d.ts +0 -1
  121. package/esm/plugins/speech-recognize/config.js +1 -1
  122. package/esm/plugins/speech-recognize/helpers/api.d.ts +1 -1
  123. package/esm/plugins/speech-recognize/helpers/api.js +5 -2
  124. package/esm/plugins/speech-recognize/helpers/sound.js +6 -4
  125. package/esm/plugins/stat/config.d.ts +1 -0
  126. package/esm/plugins/stat/config.js +1 -0
  127. package/esm/plugins/stat/stat.js +14 -3
  128. package/esm/plugins/symbols/langs/index.d.ts +2 -1
  129. package/esm/plugins/symbols/langs/index.js +2 -1
  130. package/esm/plugins/symbols/langs/ua.d.ts +1 -0
  131. package/esm/plugins/symbols/langs/ua.js +9 -0
  132. package/esm/polyfills.d.ts +10 -0
  133. package/esm/polyfills.js +54 -0
  134. package/esm/tsconfig.json +1 -1
  135. package/package.json +1 -1
  136. package/types/core/constants.d.ts +2 -0
  137. package/types/core/helpers/array/to-array.d.ts +1 -6
  138. package/types/core/helpers/async/set-timeout.d.ts +0 -3
  139. package/types/core/helpers/checker/has-browser-color-picker.d.ts +0 -3
  140. package/types/core/helpers/checker/is-url.d.ts +0 -3
  141. package/types/core/helpers/html/htmlspecialchars.d.ts +0 -3
  142. package/types/core/helpers/normalize/normalize-size.d.ts +1 -1
  143. package/types/core/selection/style/commit-style.d.ts +1 -1
  144. package/types/core/ui/form/inputs/file/file.d.ts +1 -0
  145. package/types/core/ui/form/validators/input.d.ts +3 -3
  146. package/types/core/ui/form/validators/select.d.ts +1 -1
  147. package/types/modules/toolbar/button/button.d.ts +1 -1
  148. package/types/plugins/clean-html/config.d.ts +3 -3
  149. package/types/plugins/iframe/config.d.ts +15 -3
  150. package/types/plugins/indent/helpers.d.ts +1 -1
  151. package/types/plugins/inline-popup/config/items/a.d.ts +2 -2
  152. package/types/plugins/inline-popup/config/items/cells.d.ts +1 -1
  153. package/types/plugins/inline-popup/config/items/img.d.ts +1 -1
  154. package/types/plugins/search/helpers/highlight-text-ranges.d.ts +2 -1
  155. package/types/plugins/search/search.d.ts +2 -2
  156. package/types/plugins/source/editor/engines/ace.d.ts +0 -1
  157. package/types/plugins/speech-recognize/helpers/api.d.ts +1 -1
  158. package/types/plugins/stat/config.d.ts +1 -0
  159. package/types/plugins/symbols/langs/index.d.ts +2 -1
  160. package/types/plugins/symbols/langs/ua.d.ts +1 -0
  161. package/types/polyfills.d.ts +10 -0
  162. package/types/tsconfig.json +1 -1
@@ -3,6 +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
+ import { globalDocument } from "../../constants.js";
6
7
  import { Dom } from "../../dom/dom.js";
7
8
  import { css } from "../utils/index.js";
8
9
  export function getScrollParent(node) {
@@ -16,6 +17,6 @@ export function getScrollParent(node) {
16
17
  return node;
17
18
  }
18
19
  return (getScrollParent(node.parentNode) ||
19
- document.scrollingElement ||
20
- document.body);
20
+ globalDocument.scrollingElement ||
21
+ globalDocument.body);
21
22
  }
@@ -3,11 +3,12 @@
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";
6
7
  /**
7
8
  * @module helpers/utils
8
9
  */
9
10
  export const completeUrl = (url) => {
10
- if (window.location.protocol === 'file:' && /^\/\//.test(url)) {
11
+ if (globalWindow.location.protocol === 'file:' && /^\/\//.test(url)) {
11
12
  url = 'https:' + url;
12
13
  }
13
14
  return url;
@@ -6,6 +6,7 @@
6
6
  /**
7
7
  * @module helpers/utils
8
8
  */
9
+ import { globalDocument } from "../../constants.js";
9
10
  import { isURL } from "../checker/is-url.js";
10
11
  import { parseQuery } from "./parse-query.js";
11
12
  /**
@@ -15,7 +16,7 @@ export const convertMediaUrlToVideoEmbed = (url, width = 400, height = 345) => {
15
16
  if (!isURL(url)) {
16
17
  return url;
17
18
  }
18
- const parser = document.createElement('a'), pattern1 = /(?:http?s?:\/\/)?(?:www\.)?(?:vimeo\.com)\/?(.+)/g;
19
+ const parser = globalDocument.createElement('a'), pattern1 = /(?:http?s?:\/\/)?(?:www\.)?(?:vimeo\.com)\/?(.+)/g;
19
20
  parser.href = url;
20
21
  if (!width) {
21
22
  width = 400;
@@ -6,6 +6,7 @@
6
6
  /**
7
7
  * @module helpers/utils
8
8
  */
9
+ import { globalDocument } from "../../constants.js";
9
10
  import { isString } from "../checker/is-string.js";
10
11
  /**
11
12
  * Try define user language
@@ -14,8 +15,8 @@ export const defaultLanguage = (language, defaultLanguage = 'en') => {
14
15
  if (language !== 'auto' && isString(language)) {
15
16
  return language;
16
17
  }
17
- if (document.documentElement && document.documentElement.lang) {
18
- return document.documentElement.lang;
18
+ if (globalDocument.documentElement && globalDocument.documentElement.lang) {
19
+ return globalDocument.documentElement.lang;
19
20
  }
20
21
  if (navigator.language) {
21
22
  return navigator.language.substring(0, 2);
@@ -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
- import { IS_PROD } from "../../constants.js";
6
+ import { globalDocument, IS_PROD } from "../../constants.js";
7
7
  import { isFunction } from "../checker/is-function.js";
8
8
  import { get } from "./get.js";
9
9
  const map = {};
@@ -17,10 +17,10 @@ const map = {};
17
17
  */
18
18
  export function reset(key) {
19
19
  if (!(key in map)) {
20
- const iframe = document.createElement('iframe');
20
+ const iframe = globalDocument.createElement('iframe');
21
21
  try {
22
22
  iframe.src = 'about:blank';
23
- document.body.appendChild(iframe);
23
+ globalDocument.body.appendChild(iframe);
24
24
  if (!iframe.contentWindow) {
25
25
  return null;
26
26
  }
@@ -14,6 +14,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
14
14
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15
15
  };
16
16
  import { Async } from "../async/index.js";
17
+ import { globalWindow } from "../constants.js";
17
18
  import { autobind } from "../decorators/autobind/autobind.js";
18
19
  import { buildQuery, ConfigProto, isFunction, isPlainObject, isString, parseQuery } from "../helpers/index.js";
19
20
  import * as error from "../helpers/utils/error/index.js";
@@ -42,7 +43,7 @@ export class Ajax {
42
43
  return this.o.queryBuild.call(this, obj, prefix);
43
44
  }
44
45
  if (isString(obj) ||
45
- obj instanceof window.FormData ||
46
+ obj instanceof globalWindow.FormData ||
46
47
  (typeof obj === 'object' && obj != null && isFunction(obj.append))) {
47
48
  return obj;
48
49
  }
@@ -593,6 +593,7 @@ export class Selection {
593
593
  /**
594
594
  * Call callback for all selection node
595
595
  */
596
+ // eslint-disable-next-line complexity
596
597
  eachSelection(callback) {
597
598
  const sel = this.sel;
598
599
  if (!sel || !sel.rangeCount) {
@@ -3,6 +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
+ import { globalDocument } from "../../../constants.js";
6
7
  import { Dom } from "../../../dom/dom.js";
7
8
  import { isVoid } from "../../../helpers/checker/is-void.js";
8
9
  import { normalizeCssValue } from "../../../helpers/normalize/normalize-css-value.js";
@@ -29,11 +30,13 @@ export function hasSameStyle(elm, rules) {
29
30
  .toLowerCase() === value.toString().toLowerCase());
30
31
  }));
31
32
  }
32
- const elm = document.createElement('div');
33
- elm.style.color = 'red';
34
- assert(hasSameStyle(elm, { color: 'red' }), 'Style test');
35
- assert(hasSameStyle(elm, { fontSize: null }), 'Style test');
36
- assert(hasSameStyle(elm, { fontSize: '' }), 'Style test');
33
+ if (globalDocument) {
34
+ const elm = globalDocument.createElement('div');
35
+ elm.style.color = 'red';
36
+ assert(hasSameStyle(elm, { color: 'red' }), 'Style test');
37
+ assert(hasSameStyle(elm, { fontSize: null }), 'Style test');
38
+ assert(hasSameStyle(elm, { fontSize: '' }), 'Style test');
39
+ }
37
40
  /**
38
41
  * Element has the similar styles keys
39
42
  */
@@ -45,8 +48,10 @@ export function hasSameStyleKeys(elm, rules) {
45
48
  return value !== '';
46
49
  }));
47
50
  }
48
- const elm2 = document.createElement('div');
49
- elm2.style.color = 'red';
50
- assert(hasSameStyleKeys(elm2, { color: 'red' }), 'Style test');
51
- assert(!hasSameStyleKeys(elm2, { font: 'Arial', color: 'red' }), 'Style test');
52
- assert(!hasSameStyleKeys(elm2, { border: '1px solid #ccc' }), 'Style test');
51
+ if (globalDocument) {
52
+ const elm2 = globalDocument.createElement('div');
53
+ elm2.style.color = 'red';
54
+ assert(hasSameStyleKeys(elm2, { color: 'red' }), 'Style test');
55
+ assert(!hasSameStyleKeys(elm2, { font: 'Arial', color: 'red' }), 'Style test');
56
+ assert(!hasSameStyleKeys(elm2, { border: '1px solid #ccc' }), 'Style test');
57
+ }
@@ -3,6 +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
+ import { globalDocument } from "../../../constants.js";
6
7
  import { Dom } from "../../../dom/dom.js";
7
8
  import { getContainer } from "../../../global.js";
8
9
  import { isBoolean, isNumber, isPlainObject, isString } from "../../../helpers/checker/index.js";
@@ -129,7 +130,7 @@ function getShadowRoot(jodit) {
129
130
  return dataBind(jodit, 'shadowRoot');
130
131
  }
131
132
  const container = getContainer(jodit);
132
- const iframe = document.createElement('iframe');
133
+ const iframe = globalDocument.createElement('iframe');
133
134
  css(iframe, {
134
135
  width: 0,
135
136
  height: 0,
@@ -23,7 +23,7 @@ export declare class CommitStyle implements ICommitStyle {
23
23
  */
24
24
  get isElementCommit(): boolean;
25
25
  get defaultTag(): HTMLTagNames;
26
- get elementIsDefault(): Boolean;
26
+ get elementIsDefault(): boolean;
27
27
  constructor(options: IStyleOptions);
28
28
  apply(jodit: IJodit): void;
29
29
  }
@@ -13,6 +13,7 @@ export declare class UIFileInput extends UIInput {
13
13
  private button;
14
14
  state: UIInput['state'] & {
15
15
  onlyImages: boolean;
16
+ tooltip?: string;
16
17
  };
17
18
  /** @override */
18
19
  className(): string;
@@ -23,6 +23,7 @@ let UIFileInput = class UIFileInput extends UIInput {
23
23
  }
24
24
  createContainer(options) {
25
25
  this.button = new UIButton(this.j, {
26
+ tooltip: options.tooltip,
26
27
  icon: {
27
28
  name: 'plus'
28
29
  }
@@ -6,12 +6,12 @@
6
6
  /**
7
7
  * @module ui/form
8
8
  */
9
- import type { IUIInput, IUIInputValidator } from "../../../../types";
9
+ import type { IUIInputValidator } from "../../../../types";
10
10
  /**
11
11
  * Input is required
12
12
  */
13
- export declare const required: IUIInputValidator<IUIInput>;
13
+ export declare const required: IUIInputValidator;
14
14
  /**
15
15
  * Input value should be valid URL
16
16
  */
17
- export declare const url: IUIInputValidator<IUIInput>;
17
+ export declare const url: IUIInputValidator;
@@ -10,4 +10,4 @@ import type { IUIInputValidator } from "../../../../types";
10
10
  /**
11
11
  * Select is required
12
12
  */
13
- export declare const required: IUIInputValidator<import("../../../../types").IUIInput>;
13
+ export declare const required: IUIInputValidator;
package/esm/jodit.js CHANGED
@@ -844,6 +844,9 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
844
844
  }
845
845
  }
846
846
  catch (e) {
847
+ if (!IS_PROD) {
848
+ throw e;
849
+ }
847
850
  this.destruct();
848
851
  throw e;
849
852
  }
@@ -220,10 +220,12 @@ Config.prototype.filebrowser = {
220
220
  Config.prototype.controls.filebrowser = {
221
221
  upload: {
222
222
  icon: 'plus',
223
+ tooltip: 'Upload file',
223
224
  isInput: true,
224
225
  isDisabled: (browser) => !browser.dataProvider.canI('FileUpload'),
225
- getContent: (filebrowser) => {
226
+ getContent: (filebrowser, btnInt) => {
226
227
  const btn = new UIFileInput(filebrowser, {
228
+ tooltip: btnInt.control.tooltip,
227
229
  onlyImages: filebrowser.state.onlyImages
228
230
  });
229
231
  filebrowser.e.fire('bindUploader.filebrowser', btn.container);
@@ -232,6 +234,7 @@ Config.prototype.controls.filebrowser = {
232
234
  },
233
235
  remove: {
234
236
  icon: 'bin',
237
+ tooltip: 'Remove file',
235
238
  isDisabled: (browser) => {
236
239
  return (!browser.state.activeElements.length ||
237
240
  !browser.dataProvider.canI('FileRemove'));
@@ -241,11 +244,13 @@ Config.prototype.controls.filebrowser = {
241
244
  }
242
245
  },
243
246
  update: {
247
+ tooltip: 'Update file list',
244
248
  exec: (editor) => {
245
249
  editor.e.fire('update.filebrowser');
246
250
  }
247
251
  },
248
252
  select: {
253
+ tooltip: 'Select file',
249
254
  icon: 'check',
250
255
  isDisabled: (browser) => !browser.state.activeElements.length,
251
256
  exec: (editor) => {
@@ -253,6 +258,7 @@ Config.prototype.controls.filebrowser = {
253
258
  }
254
259
  },
255
260
  edit: {
261
+ tooltip: 'Edit image',
256
262
  icon: 'pencil',
257
263
  isDisabled: (browser) => {
258
264
  const selected = browser.state.activeElements;
@@ -266,6 +272,7 @@ Config.prototype.controls.filebrowser = {
266
272
  }
267
273
  },
268
274
  tiles: {
275
+ tooltip: 'Tiles view',
269
276
  icon: 'th',
270
277
  isActive: (filebrowser) => filebrowser.state.view === 'tiles',
271
278
  exec: (filebrowser) => {
@@ -273,6 +280,7 @@ Config.prototype.controls.filebrowser = {
273
280
  }
274
281
  },
275
282
  list: {
283
+ tooltip: 'List view',
276
284
  icon: 'th-list',
277
285
  isActive: (filebrowser) => filebrowser.state.view === 'list',
278
286
  exec: (filebrowser) => {
@@ -354,7 +354,6 @@ let DataProvider = class DataProvider {
354
354
  data: {}
355
355
  };
356
356
  }
357
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
358
357
  const query = this.o[type];
359
358
  if (query.data === undefined) {
360
359
  query.data = {
@@ -41,7 +41,6 @@ let FileBrowser = class FileBrowser extends ViewWithToolbar {
41
41
  get dataProvider() {
42
42
  return makeDataProvider(this, this.options);
43
43
  }
44
- // eslint-disable-next-line no-unused-vars
45
44
  onSelect(callback) {
46
45
  return () => {
47
46
  if (this.state.activeElements.length) {
@@ -36,7 +36,6 @@ export class Table extends ViewComponent {
36
36
  const selector = cssPath(td);
37
37
  selector && selectors.push(selector);
38
38
  });
39
- // eslint-disable-next-line no-prototype-builtins
40
39
  style.innerHTML = selectors.length
41
40
  ? selectors.join(',') +
42
41
  `{${this.jodit.options.table.selectionCellStyle}}`
@@ -20,7 +20,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
20
20
  theme: string;
21
21
  currentValue: string;
22
22
  hasTrigger: boolean;
23
- size: "small" | "tiny" | "xsmall" | "middle" | "large";
23
+ size: "tiny" | "xsmall" | "small" | "middle" | "large";
24
24
  name: string;
25
25
  value: string | number | boolean;
26
26
  variant: import("../../../types").ButtonVariant;
@@ -20,6 +20,7 @@ import { findMostNestedNeighbor } from "../helpers.js";
20
20
  * ```
21
21
  * @private
22
22
  */
23
+ // eslint-disable-next-line complexity
23
24
  export function checkRemoveChar(jodit, fakeNode, backspace, mode) {
24
25
  const step = backspace ? -1 : 1;
25
26
  const anotherSibling = Dom.sibling(fakeNode, !backspace);
@@ -19,9 +19,9 @@ declare module 'jodit/config' {
19
19
  removeEmptyElements: boolean;
20
20
  replaceOldTags: IDictionary<HTMLTagNames> | false;
21
21
  /**
22
- * Use iframe[sandbox] to paste HTML code into the editor to check it for safety
23
- * Allows you not to run scripts and handlers, but it works much slower
24
- * @example
22
+ * You can use an iframe with the sandbox attribute to safely paste and test HTML code.
23
+ * It prevents scripts and handlers from running, but it does slow things down.
24
+ *
25
25
  * ```javascript
26
26
  * Jodit.make('#editor', {
27
27
  * cleanHTML: {
@@ -22,7 +22,7 @@ declare module 'jodit/config' {
22
22
  *
23
23
  * @example
24
24
  * ```javascript
25
- * new Jodit('#editor', {
25
+ * Jodit.make('#editor', {
26
26
  * iframe: true,
27
27
  * iframeBaseUrl: 'https://xdsoft.net/jodit/docs/',
28
28
  * });
@@ -41,7 +41,7 @@ declare module 'jodit/config' {
41
41
  * Custom style to be used inside the iframe to display content.
42
42
  * @example
43
43
  * ```javascript
44
- * new Jodit('#editor', {
44
+ * Jodit.make('#editor', {
45
45
  * iframe: true,
46
46
  * iframeStyle: 'html{margin: 0px;}',
47
47
  * })
@@ -53,13 +53,25 @@ declare module 'jodit/config' {
53
53
  *
54
54
  * @example
55
55
  * ```javascript
56
- * new Jodit('#editor', {
56
+ * Jodit.make('#editor', {
57
57
  * iframe: true,
58
58
  * iframeCSSLinks: ['styles/default.css'],
59
59
  * })
60
60
  * ```
61
61
  */
62
62
  iframeCSSLinks: string[];
63
+ /**
64
+ * Custom sandbox attribute for the iframe.
65
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox
66
+ * ```javascript
67
+ * Jodit.make('#editor', {
68
+ * iframe: true,
69
+ * iframeSandbox: 'allow-same-origin allow-scripts'
70
+ * });
71
+ * ```
72
+ * Empty string value means that all restrictions are enabled.
73
+ */
74
+ iframeSandbox: string | null;
63
75
  }
64
76
  }
65
77
  export {};
@@ -78,3 +78,4 @@ Config.prototype.iframeStyle =
78
78
  '-ms-user-select: none' +
79
79
  '}';
80
80
  Config.prototype.iframeCSSLinks = [];
81
+ Config.prototype.iframeSandbox = null;
@@ -61,6 +61,9 @@ export function iframe(editor) {
61
61
  iframe.setAttribute('allowtransparency', 'true');
62
62
  iframe.setAttribute('tabindex', opt.tabIndex.toString());
63
63
  iframe.setAttribute('frameborder', '0');
64
+ if (opt.iframeSandbox != null) {
65
+ iframe.setAttribute('sandbox', opt.iframeSandbox);
66
+ }
64
67
  editor.workplace.appendChild(iframe);
65
68
  editor.iframe = iframe;
66
69
  const result = editor.e.fire('generateDocumentStructure.iframe', null, editor);
@@ -7,4 +7,4 @@
7
7
  * Get style rule key for current direction
8
8
  * @internal
9
9
  */
10
- export declare const getKey: (direction: string, box: HTMLElement) => 'marginLeft' | 'marginRight' | 'paddingLeft' | 'paddingRight';
10
+ export declare const getKey: (direction: string, box: HTMLElement) => "marginLeft" | "marginRight" | "paddingLeft" | "paddingRight";
@@ -6,6 +6,6 @@
6
6
  /**
7
7
  * @module plugins/inline-popup
8
8
  */
9
- import type { IControlType, IJodit } from "../../../../types";
10
- declare const _default: (string | IControlType<IJodit | import("../../../../types").IViewBased<import("../../../../types").IViewOptions> | import("../../../../types").IFileBrowser<import("../../../../types").IFileBrowserOptions>, import("../../../../types").IToolbarButton>)[];
9
+ import type { IControlType } from "../../../../types";
10
+ declare const _default: Array<IControlType | string>;
11
11
  export default _default;
@@ -7,5 +7,5 @@
7
7
  * @module plugins/inline-popup
8
8
  */
9
9
  import type { IControlType } from "../../../../types";
10
- declare const _default: (string | IControlType<import("../../../../types").IJodit | import("../../../../types").IViewBased<import("../../../../types").IViewOptions> | import("../../../../types").IFileBrowser<import("../../../../types").IFileBrowserOptions>, import("../../../../types").IToolbarButton>)[];
10
+ declare const _default: Array<IControlType | string>;
11
11
  export default _default;
@@ -8,5 +8,5 @@
8
8
  */
9
9
  import type { IControlType, IJodit } from "../../../../types";
10
10
  export declare const align: IControlType<IJodit>;
11
- declare const _default: (string | IControlType<IJodit | import("../../../../types").IViewBased<import("../../../../types").IViewOptions> | import("../../../../types").IFileBrowser<import("../../../../types").IFileBrowserOptions>, import("../../../../types").IToolbarButton>)[];
11
+ declare const _default: Array<IControlType | string>;
12
12
  export default _default;
@@ -3,6 +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
+ import { globalWindow } from "../../core/constants.js";
6
7
  import { Icon } from "../../core/ui/icon.js";
7
8
  import { Config } from "../../config.js";
8
9
  import "./interface.js";
@@ -10,8 +11,7 @@ import searchIcon from "./search.svg.js";
10
11
  Config.prototype.useSearch = true;
11
12
  Config.prototype.search = {
12
13
  lazyIdleTimeout: 0,
13
- // @ts-ignore Because Highlight is not defined in the types TS 5.3.3
14
- useCustomHighlightAPI: typeof window.Highlight !== 'undefined'
14
+ useCustomHighlightAPI: globalWindow && typeof globalWindow.Highlight !== 'undefined'
15
15
  };
16
16
  Icon.set('search', searchIcon);
17
17
  Config.prototype.controls.find = {
@@ -18,8 +18,9 @@ export declare function getSelectionWrappers(root: HTMLElement): HTMLElement[];
18
18
  /**
19
19
  * @private
20
20
  */
21
- export declare function clearSelectionWrappers(root: HTMLElement): void;
21
+ export declare function clearSelectionWrappers(jodit: IJodit): void;
22
22
  /**
23
23
  * @private
24
24
  */
25
25
  export declare function clearSelectionWrappersFromHTML(root: string): string;
26
+ export declare function clearNativeSelection(jodit: IJodit): void;
@@ -3,6 +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
+ import { globalWindow } from "../../../core/constants.js";
6
7
  import { Dom } from "../../../core/dom/dom.js";
7
8
  import { $$ } from "../../../core/helpers/utils/selector.js";
8
9
  /**
@@ -55,8 +56,9 @@ export function getSelectionWrappers(root) {
55
56
  /**
56
57
  * @private
57
58
  */
58
- export function clearSelectionWrappers(root) {
59
- getSelectionWrappers(root).forEach(span => Dom.unwrap(span));
59
+ export function clearSelectionWrappers(jodit) {
60
+ getSelectionWrappers(jodit.editor).forEach(span => Dom.unwrap(span));
61
+ clearNativeSelection(jodit);
60
62
  }
61
63
  /**
62
64
  * @private
@@ -73,14 +75,14 @@ function isSelectionWrapper(node) {
73
75
  function checkNativeSelectionMethod(jodit, rng, restRanges) {
74
76
  if (jodit.o.search.useCustomHighlightAPI &&
75
77
  // @ts-ignore Because Highlight is not defined in the types TS 5.3.3
76
- typeof window.Highlight !== 'undefined') {
78
+ globalWindow &&
79
+ typeof globalWindow.Highlight !== 'undefined') {
77
80
  const ranges = [rng, ...restRanges].map(rng => {
78
81
  const range = jodit.selection.createRange();
79
82
  range.setStart(rng.startContainer, rng.startOffset);
80
83
  range.setEnd(rng.endContainer, rng.endOffset);
81
84
  return range;
82
85
  });
83
- // @ts-ignore Because Highlight is not defined in the types TS 5.3.3
84
86
  const searchHighlight = new Highlight(...ranges);
85
87
  // @ts-ignore
86
88
  CSS.highlights.clear();
@@ -91,6 +93,15 @@ function checkNativeSelectionMethod(jodit, rng, restRanges) {
91
93
  }
92
94
  return false;
93
95
  }
96
+ export function clearNativeSelection(jodit) {
97
+ if (jodit.o.search.useCustomHighlightAPI &&
98
+ // @ts-ignore Because Highlight is not defined in the types TS 5.3.3
99
+ globalWindow &&
100
+ typeof globalWindow.Highlight !== 'undefined') {
101
+ // @ts-ignore
102
+ CSS.highlights.clear();
103
+ }
104
+ }
94
105
  function normalizeRanges(rng, restRanges, ci) {
95
106
  const startText = rng.startContainer.nodeValue;
96
107
  let diff = 0;
@@ -18,11 +18,11 @@ import "./config";
18
18
  *
19
19
  * @example
20
20
  * ```typescript
21
- * var jodit = Jodit.make('#editor', {
21
+ * const jodit = Jodit.make('#editor', {
22
22
  * useSearch: false
23
23
  * });
24
24
  * // or
25
- * var jodit = Jodit.make('#editor', {
25
+ * const jodit = Jodit.make('#editor', {
26
26
  * disablePlugins: 'search'
27
27
  * });
28
28
  * ```
@@ -28,11 +28,11 @@ import { UISearch } from "./ui/search.js";
28
28
  *
29
29
  * @example
30
30
  * ```typescript
31
- * var jodit = Jodit.make('#editor', {
31
+ * const jodit = Jodit.make('#editor', {
32
32
  * useSearch: false
33
33
  * });
34
34
  * // or
35
- * var jodit = Jodit.make('#editor', {
35
+ * const jodit = Jodit.make('#editor', {
36
36
  * disablePlugins: 'search'
37
37
  * });
38
38
  * ```
@@ -111,7 +111,7 @@ export class search extends Plugin {
111
111
  rng.deleteContents();
112
112
  const textNode = this.j.createInside.text(this.ui.replace);
113
113
  Dom.safeInsertNode(rng, textNode);
114
- clearSelectionWrappers(this.j.editor);
114
+ clearSelectionWrappers(this.j);
115
115
  this.j.s.setCursorAfter(textNode);
116
116
  this.tryScrollToElement(textNode);
117
117
  this.cache = {};
@@ -138,7 +138,7 @@ export class search extends Plugin {
138
138
  !getSelectionWrappers(this.j.editor).length) {
139
139
  this.drawPromise?.rejectCallback();
140
140
  this.j.async.cancelAnimationFrame(this.wrapFrameRequest);
141
- clearSelectionWrappers(this.j.editor);
141
+ clearSelectionWrappers(this.j);
142
142
  this.drawPromise = this.__drawSelectionRanges(bounds);
143
143
  }
144
144
  this.previousQuery = query;
@@ -251,14 +251,15 @@ export class search extends Plugin {
251
251
  this.ui.close();
252
252
  })
253
253
  .on(this.ui, 'afterClose', () => {
254
- clearSelectionWrappers(editor.editor);
254
+ clearSelectionWrappers(editor);
255
255
  this.ui.currentIndex = 0;
256
256
  this.ui.count = 0;
257
257
  this.cache = {};
258
+ editor.focus();
258
259
  })
259
260
  .on('click', () => {
260
261
  this.ui.currentIndex = 0;
261
- clearSelectionWrappers(editor.editor);
262
+ clearSelectionWrappers(editor);
262
263
  })
263
264
  .on('change.search', () => {
264
265
  this.cache = {};
@@ -269,7 +270,7 @@ export class search extends Plugin {
269
270
  this.ui.selInfo = null;
270
271
  }
271
272
  if (this.ui.isOpened) {
272
- this.updateCounters();
273
+ void this.updateCounters();
273
274
  }
274
275
  }, editor.defaultTimeout))
275
276
  .on('searchNext.search searchPrevious.search', () => {
@@ -91,7 +91,7 @@ let UISearch = class UISearch extends UIElement {
91
91
  return false;
92
92
  })
93
93
  .on(next, 'pointerdown', () => {
94
- jodit.e.fire('searchNext');
94
+ void jodit.e.fire('searchNext');
95
95
  return false;
96
96
  })
97
97
  .on(prev, 'pointerdown', () => {
@@ -101,12 +101,12 @@ let UISearch = class UISearch extends UIElement {
101
101
  .on(this.queryInput, 'input', () => {
102
102
  this.setMod('empty-query', !trim(this.queryInput.value).length);
103
103
  })
104
- .on(this.queryInput, 'keydown', this.j.async.debounce((e) => {
104
+ .on(this.queryInput, 'keydown', this.j.async.debounce(async (e) => {
105
105
  switch (e.key) {
106
106
  case consts.KEY_ENTER:
107
107
  e.preventDefault();
108
108
  e.stopImmediatePropagation();
109
- if (jodit.e.fire('searchNext')) {
109
+ if (await jodit.e.fire('searchNext')) {
110
110
  this.close();
111
111
  }
112
112
  break;