jodit 4.2.32 → 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 (60) hide show
  1. package/CHANGELOG.md +11 -5
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +27 -16
  5. package/es2015/jodit.min.js +2 -2
  6. package/es2015/plugins/debug/debug.js +1 -1
  7. package/es2015/plugins/debug/debug.min.js +1 -1
  8. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  11. package/es2018/jodit.css +1 -1
  12. package/es2018/jodit.fat.min.js +2 -2
  13. package/es2018/jodit.js +26 -15
  14. package/es2018/jodit.min.js +2 -2
  15. package/es2018/plugins/debug/debug.js +1 -1
  16. package/es2018/plugins/debug/debug.min.js +1 -1
  17. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  18. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +1 -1
  21. package/es2021/jodit.fat.min.js +2 -2
  22. package/es2021/jodit.js +26 -15
  23. package/es2021/jodit.min.js +2 -2
  24. package/es2021/plugins/debug/debug.js +1 -1
  25. package/es2021/plugins/debug/debug.min.js +1 -1
  26. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  27. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  28. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  29. package/es2021.en/jodit.css +1 -1
  30. package/es2021.en/jodit.fat.min.js +2 -2
  31. package/es2021.en/jodit.js +26 -15
  32. package/es2021.en/jodit.min.js +2 -2
  33. package/es2021.en/plugins/debug/debug.js +1 -1
  34. package/es2021.en/plugins/debug/debug.min.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  36. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  37. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  38. package/es5/164.fat.min.js +1 -1
  39. package/es5/164.min.js +1 -1
  40. package/es5/5.fat.min.js +1 -1
  41. package/es5/5.min.js +1 -1
  42. package/es5/jodit.css +2 -2
  43. package/es5/jodit.fat.min.js +2 -2
  44. package/es5/jodit.js +50 -27
  45. package/es5/jodit.min.css +2 -2
  46. package/es5/jodit.min.js +2 -2
  47. package/es5/plugins/debug/debug.js +1 -1
  48. package/es5/plugins/debug/debug.min.js +1 -1
  49. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  50. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  51. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  52. package/esm/core/constants.js +1 -1
  53. package/esm/plugins/search/helpers/highlight-text-ranges.d.ts +2 -1
  54. package/esm/plugins/search/helpers/highlight-text-ranges.js +12 -3
  55. package/esm/plugins/search/search.d.ts +2 -2
  56. package/esm/plugins/search/search.js +8 -7
  57. package/esm/plugins/search/ui/search.js +3 -3
  58. package/package.json +1 -1
  59. package/types/plugins/search/helpers/highlight-text-ranges.d.ts +2 -1
  60. package/types/plugins/search/search.d.ts +2 -2
@@ -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.32
4
+ * Version: v4.2.33
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.32
4
+ * Version: v4.2.33
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.32
4
+ * Version: v4.2.33
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.32
4
+ * Version: v4.2.33
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.32
4
+ * Version: v4.2.33
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.32";
6
+ export const APP_VERSION = "4.2.33";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -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;
@@ -56,8 +56,9 @@ export function getSelectionWrappers(root) {
56
56
  /**
57
57
  * @private
58
58
  */
59
- export function clearSelectionWrappers(root) {
60
- getSelectionWrappers(root).forEach(span => Dom.unwrap(span));
59
+ export function clearSelectionWrappers(jodit) {
60
+ getSelectionWrappers(jodit.editor).forEach(span => Dom.unwrap(span));
61
+ clearNativeSelection(jodit);
61
62
  }
62
63
  /**
63
64
  * @private
@@ -82,7 +83,6 @@ function checkNativeSelectionMethod(jodit, rng, restRanges) {
82
83
  range.setEnd(rng.endContainer, rng.endOffset);
83
84
  return range;
84
85
  });
85
- // @ts-ignore Because Highlight is not defined in the types TS 5.3.3
86
86
  const searchHighlight = new Highlight(...ranges);
87
87
  // @ts-ignore
88
88
  CSS.highlights.clear();
@@ -93,6 +93,15 @@ function checkNativeSelectionMethod(jodit, rng, restRanges) {
93
93
  }
94
94
  return false;
95
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
+ }
96
105
  function normalizeRanges(rng, restRanges, ci) {
97
106
  const startText = rng.startContainer.nodeValue;
98
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.2.32",
3
+ "version": "4.2.33",
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",
@@ -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;
@@ -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
  * ```