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/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.13.15
4
+ * Version: v4.13.17
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1849,7 +1849,7 @@ __webpack_require__.r(__webpack_exports__);
1849
1849
  * ```
1850
1850
  * @packageDocumentation
1851
1851
  * @module constants
1852
- */ const APP_VERSION = "4.13.15";
1852
+ */ const APP_VERSION = "4.13.17";
1853
1853
  // prettier-ignore
1854
1854
  const ES = "es2015";
1855
1855
  const IS_ES_MODERN = true;
@@ -9096,7 +9096,12 @@ const map = {};
9096
9096
  while(el && el !== root && el.parentNode){
9097
9097
  el = el.parentNode;
9098
9098
  rect = el.getBoundingClientRect();
9099
- if (!(top <= rect.bottom)) {
9099
+ // The element's bottom is clipped by the container's bottom edge: a
9100
+ // caret sitting on that line is invisible, so the element is not in
9101
+ // view even though its top still fits. The `top > rect.top` guard keeps
9102
+ // elements taller than the container (which can never fully fit) from
9103
+ // being treated as always out of view. See #1300
9104
+ if (top + height > rect.bottom && top > rect.top) {
9100
9105
  return false;
9101
9106
  }
9102
9107
  // Check if the element is out of view due to a container scrolling
@@ -9104,19 +9109,24 @@ const map = {};
9104
9109
  return false;
9105
9110
  }
9106
9111
  }
9107
- // Check it's within the document viewport: the element must not be below
9108
- // the viewport bottom, and (its bottom) must not be above the viewport top —
9109
- // the latter guard was missing, so an element scrolled above the top was
9110
- // wrongly reported as visible and never scrolled to. See #1279
9112
+ // Check it's within the document viewport: the element must fit above the
9113
+ // viewport bottom (same clipped-bottom rule as above), and its bottom must
9114
+ // not be above the viewport top — the latter guard was missing, so an
9115
+ // element scrolled above the top was wrongly reported as visible and never
9116
+ // scrolled to. See #1279
9111
9117
  const clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
9112
- return top <= clientHeight && top + height >= 0;
9118
+ return (top + height <= clientHeight || top <= 0) && top + height >= 0;
9113
9119
  }
9114
9120
  /**
9115
9121
  * Scroll element into view if it is not in view
9116
9122
  */ function scrollIntoViewIfNeeded(elm, root, doc) {
9117
9123
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isHTMLElement(elm) && !inView(elm, root, doc)) {
9118
9124
  if (root.clientHeight !== root.scrollHeight) {
9119
- root.scrollTop = elm.offsetTop;
9125
+ // Scroll the minimal distance: when the element is below the
9126
+ // visible area align it to the bottom (natural typing flow),
9127
+ // otherwise align it to the top. See #1300
9128
+ const alignBottom = elm.offsetTop + elm.offsetHeight - root.clientHeight;
9129
+ root.scrollTop = root.scrollTop < alignBottom ? alignBottom : elm.offsetTop;
9120
9130
  }
9121
9131
  if (!inView(elm, root, doc)) {
9122
9132
  elm.scrollIntoView();
@@ -25167,6 +25177,7 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
25167
25177
  return Promise.all(promises);
25168
25178
  }
25169
25179
  function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
25180
+ const readerPromises = [];
25170
25181
  let file, i;
25171
25182
  for(i = 0; i < fileList.length; i += 1){
25172
25183
  file = fileList[i];
@@ -25177,7 +25188,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
25177
25188
  continue;
25178
25189
  }
25179
25190
  const reader = new FileReader();
25180
- promises.push(uploader.j.async.promise((resolve, reject)=>{
25191
+ const readerPromise = uploader.j.async.promise((resolve, reject)=>{
25181
25192
  reader.onerror = reject;
25182
25193
  reader.onloadend = ()=>{
25183
25194
  const resp = {
@@ -25194,10 +25205,21 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
25194
25205
  resolve(resp);
25195
25206
  };
25196
25207
  reader.readAsDataURL(file);
25197
- }));
25208
+ });
25209
+ readerPromises.push(readerPromise);
25210
+ promises.push(readerPromise);
25198
25211
  fileList[i] = null;
25199
25212
  }
25200
25213
  }
25214
+ // Images inserted as base64 never reach the server branch in `sendFiles`,
25215
+ // which is the only other place that fires `filesWereUploaded`
25216
+ if (readerPromises.length) {
25217
+ Promise.all(readerPromises).then(()=>{
25218
+ uploader.j.events && uploader.j.e.fire('filesWereUploaded');
25219
+ }).catch(()=>{
25220
+ // Read errors are propagated to the caller via `promises`
25221
+ });
25222
+ }
25201
25223
  }
25202
25224
 
25203
25225
 
@@ -31297,8 +31319,17 @@ function brBefore(start) {
31297
31319
  }
31298
31320
  return;
31299
31321
  }
31300
- const newP = sel.splitSelection(block, fake);
31301
- (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_1__.scrollIntoViewIfNeeded)(newP, jodit.editor, jodit.ed);
31322
+ // Inserting the left half above the caret can trigger the browser's
31323
+ // scroll anchoring and shift the visible area — keep it stable. See #1300
31324
+ const { scrollTop } = jodit.editor;
31325
+ sel.splitSelection(block, fake);
31326
+ if (jodit.editor.scrollTop !== scrollTop) {
31327
+ jodit.editor.scrollTop = scrollTop;
31328
+ }
31329
+ // After the split the caret stays inside `block` (the right half) —
31330
+ // `splitSelection` returns the left half, which is above the caret and
31331
+ // usually already visible. Follow the caret, not the left half. See #1300
31332
+ (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_1__.scrollIntoViewIfNeeded)(block, jodit.editor, jodit.ed);
31302
31333
  }
31303
31334
 
31304
31335