@fileverse-dev/fortune-react 1.2.24 → 1.2.25

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.
@@ -225,7 +225,7 @@ var FxEditor = function FxEditor() {
225
225
  onChange: onChange,
226
226
  tabIndex: 0,
227
227
  allowEdit: allowEdit && !context.isFlvReadOnly
228
- }), showSearchHint && /*#__PURE__*/React.createElement(FormulaSearch, {
228
+ }), showSearchHint && (/*#__PURE__*/React.createElement(FormulaSearch, {
229
229
  onMouseMove: function onMouseMove(e) {
230
230
  if (document.getElementById("luckysheet-formula-search-c")) {
231
231
  var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
@@ -234,7 +234,7 @@ var FxEditor = function FxEditor() {
234
234
  }
235
235
  e.preventDefault();
236
236
  }
237
- }), /*#__PURE__*/React.createElement("div", {
237
+ })), /*#__PURE__*/React.createElement("div", {
238
238
  className: "fx-hint"
239
239
  }, context.functionHint && ((_c = (_b = refs.fxInput) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.innerText.includes("(")) && (/*#__PURE__*/React.createElement(FormulaHint, {
240
240
  handleShowFormulaHint: handleShowFormulaHint,
@@ -31,6 +31,22 @@ var NotationBoxes = function NotationBoxes() {
31
31
  });
32
32
  }
33
33
  }, [flowdata, setContext]);
34
+ var handleMouseDownEvent = function handleMouseDownEvent(r, c, rc, commentId) {
35
+ return function (e) {
36
+ var nativeEvent = e.nativeEvent;
37
+ setContext(function (draftContext) {
38
+ if (flowdata) {
39
+ setEditingComment(draftContext, flowdata, r, c);
40
+ }
41
+ });
42
+ onCommentBoxMoveStart(context, refs.globalCache, nativeEvent, {
43
+ r: r,
44
+ c: c,
45
+ rc: rc
46
+ }, commentId);
47
+ e.stopPropagation();
48
+ };
49
+ };
34
50
  return /*#__PURE__*/React.createElement("div", {
35
51
  id: "luckysheet-postil-showBoxs"
36
52
  }, _.concat((_a = context.commentBoxes) === null || _a === void 0 ? void 0 : _a.filter(function (v) {
@@ -71,17 +87,6 @@ var NotationBoxes = function NotationBoxes() {
71
87
  boxShadow: "0 1px 1px #0000002e,0 4px 8px #0000001a"
72
88
  },
73
89
  onMouseDown: function onMouseDown(e) {
74
- var nativeEvent = e.nativeEvent;
75
- setContext(function (draftContext) {
76
- if (flowdata) {
77
- setEditingComment(draftContext, flowdata, r, c);
78
- }
79
- });
80
- onCommentBoxMoveStart(context, refs.globalCache, nativeEvent, {
81
- r: r,
82
- c: c,
83
- rc: rc
84
- }, commentId);
85
90
  e.stopPropagation();
86
91
  }
87
92
  }, /*#__PURE__*/React.createElement("div", {
@@ -90,7 +95,7 @@ var NotationBoxes = function NotationBoxes() {
90
95
  height: "100%",
91
96
  overflow: "hidden"
92
97
  }
93
- }, (_b = settings.getCommentCellUI) === null || _b === void 0 ? void 0 : _b.call(settings, r, c))));
98
+ }, (_b = settings.getCommentCellUI) === null || _b === void 0 ? void 0 : _b.call(settings, r, c, handleMouseDownEvent(r, c, rc, commentId)))));
94
99
  }));
95
100
  };
96
101
  export default NotationBoxes;
@@ -65,8 +65,8 @@ var FormulaHint = function FormulaHint(props) {
65
65
  var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
66
66
  var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
67
67
  var topV = hintAbove ? selectionHeight - (divOffset + 30) : selectionHeight + 4;
68
- var el = (_e = document.getElementsByClassName('fx-hint')) === null || _e === void 0 ? void 0 : _e[0];
69
- if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== 'none') {
68
+ var el = (_e = document.getElementsByClassName("fx-hint")) === null || _e === void 0 ? void 0 : _e[0];
69
+ if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== "none") {
70
70
  topV = 25;
71
71
  }
72
72
  setTop(topV);
@@ -46,8 +46,8 @@ var FormulaSearch = function FormulaSearch(props) {
46
46
  var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
47
47
  var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
48
48
  var topV = hintAbove ? selectionHeight - (divOffset + 80) : selectionHeight + 4;
49
- var el = (_e = document.getElementsByClassName('fx-hint')) === null || _e === void 0 ? void 0 : _e[0];
50
- if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== 'none') {
49
+ var el = (_e = document.getElementsByClassName("fx-hint")) === null || _e === void 0 ? void 0 : _e[0];
50
+ if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== "none") {
51
51
  topV = 25;
52
52
  }
53
53
  setTop(topV);
@@ -1508,7 +1508,7 @@ var Toolbar = function Toolbar(_a) {
1508
1508
  setContext(function (ctx) {
1509
1509
  var d = getFlowdata(ctx);
1510
1510
  if (d == null) return;
1511
- updateFormat(ctx, refs.cellInput.current, d, "tb", value);
1511
+ updateFormat(ctx, refs.cellInput.current, d, "tb", value, refs.canvas.current.getContext("2d"));
1512
1512
  });
1513
1513
  setOpen(false);
1514
1514
  },
@@ -234,7 +234,7 @@ var FxEditor = function FxEditor() {
234
234
  onChange: onChange,
235
235
  tabIndex: 0,
236
236
  allowEdit: allowEdit && !context.isFlvReadOnly
237
- }), showSearchHint && /*#__PURE__*/_react.default.createElement(_FormulaSearch.default, {
237
+ }), showSearchHint && (/*#__PURE__*/_react.default.createElement(_FormulaSearch.default, {
238
238
  onMouseMove: function onMouseMove(e) {
239
239
  if (document.getElementById("luckysheet-formula-search-c")) {
240
240
  var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
@@ -243,7 +243,7 @@ var FxEditor = function FxEditor() {
243
243
  }
244
244
  e.preventDefault();
245
245
  }
246
- }), /*#__PURE__*/_react.default.createElement("div", {
246
+ })), /*#__PURE__*/_react.default.createElement("div", {
247
247
  className: "fx-hint"
248
248
  }, context.functionHint && ((_c = (_b = refs.fxInput) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.innerText.includes("(")) && (/*#__PURE__*/_react.default.createElement(_FormulaHint.default, {
249
249
  handleShowFormulaHint: handleShowFormulaHint,
@@ -40,6 +40,22 @@ var NotationBoxes = function NotationBoxes() {
40
40
  });
41
41
  }
42
42
  }, [flowdata, setContext]);
43
+ var handleMouseDownEvent = function handleMouseDownEvent(r, c, rc, commentId) {
44
+ return function (e) {
45
+ var nativeEvent = e.nativeEvent;
46
+ setContext(function (draftContext) {
47
+ if (flowdata) {
48
+ (0, _fortuneCore.setEditingComment)(draftContext, flowdata, r, c);
49
+ }
50
+ });
51
+ (0, _fortuneCore.onCommentBoxMoveStart)(context, refs.globalCache, nativeEvent, {
52
+ r: r,
53
+ c: c,
54
+ rc: rc
55
+ }, commentId);
56
+ e.stopPropagation();
57
+ };
58
+ };
43
59
  return /*#__PURE__*/_react.default.createElement("div", {
44
60
  id: "luckysheet-postil-showBoxs"
45
61
  }, _lodash.default.concat((_a = context.commentBoxes) === null || _a === void 0 ? void 0 : _a.filter(function (v) {
@@ -80,17 +96,6 @@ var NotationBoxes = function NotationBoxes() {
80
96
  boxShadow: "0 1px 1px #0000002e,0 4px 8px #0000001a"
81
97
  },
82
98
  onMouseDown: function onMouseDown(e) {
83
- var nativeEvent = e.nativeEvent;
84
- setContext(function (draftContext) {
85
- if (flowdata) {
86
- (0, _fortuneCore.setEditingComment)(draftContext, flowdata, r, c);
87
- }
88
- });
89
- (0, _fortuneCore.onCommentBoxMoveStart)(context, refs.globalCache, nativeEvent, {
90
- r: r,
91
- c: c,
92
- rc: rc
93
- }, commentId);
94
99
  e.stopPropagation();
95
100
  }
96
101
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -99,7 +104,7 @@ var NotationBoxes = function NotationBoxes() {
99
104
  height: "100%",
100
105
  overflow: "hidden"
101
106
  }
102
- }, (_b = settings.getCommentCellUI) === null || _b === void 0 ? void 0 : _b.call(settings, r, c))));
107
+ }, (_b = settings.getCommentCellUI) === null || _b === void 0 ? void 0 : _b.call(settings, r, c, handleMouseDownEvent(r, c, rc, commentId)))));
103
108
  }));
104
109
  };
105
110
  var _default = exports.default = NotationBoxes;
@@ -74,8 +74,8 @@ var FormulaHint = function FormulaHint(props) {
74
74
  var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
75
75
  var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
76
76
  var topV = hintAbove ? selectionHeight - (divOffset + 30) : selectionHeight + 4;
77
- var el = (_e = document.getElementsByClassName('fx-hint')) === null || _e === void 0 ? void 0 : _e[0];
78
- if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== 'none') {
77
+ var el = (_e = document.getElementsByClassName("fx-hint")) === null || _e === void 0 ? void 0 : _e[0];
78
+ if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== "none") {
79
79
  topV = 25;
80
80
  }
81
81
  setTop(topV);
@@ -55,8 +55,8 @@ var FormulaSearch = function FormulaSearch(props) {
55
55
  var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
56
56
  var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
57
57
  var topV = hintAbove ? selectionHeight - (divOffset + 80) : selectionHeight + 4;
58
- var el = (_e = document.getElementsByClassName('fx-hint')) === null || _e === void 0 ? void 0 : _e[0];
59
- if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== 'none') {
58
+ var el = (_e = document.getElementsByClassName("fx-hint")) === null || _e === void 0 ? void 0 : _e[0];
59
+ if (el && ((_f = el === null || el === void 0 ? void 0 : el.style) === null || _f === void 0 ? void 0 : _f.display) !== "none") {
60
60
  topV = 25;
61
61
  }
62
62
  setTop(topV);
@@ -1517,7 +1517,7 @@ var Toolbar = function Toolbar(_a) {
1517
1517
  setContext(function (ctx) {
1518
1518
  var d = (0, _fortuneCore.getFlowdata)(ctx);
1519
1519
  if (d == null) return;
1520
- (0, _fortuneCore.updateFormat)(ctx, refs.cellInput.current, d, "tb", value);
1520
+ (0, _fortuneCore.updateFormat)(ctx, refs.cellInput.current, d, "tb", value, refs.canvas.current.getContext("2d"));
1521
1521
  });
1522
1522
  setOpen(false);
1523
1523
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.24",
3
+ "version": "1.2.25",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.2.24",
19
+ "@fileverse-dev/fortune-core": "1.2.25",
20
20
  "@fileverse/ui": "^4.1.7-patch-40",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",