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
  */
@@ -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
@@ -33512,7 +33519,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('enter', enter);
33512
33519
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(br, clone);
33513
33520
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(clone, fake);
33514
33521
  }
33515
- ;(0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(br, jodit.editor, jodit.ed);
33522
+ // The new `br` ends the line above, so it takes something on the
33523
+ // caret's own line to bring that line into view. Chrome won't scroll to
33524
+ // an inline element without width, but it will to a `br`
33525
+ const mark = br.cloneNode();
33526
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(fake, mark);
33527
+ (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(mark, jodit.editor, jodit.ed);
33528
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(mark);
33516
33529
  return true;
33517
33530
  }
33518
33531
  return false;
@@ -34173,6 +34186,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.font = {
34173
34186
  }
34174
34187
  };
34175
34188
  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()));
34189
+ const hadSelection = new WeakSet();
34176
34190
  jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34177
34191
  command: 'fontsize',
34178
34192
  data: {
@@ -34208,17 +34222,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34208
34222
  },
34209
34223
  tooltip: 'Font size',
34210
34224
  value: (editor, button)=>{
34211
- const current = editor.s.current();
34212
- if (!current) {
34213
- return;
34214
- }
34215
- const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement, editor.editor);
34216
- if (!box) {
34225
+ 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;
34226
+ // A select names its value, so until there is a selection it shows the
34227
+ // editor's own size, and afterwards the size of the last one
34228
+ if (box) {
34229
+ hadSelection.add(button);
34230
+ } else if (control.component !== 'select' || hadSelection.has(button)) {
34217
34231
  return;
34218
34232
  }
34219
- const control = button.control;
34220
34233
  const cssKey = control.data?.cssRule || 'font-size';
34221
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box, cssKey);
34234
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box || editor.editor, cssKey);
34222
34235
  if (cssKey === 'font-size') {
34223
34236
  const numValue = parseFloat(value.toString());
34224
34237
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -34248,7 +34261,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34248
34261
  return keySet.has(normalize(value.toString()));
34249
34262
  }
34250
34263
  };
34251
- const hadSelection = new WeakSet();
34252
34264
  jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.font = {
34253
34265
  ...jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize,
34254
34266
  command: 'fontname',
@@ -35383,6 +35395,17 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.commandToHotkeys = {
35383
35395
  40: 'down',
35384
35396
  45: 'insert',
35385
35397
  46: 'del',
35398
+ // With Shift the digit keys send other characters: `&` for 7
35399
+ 48: '0',
35400
+ 49: '1',
35401
+ 50: '2',
35402
+ 51: '3',
35403
+ 52: '4',
35404
+ 53: '5',
35405
+ 54: '6',
35406
+ 55: '7',
35407
+ 56: '8',
35408
+ 57: '9',
35386
35409
  59: ';',
35387
35410
  61: '=',
35388
35411
  91: 'meta',