@leankylin-sheet/react 3.1.26 → 3.1.28

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.
package/dist/index.esm.js CHANGED
@@ -2087,8 +2087,10 @@ var NotationBoxes = function NotationBoxes() {
2087
2087
  });
2088
2088
  }
2089
2089
  }, [flowdata, setContext, length]);
2090
+ var ref = useRef(null);
2090
2091
  return /*#__PURE__*/React.createElement("div", {
2091
- id: "luckysheet-postil-showBoxs"
2092
+ id: "luckysheet-postil-showBoxs",
2093
+ ref: ref
2092
2094
  }, _.concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
2093
2095
  var _context$editingComme;
2094
2096
  return (v === null || v === void 0 ? void 0 : v.rc) !== ((_context$editingComme = context.editingCommentBox) === null || _context$editingComme === void 0 ? void 0 : _context$editingComme.rc);
@@ -2195,6 +2197,28 @@ var NotationBoxes = function NotationBoxes() {
2195
2197
  overflow: "hidden",
2196
2198
  display: "flex",
2197
2199
  flexDirection: "column"
2200
+ },
2201
+ onWheel: function onWheel(e) {
2202
+ return e.stopPropagation();
2203
+ },
2204
+ id: "".concat(commentId, "-editor"),
2205
+ onMouseUp: function onMouseUp() {
2206
+ if (ref.current) {
2207
+ var sEl = ref.current.querySelector("#".concat(commentId, "-editor"));
2208
+ var el = sEl.querySelector(".luckysheet-comment-editor");
2209
+ sEl.scrollTop = sEl.scrollHeight;
2210
+ if (el) {
2211
+ var selection = window.getSelection();
2212
+ if (selection) {
2213
+ var range = document.createRange();
2214
+ range.setStartAfter(el.lastChild || el);
2215
+ range.setEndAfter(el.lastChild || el);
2216
+ selection.removeAllRanges();
2217
+ selection.addRange(range);
2218
+ }
2219
+ el.focus();
2220
+ }
2221
+ }
2198
2222
  }
2199
2223
  }, (_context$hooks$commen = (_context$hooks = context.hooks).commentsPreRender) === null || _context$hooks$commen === void 0 ? void 0 : _context$hooks$commen.call(_context$hooks, r, c), /*#__PURE__*/React.createElement(ContentEditable, {
2200
2224
  id: "comment-editor-".concat(rc),
@@ -2217,6 +2241,12 @@ var NotationBoxes = function NotationBoxes() {
2217
2241
  },
2218
2242
  onBlur: function onBlur() {
2219
2243
  var _context$hooks$afterU2, _context$hooks3, _flowdata$r2, _flowdata$r2$c;
2244
+ if (ref.current) {
2245
+ var el = ref.current.querySelector("#".concat(commentId, "-editor"));
2246
+ if (el) {
2247
+ el.scrollTop = 0;
2248
+ }
2249
+ }
2220
2250
  (_context$hooks$afterU2 = (_context$hooks3 = context.hooks).afterUpdateComment) === null || _context$hooks$afterU2 === void 0 ? void 0 : _context$hooks$afterU2.call(_context$hooks3, r, c, flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : (_flowdata$r2$c = _flowdata$r2[c]) === null || _flowdata$r2$c === void 0 ? void 0 : _flowdata$r2$c.ps, true);
2221
2251
  },
2222
2252
  allowEdit: context.allowEdit,
package/dist/index.js CHANGED
@@ -2097,8 +2097,10 @@ var NotationBoxes = function NotationBoxes() {
2097
2097
  });
2098
2098
  }
2099
2099
  }, [flowdata, setContext, length]);
2100
+ var ref = React.useRef(null);
2100
2101
  return /*#__PURE__*/React__default['default'].createElement("div", {
2101
- id: "luckysheet-postil-showBoxs"
2102
+ id: "luckysheet-postil-showBoxs",
2103
+ ref: ref
2102
2104
  }, ___default['default'].concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
2103
2105
  var _context$editingComme;
2104
2106
  return (v === null || v === void 0 ? void 0 : v.rc) !== ((_context$editingComme = context.editingCommentBox) === null || _context$editingComme === void 0 ? void 0 : _context$editingComme.rc);
@@ -2205,6 +2207,28 @@ var NotationBoxes = function NotationBoxes() {
2205
2207
  overflow: "hidden",
2206
2208
  display: "flex",
2207
2209
  flexDirection: "column"
2210
+ },
2211
+ onWheel: function onWheel(e) {
2212
+ return e.stopPropagation();
2213
+ },
2214
+ id: "".concat(commentId, "-editor"),
2215
+ onMouseUp: function onMouseUp() {
2216
+ if (ref.current) {
2217
+ var sEl = ref.current.querySelector("#".concat(commentId, "-editor"));
2218
+ var el = sEl.querySelector(".luckysheet-comment-editor");
2219
+ sEl.scrollTop = sEl.scrollHeight;
2220
+ if (el) {
2221
+ var selection = window.getSelection();
2222
+ if (selection) {
2223
+ var range = document.createRange();
2224
+ range.setStartAfter(el.lastChild || el);
2225
+ range.setEndAfter(el.lastChild || el);
2226
+ selection.removeAllRanges();
2227
+ selection.addRange(range);
2228
+ }
2229
+ el.focus();
2230
+ }
2231
+ }
2208
2232
  }
2209
2233
  }, (_context$hooks$commen = (_context$hooks = context.hooks).commentsPreRender) === null || _context$hooks$commen === void 0 ? void 0 : _context$hooks$commen.call(_context$hooks, r, c), /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
2210
2234
  id: "comment-editor-".concat(rc),
@@ -2227,6 +2251,12 @@ var NotationBoxes = function NotationBoxes() {
2227
2251
  },
2228
2252
  onBlur: function onBlur() {
2229
2253
  var _context$hooks$afterU2, _context$hooks3, _flowdata$r2, _flowdata$r2$c;
2254
+ if (ref.current) {
2255
+ var el = ref.current.querySelector("#".concat(commentId, "-editor"));
2256
+ if (el) {
2257
+ el.scrollTop = 0;
2258
+ }
2259
+ }
2230
2260
  (_context$hooks$afterU2 = (_context$hooks3 = context.hooks).afterUpdateComment) === null || _context$hooks$afterU2 === void 0 ? void 0 : _context$hooks$afterU2.call(_context$hooks3, r, c, flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : (_flowdata$r2$c = _flowdata$r2[c]) === null || _flowdata$r2$c === void 0 ? void 0 : _flowdata$r2$c.ps, true);
2231
2261
  },
2232
2262
  allowEdit: context.allowEdit,
package/dist/index.umd.js CHANGED
@@ -105133,8 +105133,10 @@
105133
105133
  });
105134
105134
  }
105135
105135
  }, [flowdata, setContext, length]);
105136
+ var ref = React.useRef(null);
105136
105137
  return /*#__PURE__*/React__default['default'].createElement("div", {
105137
- id: "luckysheet-postil-showBoxs"
105138
+ id: "luckysheet-postil-showBoxs",
105139
+ ref: ref
105138
105140
  }, lodash.concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
105139
105141
  var _context$editingComme;
105140
105142
  return (v === null || v === void 0 ? void 0 : v.rc) !== ((_context$editingComme = context.editingCommentBox) === null || _context$editingComme === void 0 ? void 0 : _context$editingComme.rc);
@@ -105241,6 +105243,28 @@
105241
105243
  overflow: "hidden",
105242
105244
  display: "flex",
105243
105245
  flexDirection: "column"
105246
+ },
105247
+ onWheel: function onWheel(e) {
105248
+ return e.stopPropagation();
105249
+ },
105250
+ id: "".concat(commentId, "-editor"),
105251
+ onMouseUp: function onMouseUp() {
105252
+ if (ref.current) {
105253
+ var sEl = ref.current.querySelector("#".concat(commentId, "-editor"));
105254
+ var el = sEl.querySelector(".luckysheet-comment-editor");
105255
+ sEl.scrollTop = sEl.scrollHeight;
105256
+ if (el) {
105257
+ var selection = window.getSelection();
105258
+ if (selection) {
105259
+ var range = document.createRange();
105260
+ range.setStartAfter(el.lastChild || el);
105261
+ range.setEndAfter(el.lastChild || el);
105262
+ selection.removeAllRanges();
105263
+ selection.addRange(range);
105264
+ }
105265
+ el.focus();
105266
+ }
105267
+ }
105244
105268
  }
105245
105269
  }, (_context$hooks$commen = (_context$hooks = context.hooks).commentsPreRender) === null || _context$hooks$commen === void 0 ? void 0 : _context$hooks$commen.call(_context$hooks, r, c), /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
105246
105270
  id: "comment-editor-".concat(rc),
@@ -105263,6 +105287,12 @@
105263
105287
  },
105264
105288
  onBlur: function onBlur() {
105265
105289
  var _context$hooks$afterU2, _context$hooks3, _flowdata$r2, _flowdata$r2$c;
105290
+ if (ref.current) {
105291
+ var el = ref.current.querySelector("#".concat(commentId, "-editor"));
105292
+ if (el) {
105293
+ el.scrollTop = 0;
105294
+ }
105295
+ }
105266
105296
  (_context$hooks$afterU2 = (_context$hooks3 = context.hooks).afterUpdateComment) === null || _context$hooks$afterU2 === void 0 ? void 0 : _context$hooks$afterU2.call(_context$hooks3, r, c, flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$r2 = flowdata[r]) === null || _flowdata$r2 === void 0 ? void 0 : (_flowdata$r2$c = _flowdata$r2[c]) === null || _flowdata$r2$c === void 0 ? void 0 : _flowdata$r2$c.ps, true);
105267
105297
  },
105268
105298
  allowEdit: context.allowEdit,