jodit 4.15.8 → 4.15.10

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 +12 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +3 -3
  4. package/es2015/jodit.js +39 -12
  5. package/es2015/jodit.min.js +4 -4
  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 +4 -4
  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 +39 -12
  19. package/es2021/jodit.min.js +5 -5
  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 +39 -12
  29. package/es2021.en/jodit.min.js +5 -5
  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 +42 -12
  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 +11 -0
  52. package/esm/core/selection/selection.js +24 -1
  53. package/esm/jodit.d.ts +6 -0
  54. package/esm/jodit.js +9 -2
  55. package/package.json +1 -1
  56. package/types/core/selection/selection.d.ts +11 -0
  57. package/types/jodit.d.ts +6 -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.15.8
4
+ * Version: v4.15.10
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.15.8
4
+ * Version: v4.15.10
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.15.8
4
+ * Version: v4.15.10
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.15.8
4
+ * Version: v4.15.10
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.15.8
4
+ * Version: v4.15.10
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.15.8
4
+ * Version: v4.15.10
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.15.8
4
+ * Version: v4.15.10
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.15.8
4
+ * Version: v4.15.10
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.15.8
4
+ * Version: v4.15.10
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.15.8";
6
+ export const APP_VERSION = "4.15.10";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -216,6 +216,17 @@ export declare class Selection implements ISelect {
216
216
  * @param inward - select all inside
217
217
  */
218
218
  select(node: Node | HTMLElement | HTMLTableElement | HTMLTableCellElement, inward?: boolean): this;
219
+ /**
220
+ * The outermost `contenteditable="false"` ancestor of the node inside the
221
+ * editable area, if there is one.
222
+ *
223
+ * A range can be put inside such an island (e.g. on an `<img>` wrapped in a
224
+ * `<picture contenteditable="false">`), but the browser cannot place a caret
225
+ * there: the arrow keys then have nothing to move from and the selection
226
+ * cannot be escaped. Selecting the island itself keeps the range in editable
227
+ * content, so the caret can step over it. See #1184
228
+ */
229
+ private __closestNotEditable;
219
230
  /**
220
231
  * Return current selected HTML
221
232
  * @example
@@ -971,10 +971,33 @@ export class Selection {
971
971
  if (!Dom.up(node, (elm) => elm === this.area || (elm && elm.parentNode === this.area), this.area)) {
972
972
  throw error('Node element must be in editor');
973
973
  }
974
+ const target = (!inward && this.__closestNotEditable(node)) || node;
974
975
  const range = this.createRange();
975
- range[inward || node === this.area ? 'selectNodeContents' : 'selectNode'](node);
976
+ range[inward || target === this.area ? 'selectNodeContents' : 'selectNode'](target);
976
977
  return this.selectRange(range);
977
978
  }
979
+ /**
980
+ * The outermost `contenteditable="false"` ancestor of the node inside the
981
+ * editable area, if there is one.
982
+ *
983
+ * A range can be put inside such an island (e.g. on an `<img>` wrapped in a
984
+ * `<picture contenteditable="false">`), but the browser cannot place a caret
985
+ * there: the arrow keys then have nothing to move from and the selection
986
+ * cannot be escaped. Selecting the island itself keeps the range in editable
987
+ * content, so the caret can step over it. See #1184
988
+ */
989
+ __closestNotEditable(node) {
990
+ const { area } = this;
991
+ let result = null, elm = node.parentNode;
992
+ while (elm && elm !== area && area.contains(elm)) {
993
+ if (Dom.isElement(elm) &&
994
+ elm.getAttribute('contenteditable') === 'false') {
995
+ result = elm;
996
+ }
997
+ elm = elm.parentNode;
998
+ }
999
+ return result;
1000
+ }
978
1001
  /**
979
1002
  * Return current selected HTML
980
1003
  * @example
package/esm/jodit.d.ts CHANGED
@@ -242,6 +242,12 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
242
242
  * If some plugin changes the DOM directly, then you need to update the content of the original element
243
243
  */
244
244
  protected updateElementValue(): void;
245
+ /**
246
+ * In inline mode the source element is the editor container, so its
247
+ * `innerHTML` is the editor's own markup rather than the value. Keep the
248
+ * value last synchronised to it here instead.
249
+ */
250
+ private __inlineElementValue;
245
251
  /**
246
252
  * Return source element value
247
253
  */
package/esm/jodit.js CHANGED
@@ -468,6 +468,10 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
468
468
  * Return source element value
469
469
  */
470
470
  getElementValue() {
471
+ if (this.element === this.container &&
472
+ this.__inlineElementValue !== undefined) {
473
+ return this.__inlineElementValue;
474
+ }
471
475
  return this.element.value !== undefined
472
476
  ? this.element.value
473
477
  : this.element.innerHTML;
@@ -476,8 +480,11 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
476
480
  if (!isString(value)) {
477
481
  throw error('value must be string');
478
482
  }
479
- if (this.element !== this.container &&
480
- value !== this.getElementValue()) {
483
+ if (this.element === this.container) {
484
+ this.__inlineElementValue = value;
485
+ return;
486
+ }
487
+ if (value !== this.getElementValue()) {
481
488
  const data = { value };
482
489
  const res = this.e.fire('beforeSetElementValue', data);
483
490
  callPromise(res, () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.15.8",
3
+ "version": "4.15.10",
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",
@@ -216,6 +216,17 @@ export declare class Selection implements ISelect {
216
216
  * @param inward - select all inside
217
217
  */
218
218
  select(node: Node | HTMLElement | HTMLTableElement | HTMLTableCellElement, inward?: boolean): this;
219
+ /**
220
+ * The outermost `contenteditable="false"` ancestor of the node inside the
221
+ * editable area, if there is one.
222
+ *
223
+ * A range can be put inside such an island (e.g. on an `<img>` wrapped in a
224
+ * `<picture contenteditable="false">`), but the browser cannot place a caret
225
+ * there: the arrow keys then have nothing to move from and the selection
226
+ * cannot be escaped. Selecting the island itself keeps the range in editable
227
+ * content, so the caret can step over it. See #1184
228
+ */
229
+ private __closestNotEditable;
219
230
  /**
220
231
  * Return current selected HTML
221
232
  * @example
package/types/jodit.d.ts CHANGED
@@ -242,6 +242,12 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
242
242
  * If some plugin changes the DOM directly, then you need to update the content of the original element
243
243
  */
244
244
  protected updateElementValue(): void;
245
+ /**
246
+ * In inline mode the source element is the editor container, so its
247
+ * `innerHTML` is the editor's own markup rather than the value. Keep the
248
+ * value last synchronised to it here instead.
249
+ */
250
+ private __inlineElementValue;
245
251
  /**
246
252
  * Return source element value
247
253
  */