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
package/es2021/jodit.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
  */
@@ -1824,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
1824
1824
  * ```
1825
1825
  * @packageDocumentation
1826
1826
  * @module constants
1827
- */ const APP_VERSION = "4.19.8";
1827
+ */ const APP_VERSION = "4.19.9";
1828
1828
  // prettier-ignore
1829
1829
  const ES = "es2021";
1830
1830
  const IS_ES_MODERN = true;
@@ -9802,7 +9802,11 @@ const map = {};
9802
9802
  // element scrolled above the top was wrongly reported as visible and never
9803
9803
  // scrolled to. See #1279
9804
9804
  const clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
9805
- return (top + height <= clientHeight + SUBPIXEL_TOLERANCE || top <= 0) && top + height >= 0;
9805
+ // `scrollIntoView` keeps clear of the document's `scroll-padding`, which
9806
+ // is how a page allows for a fixed header or footer, so its edges are the
9807
+ // viewport's edges here too
9808
+ const style = doc.defaultView?.getComputedStyle(doc.documentElement), padding = (value = '')=>value.endsWith('%') ? parseFloat(value) * clientHeight / 100 : parseFloat(value) || 0, viewTop = padding(style?.scrollPaddingTop), viewBottom = clientHeight - padding(style?.scrollPaddingBottom);
9809
+ return (top + height <= viewBottom + SUBPIXEL_TOLERANCE || top <= viewTop) && top + height >= viewTop;
9806
9810
  }
9807
9811
  /**
9808
9812
  * Scroll element into view if it is not in view
@@ -11977,16 +11981,19 @@ class Selection {
11977
11981
  }
11978
11982
  if (sel && sel.rangeCount) {
11979
11983
  const range = sel.getRangeAt(0);
11980
- const { firstChild } = node;
11984
+ // A block has no first child outside itself to go by, and what's
11985
+ // left beside it would show as a line of its own
11986
+ const isBlock = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(node), first = isBlock ? node : node.firstChild;
11981
11987
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.area, range.commonAncestorContainer)) {
11982
11988
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeInsertNode(range, node);
11983
11989
  } else {
11984
11990
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.area, node);
11985
11991
  }
11986
11992
  [
11987
- ()=>firstChild?.previousSibling,
11988
- ()=>firstChild?.previousSibling,
11989
- ()=>firstChild?.previousSibling?.lastChild
11993
+ ()=>first?.previousSibling,
11994
+ ()=>first?.previousSibling,
11995
+ ()=>first?.previousSibling?.lastChild,
11996
+ ()=>isBlock ? node.nextSibling : null
11990
11997
  ].forEach((getChildNode)=>{
11991
11998
  const childNode = getChildNode();
11992
11999
  // Only a text node left with nothing in it by the split
@@ -33899,7 +33906,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('enter', enter);
33899
33906
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(br, clone);
33900
33907
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(clone, fake);
33901
33908
  }
33902
- ;(0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(br, jodit.editor, jodit.ed);
33909
+ // The new `br` ends the line above, so it takes something on the
33910
+ // caret's own line to bring that line into view. Chrome won't scroll to
33911
+ // an inline element without width, but it will to a `br`
33912
+ const mark = br.cloneNode();
33913
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(fake, mark);
33914
+ (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(mark, jodit.editor, jodit.ed);
33915
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(mark);
33903
33916
  return true;
33904
33917
  }
33905
33918
  return false;
@@ -34560,6 +34573,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.font = {
34560
34573
  }
34561
34574
  };
34562
34575
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_4__.Icon.set('font', (_icons_font_svg__WEBPACK_IMPORTED_MODULE_6___default())).set('fontsize', (_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_7___default()));
34576
+ const hadSelection = new WeakSet();
34563
34577
  jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34564
34578
  command: 'fontsize',
34565
34579
  data: {
@@ -34595,17 +34609,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34595
34609
  },
34596
34610
  tooltip: 'Font size',
34597
34611
  value: (editor, button)=>{
34598
- const current = editor.s.current();
34599
- if (!current) {
34600
- return;
34601
- }
34602
- const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement, editor.editor);
34603
- if (!box) {
34612
+ const current = editor.s.current(), box = current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement, editor.editor), control = button.control;
34613
+ // A select names its value, so until there is a selection it shows the
34614
+ // editor's own size, and afterwards the size of the last one
34615
+ if (box) {
34616
+ hadSelection.add(button);
34617
+ } else if (control.component !== 'select' || hadSelection.has(button)) {
34604
34618
  return;
34605
34619
  }
34606
- const control = button.control;
34607
34620
  const cssKey = control.data?.cssRule || 'font-size';
34608
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box, cssKey);
34621
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box || editor.editor, cssKey);
34609
34622
  if (cssKey === 'font-size') {
34610
34623
  const numValue = parseFloat(value.toString());
34611
34624
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -34635,7 +34648,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34635
34648
  return keySet.has(normalize(value.toString()));
34636
34649
  }
34637
34650
  };
34638
- const hadSelection = new WeakSet();
34639
34651
  jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.font = {
34640
34652
  ...jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize,
34641
34653
  command: 'fontname',
@@ -35770,6 +35782,17 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.commandToHotkeys = {
35770
35782
  40: 'down',
35771
35783
  45: 'insert',
35772
35784
  46: 'del',
35785
+ // With Shift the digit keys send other characters: `&` for 7
35786
+ 48: '0',
35787
+ 49: '1',
35788
+ 50: '2',
35789
+ 51: '3',
35790
+ 52: '4',
35791
+ 53: '5',
35792
+ 54: '6',
35793
+ 55: '7',
35794
+ 56: '8',
35795
+ 57: '9',
35773
35796
  59: ';',
35774
35797
  61: '=',
35775
35798
  91: 'meta',