jodit 4.17.4 → 4.17.5

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 (57) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +3 -3
  4. package/es2015/jodit.js +47 -4
  5. package/es2015/jodit.min.js +3 -3
  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 +3 -3
  13. package/es2018/jodit.min.js +3 -3
  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 +4 -4
  18. package/es2021/jodit.js +43 -4
  19. package/es2021/jodit.min.js +4 -4
  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 +4 -4
  28. package/es2021.en/jodit.js +43 -4
  29. package/es2021.en/jodit.min.js +4 -4
  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 +53 -4
  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/core/constants.js +1 -1
  51. package/esm/core/selection/selection.d.ts +5 -0
  52. package/esm/core/selection/selection.js +25 -0
  53. package/esm/plugins/select/select.d.ts +7 -0
  54. package/esm/plugins/select/select.js +19 -1
  55. package/package.json +1 -1
  56. package/types/core/selection/selection.d.ts +5 -0
  57. package/types/plugins/select/select.d.ts +7 -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.17.4
4
+ * Version: v4.17.5
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.17.4
4
+ * Version: v4.17.5
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.17.4
4
+ * Version: v4.17.5
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.17.4
4
+ * Version: v4.17.5
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.17.4
4
+ * Version: v4.17.5
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.17.4
4
+ * Version: v4.17.5
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.17.4
4
+ * Version: v4.17.5
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
package/es5/polyfills.js CHANGED
@@ -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.17.4
4
+ * Version: v4.17.5
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.17.4
4
+ * Version: v4.17.5
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-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export const APP_VERSION = "4.17.4";
6
+ export const APP_VERSION = "4.17.5";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -60,6 +60,11 @@ export declare class Selection implements ISelect {
60
60
  * back to the plain window selection.
61
61
  */
62
62
  private __composedSelection;
63
+ /**
64
+ * How many ranges the browser's own selection holds right now, as opposed
65
+ * to the composed view that [[sel]] may answer from.
66
+ */
67
+ private __nativeRangeCount;
63
68
  /**
64
69
  * Return first selected range or create new
65
70
  */
@@ -151,6 +151,18 @@ export class Selection {
151
151
  }
152
152
  });
153
153
  }
154
+ /**
155
+ * How many ranges the browser's own selection holds right now, as opposed
156
+ * to the composed view that [[sel]] may answer from.
157
+ */
158
+ __nativeRangeCount() {
159
+ var _a, _b, _c, _d;
160
+ const { shadowRoot } = this.j.o;
161
+ if (shadowRoot && isFunction(shadowRoot.getSelection)) {
162
+ return (_b = (_a = shadowRoot.getSelection()) === null || _a === void 0 ? void 0 : _a.rangeCount) !== null && _b !== void 0 ? _b : 0;
163
+ }
164
+ return (_d = (_c = this.win.getSelection()) === null || _c === void 0 ? void 0 : _c.rangeCount) !== null && _d !== void 0 ? _d : 0;
165
+ }
154
166
  /**
155
167
  * Return first selected range or create new
156
168
  */
@@ -1035,6 +1047,19 @@ export class Selection {
1035
1047
  const range = ranges[0];
1036
1048
  sel.setBaseAndExtent(range.endContainer, range.endOffset, range.startContainer, range.startOffset);
1037
1049
  }
1050
+ else if (ranges.length === 1 &&
1051
+ !this.__nativeRangeCount() &&
1052
+ isFunction(sel.setBaseAndExtent)) {
1053
+ // `addRange` is specified to ignore a range whose root is not
1054
+ // the document, which is every range inside a shadow tree.
1055
+ // Chrome's `ShadowRoot.getSelection()` takes them anyway, but
1056
+ // Safari has only the window selection, so after
1057
+ // `removeAllRanges` the caret is simply gone: a character was
1058
+ // deleted and nothing was left to type into. `setBaseAndExtent`
1059
+ // does accept nodes inside a shadow tree.
1060
+ const range = ranges[0];
1061
+ sel.setBaseAndExtent(range.startContainer, range.startOffset, range.endContainer, range.endOffset);
1062
+ }
1038
1063
  }
1039
1064
  /**
1040
1065
  * Fired after change selection
@@ -27,6 +27,13 @@ export declare class select extends Plugin {
27
27
  protected afterInit(jodit: IJodit): void;
28
28
  protected beforeDestruct(jodit: IJodit): void;
29
29
  private onStartSelection;
30
+ /**
31
+ * Where the last press started. Chrome reports a drag that begins in one
32
+ * element and ends in another as a `click` on their common ancestor, so a
33
+ * press inside a popup is remembered to tell such a drag from a real click.
34
+ */
35
+ private __pressTarget;
36
+ protected onOutsidePress(e: Event): void;
30
37
  /**
31
38
  * @event outsideClick(e) - when user clicked on the outside of editor
32
39
  */
@@ -42,6 +42,12 @@ export class select extends Plugin {
42
42
  'mouseup',
43
43
  'touchend'
44
44
  ];
45
+ /**
46
+ * Where the last press started. Chrome reports a drag that begins in one
47
+ * element and ends in another as a `click` on their common ancestor, so a
48
+ * press inside a popup is remembered to tell such a drag from a real click.
49
+ */
50
+ this.__pressTarget = null;
45
51
  }
46
52
  afterInit(jodit) {
47
53
  this.proxyEventsList.forEach(eventName => {
@@ -64,14 +70,23 @@ export class select extends Plugin {
64
70
  j.e.fire(e.type + 'Editor', target, e);
65
71
  }
66
72
  }
73
+ onOutsidePress(e) {
74
+ this.__pressTarget = e.target;
75
+ }
67
76
  /**
68
77
  * @event outsideClick(e) - when user clicked on the outside of editor
69
78
  */
70
79
  onOutsideClick(e) {
71
- const node = e.target;
80
+ const node = e.target, pressed = this.__pressTarget;
81
+ this.__pressTarget = null;
72
82
  if (Dom.up(node, elm => elm === this.j.editor)) {
73
83
  return;
74
84
  }
85
+ // Selecting the text of a popup input with the mouse and releasing
86
+ // the button past the popup's edge is not a click outside of it.
87
+ if (pressed && UIElement.closestElement(pressed, Popup)) {
88
+ return;
89
+ }
75
90
  const box = UIElement.closestElement(node, Popup);
76
91
  if (!box) {
77
92
  this.j.e.fire('outsideClick', e);
@@ -186,6 +201,9 @@ export class select extends Plugin {
186
201
  __decorate([
187
202
  autobind
188
203
  ], select.prototype, "onStartSelection", null);
204
+ __decorate([
205
+ watch(['ow:mousedown', 'ow:touchstart'])
206
+ ], select.prototype, "onOutsidePress", null);
189
207
  __decorate([
190
208
  watch('ow:click')
191
209
  ], select.prototype, "onOutsideClick", null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.17.4",
3
+ "version": "4.17.5",
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",
@@ -60,6 +60,11 @@ export declare class Selection implements ISelect {
60
60
  * back to the plain window selection.
61
61
  */
62
62
  private __composedSelection;
63
+ /**
64
+ * How many ranges the browser's own selection holds right now, as opposed
65
+ * to the composed view that [[sel]] may answer from.
66
+ */
67
+ private __nativeRangeCount;
63
68
  /**
64
69
  * Return first selected range or create new
65
70
  */
@@ -27,6 +27,13 @@ export declare class select extends Plugin {
27
27
  protected afterInit(jodit: IJodit): void;
28
28
  protected beforeDestruct(jodit: IJodit): void;
29
29
  private onStartSelection;
30
+ /**
31
+ * Where the last press started. Chrome reports a drag that begins in one
32
+ * element and ends in another as a `click` on their common ancestor, so a
33
+ * press inside a popup is remembered to tell such a drag from a real click.
34
+ */
35
+ private __pressTarget;
36
+ protected onOutsidePress(e: Event): void;
30
37
  /**
31
38
  * @event outsideClick(e) - when user clicked on the outside of editor
32
39
  */