jodit 4.15.16 → 4.15.17

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 (55) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +61 -16
  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 +4 -4
  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 +5 -5
  18. package/es2021/jodit.js +60 -16
  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 +5 -5
  28. package/es2021.en/jodit.js +60 -16
  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 +62 -16
  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/plugins/focus/focus.js +17 -1
  52. package/esm/plugins/image-processor/image-processor.js +20 -1
  53. package/esm/plugins/image-properties/writers/margin.js +5 -3
  54. package/esm/plugins/inline-popup/config/items/img.js +7 -0
  55. package/package.json +1 -1
@@ -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.16
4
+ * Version: v4.15.17
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.16
4
+ * Version: v4.15.17
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.16
4
+ * Version: v4.15.17
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.16
4
+ * Version: v4.15.17
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.16
4
+ * Version: v4.15.17
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.16
4
+ * Version: v4.15.17
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.16
4
+ * Version: v4.15.17
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.16
4
+ * Version: v4.15.17
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.16
4
+ * Version: v4.15.17
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.16";
6
+ export const APP_VERSION = "4.15.17";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -20,16 +20,32 @@ Config.prototype.cursorAfterAutofocus = 'end';
20
20
  Config.prototype.saveSelectionOnBlur = true;
21
21
  export function focus(editor) {
22
22
  if (editor.o.saveSelectionOnBlur) {
23
+ // A click that brings focus back places the caret itself, and Chrome
24
+ // has already placed it when focus fires, so restoring would move it
25
+ // back to the old selection. The saved markers are dropped instead.
26
+ let focusByPointer = false;
23
27
  editor.e
24
28
  .on('blur', () => {
29
+ // A press that never brought the focus back must not decide
30
+ // what the next focus does
31
+ focusByPointer = false;
25
32
  if (editor.isEditorMode()) {
26
33
  editor.s.save(true);
27
34
  }
35
+ })
36
+ .on('mousedown touchstart', () => {
37
+ focusByPointer = !editor.editorIsActive;
28
38
  })
29
39
  .on('focus', () => {
30
40
  if (editor.isEditorMode()) {
31
- editor.s.restore();
41
+ if (focusByPointer) {
42
+ editor.s.removeMarkers();
43
+ }
44
+ else {
45
+ editor.s.restore();
46
+ }
32
47
  }
48
+ focusByPointer = false;
33
49
  });
34
50
  }
35
51
  const focus = () => {
@@ -13,8 +13,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
13
13
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
14
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15
15
  };
16
- import { SOURCE_CONSUMER } from "../../core/constants.js";
16
+ import { INVISIBLE_SPACE_REG_EXP, SOURCE_CONSUMER } from "../../core/constants.js";
17
17
  import { cached, debounce, watch } from "../../core/decorators/index.js";
18
+ import { Dom } from "../../core/dom/dom.js";
18
19
  import { pluginSystem } from "../../core/global.js";
19
20
  import { $$, dataBind } from "../../core/helpers/index.js";
20
21
  import { Plugin } from "../../core/plugin/index.js";
@@ -77,6 +78,7 @@ export class imageProcessor extends Plugin {
77
78
  replaceDataURIToBlobUUID(editor, elm);
78
79
  }
79
80
  editor.e.on(elm, 'mousedown touchstart', () => {
81
+ removeCaretText(elm);
80
82
  editor.s.select(elm);
81
83
  });
82
84
  }
@@ -93,6 +95,23 @@ __decorate([
93
95
  watch([':change', ':afterInit', ':changePlace']),
94
96
  debounce()
95
97
  ], imageProcessor.prototype, "afterChange", null);
98
+ /**
99
+ * Remove the invisible-space text beside an image, which only held a caret.
100
+ * Selecting the image replaces the caret, and with the text still after a
101
+ * block image, Safari highlights the rest of the image's line. See #1512
102
+ */
103
+ function removeCaretText(elm) {
104
+ var _a;
105
+ for (const side of ['previousSibling', 'nextSibling']) {
106
+ let node = elm[side];
107
+ while (Dom.isText(node) &&
108
+ !((_a = node.nodeValue) === null || _a === void 0 ? void 0 : _a.replace(INVISIBLE_SPACE_REG_EXP(), ''))) {
109
+ const next = node[side];
110
+ Dom.safeRemove(node);
111
+ node = next;
112
+ }
113
+ }
114
+ }
96
115
  function replaceDataURIToBlobUUID(editor, elm) {
97
116
  if (!editor.o.imageProcessor.replaceDataURIToBlobIdInView) {
98
117
  return;
@@ -3,15 +3,17 @@
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
- import { css } from "../../../core/helpers/utils/css.js";
6
+ import { css, cssInline } from "../../../core/helpers/utils/css.js";
7
7
  import { normalSizeToString } from "../utils/utils.js";
8
8
  /** @private */
9
9
  export function applyMargin(j, marginTop, marginRight, marginBottom, marginLeft, image, marginIsLocked) {
10
10
  const margins = [marginTop, marginRight, marginBottom, marginLeft];
11
+ // Compared with the inline value, which is what `readMargins` showed, so a
12
+ // margin from a stylesheet is not overwritten when the field is unchanged
11
13
  const applyMargin = (key, value) => {
12
- const oldValue = css(image, key);
14
+ const oldValue = normalSizeToString(cssInline(image, key) || 0);
13
15
  const v = normalSizeToString(value);
14
- if (oldValue.toString() !== v.toString()) {
16
+ if (oldValue !== v) {
15
17
  css(image, key, v);
16
18
  }
17
19
  };
@@ -54,6 +54,13 @@ export default [
54
54
  name: 'valign',
55
55
  list: ['Top', 'Middle', 'Bottom', 'Normal'],
56
56
  tooltip: 'Vertical align',
57
+ // `vertical-align` only moves an image in the line, not a floated or block one
58
+ isDisabled: (editor, button) => {
59
+ const image = button.target;
60
+ return Boolean(image &&
61
+ (['left', 'right'].includes(css(image, 'float')) ||
62
+ css(image, 'display') === 'block'));
63
+ },
57
64
  exec: (editor, image, { control }) => {
58
65
  if (!Dom.isTag(image, 'img')) {
59
66
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.15.16",
3
+ "version": "4.15.17",
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",