@fileverse-dev/fortune-react 1.2.62 → 1.2.64
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.
|
@@ -279,8 +279,30 @@ var FxEditor = function FxEditor() {
|
|
|
279
279
|
}
|
|
280
280
|
return true;
|
|
281
281
|
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
var divRef = useRef(null);
|
|
283
|
+
var _j = useState(false),
|
|
284
|
+
isResizing = _j[0],
|
|
285
|
+
setIsResizing = _j[1];
|
|
286
|
+
var startResize = function startResize(e) {
|
|
287
|
+
e.preventDefault();
|
|
288
|
+
setIsResizing(true);
|
|
289
|
+
var startY = e.clientY;
|
|
290
|
+
var startHeight = divRef.current.offsetHeight;
|
|
291
|
+
var onMouseMove = function onMouseMove(ev) {
|
|
292
|
+
var newHeight = startHeight + (ev.clientY - startY);
|
|
293
|
+
divRef.current.style.height = "".concat(Math.max(newHeight, 20), "px");
|
|
294
|
+
};
|
|
295
|
+
var _onMouseUp = function onMouseUp() {
|
|
296
|
+
setIsResizing(false);
|
|
297
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
298
|
+
document.removeEventListener("mouseup", _onMouseUp);
|
|
299
|
+
};
|
|
300
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
301
|
+
document.addEventListener("mouseup", _onMouseUp);
|
|
302
|
+
};
|
|
303
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
304
|
+
className: "fortune-fx-editor",
|
|
305
|
+
ref: divRef
|
|
284
306
|
}, /*#__PURE__*/React.createElement(NameBox, null), /*#__PURE__*/React.createElement("div", {
|
|
285
307
|
className: "fortune-fx-icon"
|
|
286
308
|
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
@@ -347,6 +369,13 @@ var FxEditor = function FxEditor() {
|
|
|
347
369
|
margin: "auto",
|
|
348
370
|
marginTop: "1px"
|
|
349
371
|
}
|
|
350
|
-
}))))))
|
|
372
|
+
})))))), /*#__PURE__*/React.createElement("div", {
|
|
373
|
+
className: "resize-handle",
|
|
374
|
+
onMouseDown: startResize,
|
|
375
|
+
style: {
|
|
376
|
+
cursor: isResizing ? "grabbing" : "ns-resize",
|
|
377
|
+
height: "2px"
|
|
378
|
+
}
|
|
379
|
+
}));
|
|
351
380
|
};
|
|
352
381
|
export default FxEditor;
|
|
@@ -8,7 +8,7 @@ var __assign = this && this.__assign || function () {
|
|
|
8
8
|
};
|
|
9
9
|
return __assign.apply(this, arguments);
|
|
10
10
|
};
|
|
11
|
-
import { cancelNormalSelected, getCellValue, getInlineStringHTML, getStyleByCell, isInlineStringCell, moveToEnd, getFlowdata, handleFormulaInput, moveHighlightCell, escapeScriptTag, valueShowEs, createRangeHightlight, isShowHidenCR, israngeseleciton, escapeHTMLTag, isAllowEdit, getrangeseleciton, indexToColumnChar } from "@fileverse-dev/fortune-core";
|
|
11
|
+
import { cancelNormalSelected, getCellValue, getInlineStringHTML, getStyleByCell, isInlineStringCell, moveToEnd, getFlowdata, handleFormulaInput, moveHighlightCell, escapeScriptTag, valueShowEs, createRangeHightlight, isShowHidenCR, israngeseleciton, escapeHTMLTag, isAllowEdit, getrangeseleciton, indexToColumnChar, handleBold, handleItalic, handleUnderline, handleStrikeThrough } from "@fileverse-dev/fortune-core";
|
|
12
12
|
import React, { useContext, useEffect, useMemo, useRef, useCallback, useLayoutEffect, useState } from "react";
|
|
13
13
|
import _ from "lodash";
|
|
14
14
|
import { Tooltip } from "@fileverse/ui";
|
|
@@ -245,10 +245,29 @@ var InputBox = function InputBox() {
|
|
|
245
245
|
e.stopPropagation();
|
|
246
246
|
}
|
|
247
247
|
}, [getActiveFormula, insertSelectedFormula]);
|
|
248
|
+
var stopPropagation = function stopPropagation(event) {
|
|
249
|
+
event.stopPropagation();
|
|
250
|
+
event.preventDefault();
|
|
251
|
+
};
|
|
248
252
|
var onKeyDown = useCallback(function (e) {
|
|
249
253
|
var _a, _b;
|
|
250
254
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
251
255
|
preText.current = inputRef.current.innerText;
|
|
256
|
+
if (e.metaKey) {
|
|
257
|
+
if (e.code === "KeyB") {
|
|
258
|
+
handleBold(context, inputRef.current);
|
|
259
|
+
stopPropagation(e);
|
|
260
|
+
} else if (e.code === "KeyI") {
|
|
261
|
+
handleItalic(context, inputRef.current);
|
|
262
|
+
stopPropagation(e);
|
|
263
|
+
} else if (e.code === "KeyU") {
|
|
264
|
+
handleUnderline(context, inputRef.current);
|
|
265
|
+
stopPropagation(e);
|
|
266
|
+
} else if (e.code === "KeyS") {
|
|
267
|
+
handleStrikeThrough(context, inputRef.current);
|
|
268
|
+
stopPropagation(e);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
252
271
|
var currentCommaCount = countCommasBeforeCursor(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
253
272
|
setCommaCount(currentCommaCount);
|
|
254
273
|
var allowListNavigation = true;
|
|
@@ -288,8 +288,30 @@ var FxEditor = function FxEditor() {
|
|
|
288
288
|
}
|
|
289
289
|
return true;
|
|
290
290
|
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
var divRef = (0, _react.useRef)(null);
|
|
292
|
+
var _j = (0, _react.useState)(false),
|
|
293
|
+
isResizing = _j[0],
|
|
294
|
+
setIsResizing = _j[1];
|
|
295
|
+
var startResize = function startResize(e) {
|
|
296
|
+
e.preventDefault();
|
|
297
|
+
setIsResizing(true);
|
|
298
|
+
var startY = e.clientY;
|
|
299
|
+
var startHeight = divRef.current.offsetHeight;
|
|
300
|
+
var onMouseMove = function onMouseMove(ev) {
|
|
301
|
+
var newHeight = startHeight + (ev.clientY - startY);
|
|
302
|
+
divRef.current.style.height = "".concat(Math.max(newHeight, 20), "px");
|
|
303
|
+
};
|
|
304
|
+
var _onMouseUp = function onMouseUp() {
|
|
305
|
+
setIsResizing(false);
|
|
306
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
307
|
+
document.removeEventListener("mouseup", _onMouseUp);
|
|
308
|
+
};
|
|
309
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
310
|
+
document.addEventListener("mouseup", _onMouseUp);
|
|
311
|
+
};
|
|
312
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
313
|
+
className: "fortune-fx-editor",
|
|
314
|
+
ref: divRef
|
|
293
315
|
}, /*#__PURE__*/_react.default.createElement(_NameBox.default, null), /*#__PURE__*/_react.default.createElement("div", {
|
|
294
316
|
className: "fortune-fx-icon"
|
|
295
317
|
}, /*#__PURE__*/_react.default.createElement(_LucideIcon.LucideIcon, {
|
|
@@ -356,6 +378,13 @@ var FxEditor = function FxEditor() {
|
|
|
356
378
|
margin: "auto",
|
|
357
379
|
marginTop: "1px"
|
|
358
380
|
}
|
|
359
|
-
}))))))
|
|
381
|
+
})))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
382
|
+
className: "resize-handle",
|
|
383
|
+
onMouseDown: startResize,
|
|
384
|
+
style: {
|
|
385
|
+
cursor: isResizing ? "grabbing" : "ns-resize",
|
|
386
|
+
height: "2px"
|
|
387
|
+
}
|
|
388
|
+
}));
|
|
360
389
|
};
|
|
361
390
|
var _default = exports.default = FxEditor;
|
|
@@ -254,10 +254,29 @@ var InputBox = function InputBox() {
|
|
|
254
254
|
e.stopPropagation();
|
|
255
255
|
}
|
|
256
256
|
}, [getActiveFormula, insertSelectedFormula]);
|
|
257
|
+
var stopPropagation = function stopPropagation(event) {
|
|
258
|
+
event.stopPropagation();
|
|
259
|
+
event.preventDefault();
|
|
260
|
+
};
|
|
257
261
|
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
258
262
|
var _a, _b;
|
|
259
263
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
260
264
|
preText.current = inputRef.current.innerText;
|
|
265
|
+
if (e.metaKey) {
|
|
266
|
+
if (e.code === "KeyB") {
|
|
267
|
+
(0, _fortuneCore.handleBold)(context, inputRef.current);
|
|
268
|
+
stopPropagation(e);
|
|
269
|
+
} else if (e.code === "KeyI") {
|
|
270
|
+
(0, _fortuneCore.handleItalic)(context, inputRef.current);
|
|
271
|
+
stopPropagation(e);
|
|
272
|
+
} else if (e.code === "KeyU") {
|
|
273
|
+
(0, _fortuneCore.handleUnderline)(context, inputRef.current);
|
|
274
|
+
stopPropagation(e);
|
|
275
|
+
} else if (e.code === "KeyS") {
|
|
276
|
+
(0, _fortuneCore.handleStrikeThrough)(context, inputRef.current);
|
|
277
|
+
stopPropagation(e);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
261
280
|
var currentCommaCount = (0, _helper.countCommasBeforeCursor)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
262
281
|
setCommaCount(currentCommaCount);
|
|
263
282
|
var allowListNavigation = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.64",
|
|
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.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.64",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|