jodit 4.13.15 → 4.13.17

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 (54) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +8 -8
  4. package/es2015/jodit.js +44 -13
  5. package/es2015/jodit.min.js +4 -4
  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 +4 -4
  13. package/es2018/jodit.min.js +4 -4
  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 +44 -13
  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 +44 -13
  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 +44 -13
  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 +18 -7
  52. package/esm/modules/uploader/helpers/send-files.js +16 -2
  53. package/esm/plugins/enter/helpers/split-fragment.js +11 -2
  54. 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.13.15
4
+ * Version: v4.13.17
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1843,7 +1843,7 @@ __webpack_require__.r(__webpack_exports__);
1843
1843
  * ```
1844
1844
  * @packageDocumentation
1845
1845
  * @module constants
1846
- */ const APP_VERSION = "4.13.15";
1846
+ */ const APP_VERSION = "4.13.17";
1847
1847
  // prettier-ignore
1848
1848
  const ES = "es2021";
1849
1849
  const IS_ES_MODERN = true;
@@ -9067,7 +9067,12 @@ const map = {};
9067
9067
  while(el && el !== root && el.parentNode){
9068
9068
  el = el.parentNode;
9069
9069
  rect = el.getBoundingClientRect();
9070
- if (!(top <= rect.bottom)) {
9070
+ // The element's bottom is clipped by the container's bottom edge: a
9071
+ // caret sitting on that line is invisible, so the element is not in
9072
+ // view even though its top still fits. The `top > rect.top` guard keeps
9073
+ // elements taller than the container (which can never fully fit) from
9074
+ // being treated as always out of view. See #1300
9075
+ if (top + height > rect.bottom && top > rect.top) {
9071
9076
  return false;
9072
9077
  }
9073
9078
  // Check if the element is out of view due to a container scrolling
@@ -9075,19 +9080,24 @@ const map = {};
9075
9080
  return false;
9076
9081
  }
9077
9082
  }
9078
- // Check it's within the document viewport: the element must not be below
9079
- // the viewport bottom, and (its bottom) must not be above the viewport top —
9080
- // the latter guard was missing, so an element scrolled above the top was
9081
- // wrongly reported as visible and never scrolled to. See #1279
9083
+ // Check it's within the document viewport: the element must fit above the
9084
+ // viewport bottom (same clipped-bottom rule as above), and its bottom must
9085
+ // not be above the viewport top — the latter guard was missing, so an
9086
+ // element scrolled above the top was wrongly reported as visible and never
9087
+ // scrolled to. See #1279
9082
9088
  const clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
9083
- return top <= clientHeight && top + height >= 0;
9089
+ return (top + height <= clientHeight || top <= 0) && top + height >= 0;
9084
9090
  }
9085
9091
  /**
9086
9092
  * Scroll element into view if it is not in view
9087
9093
  */ function scrollIntoViewIfNeeded(elm, root, doc) {
9088
9094
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isHTMLElement(elm) && !inView(elm, root, doc)) {
9089
9095
  if (root.clientHeight !== root.scrollHeight) {
9090
- root.scrollTop = elm.offsetTop;
9096
+ // Scroll the minimal distance: when the element is below the
9097
+ // visible area align it to the bottom (natural typing flow),
9098
+ // otherwise align it to the top. See #1300
9099
+ const alignBottom = elm.offsetTop + elm.offsetHeight - root.clientHeight;
9100
+ root.scrollTop = root.scrollTop < alignBottom ? alignBottom : elm.offsetTop;
9091
9101
  }
9092
9102
  if (!inView(elm, root, doc)) {
9093
9103
  elm.scrollIntoView();
@@ -24971,6 +24981,7 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
24971
24981
  return Promise.all(promises);
24972
24982
  }
24973
24983
  function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
24984
+ const readerPromises = [];
24974
24985
  let file, i;
24975
24986
  for(i = 0; i < fileList.length; i += 1){
24976
24987
  file = fileList[i];
@@ -24981,7 +24992,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
24981
24992
  continue;
24982
24993
  }
24983
24994
  const reader = new FileReader();
24984
- promises.push(uploader.j.async.promise((resolve, reject)=>{
24995
+ const readerPromise = uploader.j.async.promise((resolve, reject)=>{
24985
24996
  reader.onerror = reject;
24986
24997
  reader.onloadend = ()=>{
24987
24998
  const resp = {
@@ -24998,10 +25009,21 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
24998
25009
  resolve(resp);
24999
25010
  };
25000
25011
  reader.readAsDataURL(file);
25001
- }));
25012
+ });
25013
+ readerPromises.push(readerPromise);
25014
+ promises.push(readerPromise);
25002
25015
  fileList[i] = null;
25003
25016
  }
25004
25017
  }
25018
+ // Images inserted as base64 never reach the server branch in `sendFiles`,
25019
+ // which is the only other place that fires `filesWereUploaded`
25020
+ if (readerPromises.length) {
25021
+ Promise.all(readerPromises).then(()=>{
25022
+ uploader.j.events && uploader.j.e.fire('filesWereUploaded');
25023
+ }).catch(()=>{
25024
+ // Read errors are propagated to the caller via `promises`
25025
+ });
25026
+ }
25005
25027
  }
25006
25028
 
25007
25029
 
@@ -31084,8 +31106,17 @@ function brBefore(start) {
31084
31106
  }
31085
31107
  return;
31086
31108
  }
31087
- const newP = sel.splitSelection(block, fake);
31088
- (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_1__.scrollIntoViewIfNeeded)(newP, jodit.editor, jodit.ed);
31109
+ // Inserting the left half above the caret can trigger the browser's
31110
+ // scroll anchoring and shift the visible area — keep it stable. See #1300
31111
+ const { scrollTop } = jodit.editor;
31112
+ sel.splitSelection(block, fake);
31113
+ if (jodit.editor.scrollTop !== scrollTop) {
31114
+ jodit.editor.scrollTop = scrollTop;
31115
+ }
31116
+ // After the split the caret stays inside `block` (the right half) —
31117
+ // `splitSelection` returns the left half, which is above the caret and
31118
+ // usually already visible. Follow the caret, not the left half. See #1300
31119
+ (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_1__.scrollIntoViewIfNeeded)(block, jodit.editor, jodit.ed);
31089
31120
  }
31090
31121
 
31091
31122