jodit 4.19.8 → 4.19.9

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 (56) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +3 -3
  4. package/es2015/jodit.js +43 -19
  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 +5 -5
  18. package/es2021/jodit.js +40 -17
  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 +40 -17
  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 +47 -18
  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/helpers/utils/scroll-into-view.js +9 -2
  52. package/esm/core/selection/selection.js +7 -4
  53. package/esm/plugins/enter/helpers/check-br.js +7 -1
  54. package/esm/plugins/font/config.js +8 -8
  55. package/esm/plugins/hotkeys/hotkeys.js +11 -0
  56. 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.19.8
4
+ * Version: v4.19.9
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.19.8
4
+ * Version: v4.19.9
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.19.8
4
+ * Version: v4.19.9
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.19.8
4
+ * Version: v4.19.9
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.19.8
4
+ * Version: v4.19.9
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.19.8
4
+ * Version: v4.19.9
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.19.8
4
+ * Version: v4.19.9
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.19.8
4
+ * Version: v4.19.9
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.19.8
4
+ * Version: v4.19.9
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.19.8";
6
+ export const APP_VERSION = "4.19.9";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -20,6 +20,7 @@ const SUBPIXEL_TOLERANCE = 1;
20
20
  * Check if element is in view
21
21
  */
22
22
  export function inView(elm, root, doc) {
23
+ var _a;
23
24
  let rect = elm.getBoundingClientRect(), el = elm;
24
25
  const top = rect.top, height = rect.height;
25
26
  while (el && el !== root && el.parentNode) {
@@ -44,8 +45,14 @@ export function inView(elm, root, doc) {
44
45
  // element scrolled above the top was wrongly reported as visible and never
45
46
  // scrolled to. See #1279
46
47
  const clientHeight = (doc.documentElement && doc.documentElement.clientHeight) || 0;
47
- return ((top + height <= clientHeight + SUBPIXEL_TOLERANCE || top <= 0) &&
48
- top + height >= 0);
48
+ // `scrollIntoView` keeps clear of the document's `scroll-padding`, which
49
+ // is how a page allows for a fixed header or footer, so its edges are the
50
+ // viewport's edges here too
51
+ const style = (_a = doc.defaultView) === null || _a === void 0 ? void 0 : _a.getComputedStyle(doc.documentElement), padding = (value = '') => value.endsWith('%')
52
+ ? (parseFloat(value) * clientHeight) / 100
53
+ : parseFloat(value) || 0, viewTop = padding(style === null || style === void 0 ? void 0 : style.scrollPaddingTop), viewBottom = clientHeight - padding(style === null || style === void 0 ? void 0 : style.scrollPaddingBottom);
54
+ return ((top + height <= viewBottom + SUBPIXEL_TOLERANCE || top <= viewTop) &&
55
+ top + height >= viewTop);
49
56
  }
50
57
  /**
51
58
  * Scroll element into view if it is not in view
@@ -669,7 +669,9 @@ export class Selection {
669
669
  }
670
670
  if (sel && sel.rangeCount) {
671
671
  const range = sel.getRangeAt(0);
672
- const { firstChild } = node;
672
+ // A block has no first child outside itself to go by, and what's
673
+ // left beside it would show as a line of its own
674
+ const isBlock = Dom.isBlock(node), first = isBlock ? node : node.firstChild;
673
675
  if (Dom.isOrContains(this.area, range.commonAncestorContainer)) {
674
676
  Dom.safeInsertNode(range, node);
675
677
  }
@@ -677,9 +679,10 @@ export class Selection {
677
679
  Dom.append(this.area, node);
678
680
  }
679
681
  [
680
- () => firstChild === null || firstChild === void 0 ? void 0 : firstChild.previousSibling,
681
- () => firstChild === null || firstChild === void 0 ? void 0 : firstChild.previousSibling,
682
- () => { var _a; return (_a = firstChild === null || firstChild === void 0 ? void 0 : firstChild.previousSibling) === null || _a === void 0 ? void 0 : _a.lastChild; }
682
+ () => first === null || first === void 0 ? void 0 : first.previousSibling,
683
+ () => first === null || first === void 0 ? void 0 : first.previousSibling,
684
+ () => { var _a; return (_a = first === null || first === void 0 ? void 0 : first.previousSibling) === null || _a === void 0 ? void 0 : _a.lastChild; },
685
+ () => isBlock ? node.nextSibling : null
683
686
  ].forEach(getChildNode => {
684
687
  const childNode = getChildNode();
685
688
  // Only a text node left with nothing in it by the split
@@ -42,7 +42,13 @@ export function checkBR(fake, jodit, shiftKeyPressed, block) {
42
42
  Dom.after(br, clone);
43
43
  Dom.before(clone, fake);
44
44
  }
45
- scrollIntoViewIfNeeded(br, jodit.editor, jodit.ed);
45
+ // The new `br` ends the line above, so it takes something on the
46
+ // caret's own line to bring that line into view. Chrome won't scroll to
47
+ // an inline element without width, but it will to a `br`
48
+ const mark = br.cloneNode();
49
+ Dom.before(fake, mark);
50
+ scrollIntoViewIfNeeded(mark, jodit.editor, jodit.ed);
51
+ Dom.safeRemove(mark);
46
52
  return true;
47
53
  }
48
54
  return false;
@@ -22,6 +22,7 @@ Config.prototype.font = {
22
22
  }
23
23
  };
24
24
  Icon.set('font', fontIcon).set('fontsize', fontsizeIcon);
25
+ const hadSelection = new WeakSet();
25
26
  Config.prototype.controls.fontsize = {
26
27
  command: 'fontsize',
27
28
  data: {
@@ -40,17 +41,17 @@ Config.prototype.controls.fontsize = {
40
41
  tooltip: 'Font size',
41
42
  value: (editor, button) => {
42
43
  var _a;
43
- const current = editor.s.current();
44
- if (!current) {
45
- return;
44
+ const current = editor.s.current(), box = current && Dom.closest(current, Dom.isElement, editor.editor), control = button.control;
45
+ // A select names its value, so until there is a selection it shows the
46
+ // editor's own size, and afterwards the size of the last one
47
+ if (box) {
48
+ hadSelection.add(button);
46
49
  }
47
- const box = Dom.closest(current, Dom.isElement, editor.editor);
48
- if (!box) {
50
+ else if (control.component !== 'select' || hadSelection.has(button)) {
49
51
  return;
50
52
  }
51
- const control = button.control;
52
53
  const cssKey = ((_a = control.data) === null || _a === void 0 ? void 0 : _a.cssRule) || 'font-size';
53
- const value = css(box, cssKey);
54
+ const value = css(box || editor.editor, cssKey);
54
55
  if (cssKey === 'font-size') {
55
56
  const numValue = parseFloat(value.toString());
56
57
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -85,7 +86,6 @@ Config.prototype.controls.fontsize = {
85
86
  return keySet.has(normalize(value.toString()));
86
87
  }
87
88
  };
88
- const hadSelection = new WeakSet();
89
89
  Config.prototype.controls.font = {
90
90
  ...Config.prototype.controls.fontsize,
91
91
  command: 'fontname',
@@ -47,6 +47,17 @@ export class hotkeys extends Plugin {
47
47
  40: 'down',
48
48
  45: 'insert',
49
49
  46: 'del',
50
+ // With Shift the digit keys send other characters: `&` for 7
51
+ 48: '0',
52
+ 49: '1',
53
+ 50: '2',
54
+ 51: '3',
55
+ 52: '4',
56
+ 53: '5',
57
+ 54: '6',
58
+ 55: '7',
59
+ 56: '8',
60
+ 57: '9',
50
61
  59: ';',
51
62
  61: '=',
52
63
  91: 'meta',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.19.8",
3
+ "version": "4.19.9",
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",