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/es5/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
  */
@@ -2155,7 +2155,7 @@ __webpack_require__.r(__webpack_exports__);
2155
2155
  * @packageDocumentation
2156
2156
  * @module constants
2157
2157
  */
2158
- var APP_VERSION = "4.19.8";
2158
+ var APP_VERSION = "4.19.9";
2159
2159
  // prettier-ignore
2160
2160
  var ES = "es5";
2161
2161
  var IS_ES_MODERN = false;
@@ -10949,6 +10949,7 @@ var map = {};
10949
10949
  /**
10950
10950
  * Check if element is in view
10951
10951
  */ function inView(elm, root, doc) {
10952
+ var _doc_defaultView;
10952
10953
  var rect = elm.getBoundingClientRect(), el = elm;
10953
10954
  var top = rect.top, height = rect.height;
10954
10955
  while(el && el !== root && el.parentNode){
@@ -10973,7 +10974,14 @@ var map = {};
10973
10974
  // element scrolled above the top was wrongly reported as visible and never
10974
10975
  // scrolled to. See #1279
10975
10976
  var clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
10976
- return (top + height <= clientHeight + SUBPIXEL_TOLERANCE || top <= 0) && top + height >= 0;
10977
+ // `scrollIntoView` keeps clear of the document's `scroll-padding`, which
10978
+ // is how a page allows for a fixed header or footer, so its edges are the
10979
+ // viewport's edges here too
10980
+ var style = (_doc_defaultView = doc.defaultView) === null || _doc_defaultView === void 0 ? void 0 : _doc_defaultView.getComputedStyle(doc.documentElement), padding = function padding() {
10981
+ var value = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '';
10982
+ return value.endsWith('%') ? parseFloat(value) * clientHeight / 100 : parseFloat(value) || 0;
10983
+ }, viewTop = padding(style === null || style === void 0 ? void 0 : style.scrollPaddingTop), viewBottom = clientHeight - padding(style === null || style === void 0 ? void 0 : style.scrollPaddingBottom);
10984
+ return (top + height <= viewBottom + SUBPIXEL_TOLERANCE || top <= viewTop) && top + height >= viewTop;
10977
10985
  }
10978
10986
  /**
10979
10987
  * Scroll element into view if it is not in view
@@ -13692,7 +13700,9 @@ var Selection = /*#__PURE__*/ function() {
13692
13700
  }
13693
13701
  if (sel && sel.rangeCount) {
13694
13702
  var range = sel.getRangeAt(0);
13695
- var firstChild = node.firstChild;
13703
+ // A block has no first child outside itself to go by, and what's
13704
+ // left beside it would show as a line of its own
13705
+ var isBlock = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isBlock(node), first = isBlock ? node : node.firstChild;
13696
13706
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isOrContains(_this.area, range.commonAncestorContainer)) {
13697
13707
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.safeInsertNode(range, node);
13698
13708
  } else {
@@ -13700,14 +13710,17 @@ var Selection = /*#__PURE__*/ function() {
13700
13710
  }
13701
13711
  [
13702
13712
  function() {
13703
- return firstChild === null || firstChild === void 0 ? void 0 : firstChild.previousSibling;
13713
+ return first === null || first === void 0 ? void 0 : first.previousSibling;
13704
13714
  },
13705
13715
  function() {
13706
- return firstChild === null || firstChild === void 0 ? void 0 : firstChild.previousSibling;
13716
+ return first === null || first === void 0 ? void 0 : first.previousSibling;
13707
13717
  },
13708
13718
  function() {
13709
- var _firstChild_previousSibling;
13710
- return firstChild === null || firstChild === void 0 ? void 0 : (_firstChild_previousSibling = firstChild.previousSibling) === null || _firstChild_previousSibling === void 0 ? void 0 : _firstChild_previousSibling.lastChild;
13719
+ var _first_previousSibling;
13720
+ return first === null || first === void 0 ? void 0 : (_first_previousSibling = first.previousSibling) === null || _first_previousSibling === void 0 ? void 0 : _first_previousSibling.lastChild;
13721
+ },
13722
+ function() {
13723
+ return isBlock ? node.nextSibling : null;
13711
13724
  }
13712
13725
  ].forEach(function(getChildNode) {
13713
13726
  var childNode = getChildNode();
@@ -40461,7 +40474,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('enter', enter);
40461
40474
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(br, clone);
40462
40475
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(clone, fake);
40463
40476
  }
40464
- ;(0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(br, jodit.editor, jodit.ed);
40477
+ // The new `br` ends the line above, so it takes something on the
40478
+ // caret's own line to bring that line into view. Chrome won't scroll to
40479
+ // an inline element without width, but it will to a `br`
40480
+ var mark = br.cloneNode();
40481
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(fake, mark);
40482
+ (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(mark, jodit.editor, jodit.ed);
40483
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(mark);
40465
40484
  return true;
40466
40485
  }
40467
40486
  return false;
@@ -41145,6 +41164,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_8__.Config.prototype.font = {
41145
41164
  }
41146
41165
  };
41147
41166
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_7__.Icon.set('font', (_icons_font_svg__WEBPACK_IMPORTED_MODULE_9___default())).set('fontsize', (_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_10___default()));
41167
+ var hadSelection = new WeakSet();
41148
41168
  jodit_config__WEBPACK_IMPORTED_MODULE_8__.Config.prototype.controls.fontsize = {
41149
41169
  command: 'fontsize',
41150
41170
  data: {
@@ -41181,17 +41201,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_8__.Config.prototype.controls.fontsize = {
41181
41201
  tooltip: 'Font size',
41182
41202
  value: function value(editor, button) {
41183
41203
  var _control_data;
41184
- var current = editor.s.current();
41185
- if (!current) {
41186
- return;
41187
- }
41188
- var box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement, editor.editor);
41189
- if (!box) {
41204
+ var current = editor.s.current(), box = current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement, editor.editor), control = button.control;
41205
+ // A select names its value, so until there is a selection it shows the
41206
+ // editor's own size, and afterwards the size of the last one
41207
+ if (box) {
41208
+ hadSelection.add(button);
41209
+ } else if (control.component !== 'select' || hadSelection.has(button)) {
41190
41210
  return;
41191
41211
  }
41192
- var control = button.control;
41193
41212
  var cssKey = ((_control_data = control.data) === null || _control_data === void 0 ? void 0 : _control_data.cssRule) || 'font-size';
41194
- var value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(box, cssKey);
41213
+ var value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(box || editor.editor, cssKey);
41195
41214
  if (cssKey === 'font-size') {
41196
41215
  var numValue = parseFloat(value.toString());
41197
41216
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -41229,7 +41248,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_8__.Config.prototype.controls.fontsize = {
41229
41248
  return keySet.has(normalize(value.toString()));
41230
41249
  }
41231
41250
  };
41232
- var hadSelection = new WeakSet();
41233
41251
  jodit_config__WEBPACK_IMPORTED_MODULE_8__.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_8__.Config.prototype.controls.fontsize), {
41234
41252
  command: 'fontname',
41235
41253
  textTemplate: function textTemplate(j, value) {
@@ -42526,6 +42544,17 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.commandToHotkeys = {
42526
42544
  40: 'down',
42527
42545
  45: 'insert',
42528
42546
  46: 'del',
42547
+ // With Shift the digit keys send other characters: `&` for 7
42548
+ 48: '0',
42549
+ 49: '1',
42550
+ 50: '2',
42551
+ 51: '3',
42552
+ 52: '4',
42553
+ 53: '5',
42554
+ 54: '6',
42555
+ 55: '7',
42556
+ 56: '8',
42557
+ 57: '9',
42529
42558
  59: ';',
42530
42559
  61: '=',
42531
42560
  91: 'meta',
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
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
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.19.8
11
+ * Version: v4.19.9
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */