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/es2015/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
  */
@@ -1830,7 +1830,7 @@ __webpack_require__.r(__webpack_exports__);
1830
1830
  * ```
1831
1831
  * @packageDocumentation
1832
1832
  * @module constants
1833
- */ const APP_VERSION = "4.19.8";
1833
+ */ const APP_VERSION = "4.19.9";
1834
1834
  // prettier-ignore
1835
1835
  const ES = "es2015";
1836
1836
  const IS_ES_MODERN = true;
@@ -9816,6 +9816,7 @@ const map = {};
9816
9816
  /**
9817
9817
  * Check if element is in view
9818
9818
  */ function inView(elm, root, doc) {
9819
+ var _doc_defaultView;
9819
9820
  let rect = elm.getBoundingClientRect(), el = elm;
9820
9821
  const top = rect.top, height = rect.height;
9821
9822
  while(el && el !== root && el.parentNode){
@@ -9840,7 +9841,11 @@ const map = {};
9840
9841
  // element scrolled above the top was wrongly reported as visible and never
9841
9842
  // scrolled to. See #1279
9842
9843
  const clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
9843
- return (top + height <= clientHeight + SUBPIXEL_TOLERANCE || top <= 0) && top + height >= 0;
9844
+ // `scrollIntoView` keeps clear of the document's `scroll-padding`, which
9845
+ // is how a page allows for a fixed header or footer, so its edges are the
9846
+ // viewport's edges here too
9847
+ const style = (_doc_defaultView = doc.defaultView) === null || _doc_defaultView === void 0 ? void 0 : _doc_defaultView.getComputedStyle(doc.documentElement), padding = (value = '')=>value.endsWith('%') ? parseFloat(value) * clientHeight / 100 : 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);
9848
+ return (top + height <= viewBottom + SUBPIXEL_TOLERANCE || top <= viewTop) && top + height >= viewTop;
9844
9849
  }
9845
9850
  /**
9846
9851
  * Scroll element into view if it is not in view
@@ -12057,19 +12062,22 @@ class Selection {
12057
12062
  }
12058
12063
  if (sel && sel.rangeCount) {
12059
12064
  const range = sel.getRangeAt(0);
12060
- const { firstChild } = node;
12065
+ // A block has no first child outside itself to go by, and what's
12066
+ // left beside it would show as a line of its own
12067
+ const isBlock = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(node), first = isBlock ? node : node.firstChild;
12061
12068
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.area, range.commonAncestorContainer)) {
12062
12069
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeInsertNode(range, node);
12063
12070
  } else {
12064
12071
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.area, node);
12065
12072
  }
12066
12073
  [
12067
- ()=>firstChild === null || firstChild === void 0 ? void 0 : firstChild.previousSibling,
12068
- ()=>firstChild === null || firstChild === void 0 ? void 0 : firstChild.previousSibling,
12074
+ ()=>first === null || first === void 0 ? void 0 : first.previousSibling,
12075
+ ()=>first === null || first === void 0 ? void 0 : first.previousSibling,
12069
12076
  ()=>{
12070
- var _firstChild_previousSibling;
12071
- return firstChild === null || firstChild === void 0 ? void 0 : (_firstChild_previousSibling = firstChild.previousSibling) === null || _firstChild_previousSibling === void 0 ? void 0 : _firstChild_previousSibling.lastChild;
12072
- }
12077
+ var _first_previousSibling;
12078
+ return first === null || first === void 0 ? void 0 : (_first_previousSibling = first.previousSibling) === null || _first_previousSibling === void 0 ? void 0 : _first_previousSibling.lastChild;
12079
+ },
12080
+ ()=>isBlock ? node.nextSibling : null
12073
12081
  ].forEach((getChildNode)=>{
12074
12082
  const childNode = getChildNode();
12075
12083
  // Only a text node left with nothing in it by the split
@@ -34171,7 +34179,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('enter', enter);
34171
34179
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(br, clone);
34172
34180
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(clone, fake);
34173
34181
  }
34174
- ;(0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(br, jodit.editor, jodit.ed);
34182
+ // The new `br` ends the line above, so it takes something on the
34183
+ // caret's own line to bring that line into view. Chrome won't scroll to
34184
+ // an inline element without width, but it will to a `br`
34185
+ const mark = br.cloneNode();
34186
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(fake, mark);
34187
+ (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(mark, jodit.editor, jodit.ed);
34188
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(mark);
34175
34189
  return true;
34176
34190
  }
34177
34191
  return false;
@@ -34839,6 +34853,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.font = {
34839
34853
  }
34840
34854
  };
34841
34855
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_6__.Icon.set('font', (_icons_font_svg__WEBPACK_IMPORTED_MODULE_8___default())).set('fontsize', (_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_9___default()));
34856
+ const hadSelection = new WeakSet();
34842
34857
  jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize = {
34843
34858
  command: 'fontsize',
34844
34859
  data: {
@@ -34875,17 +34890,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize = {
34875
34890
  tooltip: 'Font size',
34876
34891
  value: (editor, button)=>{
34877
34892
  var _control_data;
34878
- const current = editor.s.current();
34879
- if (!current) {
34880
- return;
34881
- }
34882
- const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isElement, editor.editor);
34883
- if (!box) {
34893
+ const current = editor.s.current(), box = current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isElement, editor.editor), control = button.control;
34894
+ // A select names its value, so until there is a selection it shows the
34895
+ // editor's own size, and afterwards the size of the last one
34896
+ if (box) {
34897
+ hadSelection.add(button);
34898
+ } else if (control.component !== 'select' || hadSelection.has(button)) {
34884
34899
  return;
34885
34900
  }
34886
- const control = button.control;
34887
34901
  const cssKey = ((_control_data = control.data) === null || _control_data === void 0 ? void 0 : _control_data.cssRule) || 'font-size';
34888
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(box, cssKey);
34902
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(box || editor.editor, cssKey);
34889
34903
  if (cssKey === 'font-size') {
34890
34904
  const numValue = parseFloat(value.toString());
34891
34905
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -34919,7 +34933,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize = {
34919
34933
  return keySet.has(normalize(value.toString()));
34920
34934
  }
34921
34935
  };
34922
- const hadSelection = new WeakSet();
34923
34936
  jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.font = (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_1__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_0__._)({}, jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize), {
34924
34937
  command: 'fontname',
34925
34938
  textTemplate: (j, value)=>{
@@ -36068,6 +36081,17 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.commandToHotkeys = {
36068
36081
  40: 'down',
36069
36082
  45: 'insert',
36070
36083
  46: 'del',
36084
+ // With Shift the digit keys send other characters: `&` for 7
36085
+ 48: '0',
36086
+ 49: '1',
36087
+ 50: '2',
36088
+ 51: '3',
36089
+ 52: '4',
36090
+ 53: '5',
36091
+ 54: '6',
36092
+ 55: '7',
36093
+ 56: '8',
36094
+ 57: '9',
36071
36095
  59: ';',
36072
36096
  61: '=',
36073
36097
  91: 'meta',