@leankylin-sheet/react 3.1.27 → 3.1.29

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);
@@ -2200,19 +2202,22 @@ var NotationBoxes = function NotationBoxes() {
2200
2202
  return e.stopPropagation();
2201
2203
  },
2202
2204
  id: "".concat(commentId, "-editor"),
2203
- onMouseUp: function onMouseUp(e) {
2204
- var el = e.target.querySelector(".luckysheet-comment-editor");
2205
- e.target.scrollTop = e.target.scrollHeight;
2206
- if (el) {
2207
- var selection = window.getSelection();
2208
- if (selection) {
2209
- var range = document.createRange();
2210
- range.setStartAfter(el.lastChild || el);
2211
- range.setEndAfter(el.lastChild || el);
2212
- selection.removeAllRanges();
2213
- selection.addRange(range);
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();
2214
2220
  }
2215
- el.focus();
2216
2221
  }
2217
2222
  }
2218
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, {
@@ -2236,12 +2241,17 @@ var NotationBoxes = function NotationBoxes() {
2236
2241
  },
2237
2242
  onBlur: function onBlur() {
2238
2243
  var _context$hooks$afterU2, _context$hooks3, _flowdata$r2, _flowdata$r2$c;
2239
- var el = document.querySelector("#".concat(commentId, "-editor"));
2240
- if (el) {
2241
- el.scrollTop = 0;
2244
+ if (ref.current) {
2245
+ var el = ref.current.querySelector("#".concat(commentId, "-editor"));
2246
+ if (el) {
2247
+ el.scrollTop = 0;
2248
+ }
2242
2249
  }
2243
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);
2244
2251
  },
2252
+ onMouseUp: function onMouseUp(e) {
2253
+ return e.stopPropagation();
2254
+ },
2245
2255
  allowEdit: context.allowEdit,
2246
2256
  spellCheck: false,
2247
2257
  "data-r": r,
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);
@@ -2210,19 +2212,22 @@ var NotationBoxes = function NotationBoxes() {
2210
2212
  return e.stopPropagation();
2211
2213
  },
2212
2214
  id: "".concat(commentId, "-editor"),
2213
- onMouseUp: function onMouseUp(e) {
2214
- var el = e.target.querySelector(".luckysheet-comment-editor");
2215
- e.target.scrollTop = e.target.scrollHeight;
2216
- if (el) {
2217
- var selection = window.getSelection();
2218
- if (selection) {
2219
- var range = document.createRange();
2220
- range.setStartAfter(el.lastChild || el);
2221
- range.setEndAfter(el.lastChild || el);
2222
- selection.removeAllRanges();
2223
- selection.addRange(range);
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();
2224
2230
  }
2225
- el.focus();
2226
2231
  }
2227
2232
  }
2228
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, {
@@ -2246,12 +2251,17 @@ var NotationBoxes = function NotationBoxes() {
2246
2251
  },
2247
2252
  onBlur: function onBlur() {
2248
2253
  var _context$hooks$afterU2, _context$hooks3, _flowdata$r2, _flowdata$r2$c;
2249
- var el = document.querySelector("#".concat(commentId, "-editor"));
2250
- if (el) {
2251
- el.scrollTop = 0;
2254
+ if (ref.current) {
2255
+ var el = ref.current.querySelector("#".concat(commentId, "-editor"));
2256
+ if (el) {
2257
+ el.scrollTop = 0;
2258
+ }
2252
2259
  }
2253
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);
2254
2261
  },
2262
+ onMouseUp: function onMouseUp(e) {
2263
+ return e.stopPropagation();
2264
+ },
2255
2265
  allowEdit: context.allowEdit,
2256
2266
  spellCheck: false,
2257
2267
  "data-r": r,
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);
@@ -105246,19 +105248,22 @@
105246
105248
  return e.stopPropagation();
105247
105249
  },
105248
105250
  id: "".concat(commentId, "-editor"),
105249
- onMouseUp: function onMouseUp(e) {
105250
- var el = e.target.querySelector(".luckysheet-comment-editor");
105251
- e.target.scrollTop = e.target.scrollHeight;
105252
- if (el) {
105253
- var selection = window.getSelection();
105254
- if (selection) {
105255
- var range = document.createRange();
105256
- range.setStartAfter(el.lastChild || el);
105257
- range.setEndAfter(el.lastChild || el);
105258
- selection.removeAllRanges();
105259
- selection.addRange(range);
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();
105260
105266
  }
105261
- el.focus();
105262
105267
  }
105263
105268
  }
105264
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, {
@@ -105282,12 +105287,17 @@
105282
105287
  },
105283
105288
  onBlur: function onBlur() {
105284
105289
  var _context$hooks$afterU2, _context$hooks3, _flowdata$r2, _flowdata$r2$c;
105285
- var el = document.querySelector("#".concat(commentId, "-editor"));
105286
- if (el) {
105287
- el.scrollTop = 0;
105290
+ if (ref.current) {
105291
+ var el = ref.current.querySelector("#".concat(commentId, "-editor"));
105292
+ if (el) {
105293
+ el.scrollTop = 0;
105294
+ }
105288
105295
  }
105289
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);
105290
105297
  },
105298
+ onMouseUp: function onMouseUp(e) {
105299
+ return e.stopPropagation();
105300
+ },
105291
105301
  allowEdit: context.allowEdit,
105292
105302
  spellCheck: false,
105293
105303
  "data-r": r,