@fileverse-dev/fortune-react 1.2.90-bold-1 → 1.2.90-bold-3
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.
|
@@ -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, handleItalic, handleUnderline, handleStrikeThrough } 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";
|
|
@@ -268,15 +268,15 @@ var InputBox = function InputBox() {
|
|
|
268
268
|
};
|
|
269
269
|
var onKeyDown = useCallback(function (e) {
|
|
270
270
|
var _a, _b;
|
|
271
|
-
if (isComposingRef.current || !inputRef.current) {
|
|
272
|
-
ensureNotEmpty();
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
271
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
276
272
|
preText.current = inputRef.current.innerText;
|
|
277
|
-
if (e.metaKey) {
|
|
278
|
-
if (e.code === "KeyB") {
|
|
273
|
+
if (e.metaKey && context.luckysheetCellUpdate.length > 0) {
|
|
274
|
+
if (e.code === "KeyB") {
|
|
275
|
+
handleBold(context, inputRef.current);
|
|
276
|
+
stopPropagation(e);
|
|
277
|
+
} else if (e.code === "KeyI") {
|
|
279
278
|
handleItalic(context, inputRef.current);
|
|
279
|
+
stopPropagation(e);
|
|
280
280
|
} else if (e.code === "KeyU") {
|
|
281
281
|
handleUnderline(context, inputRef.current);
|
|
282
282
|
stopPropagation(e);
|
|
@@ -291,7 +291,7 @@ var InputBox = function InputBox() {
|
|
|
291
291
|
}
|
|
292
292
|
var allowListNavigation = true;
|
|
293
293
|
if (e.key === "Delete" || e.key === "Backspace") {
|
|
294
|
-
requestAnimationFrame(ensureNotEmpty);
|
|
294
|
+
if (isComposingRef.current) requestAnimationFrame(ensureNotEmpty);
|
|
295
295
|
if (getCursorPosition(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length)) {
|
|
296
296
|
setTimeout(function () {
|
|
297
297
|
moveCursorToEnd(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
@@ -585,7 +585,11 @@ var InputBox = function InputBox() {
|
|
|
585
585
|
onCompositionUpdate: function onCompositionUpdate() {
|
|
586
586
|
isComposingRef.current = true;
|
|
587
587
|
},
|
|
588
|
-
onCompositionEnd: function onCompositionEnd() {
|
|
588
|
+
onCompositionEnd: function onCompositionEnd(e) {
|
|
589
|
+
if (e.data === "" && e.currentTarget.value === "") {
|
|
590
|
+
isComposingRef.current = true;
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
589
593
|
ensureNotEmpty();
|
|
590
594
|
isComposingRef.current = false;
|
|
591
595
|
},
|
|
@@ -503,7 +503,6 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
503
503
|
var resetDeleteRowTimer;
|
|
504
504
|
var onKeyDown = useCallback(function (e) {
|
|
505
505
|
var _a, _b;
|
|
506
|
-
console.log("onKeyDown", e);
|
|
507
506
|
var _c = ref.current,
|
|
508
507
|
getSelection = _c.getSelection,
|
|
509
508
|
getSheet = _c.getSheet,
|
|
@@ -645,7 +644,6 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
645
644
|
return;
|
|
646
645
|
}
|
|
647
646
|
setContextWithProduce(function (draftCtx) {
|
|
648
|
-
console.log("handleGlobalKeyDown");
|
|
649
647
|
handleGlobalKeyDown(draftCtx, cellInput.current, fxInput.current, nativeEvent, globalCache.current, handleUndo, handleRedo, canvas.current.getContext("2d"));
|
|
650
648
|
});
|
|
651
649
|
}, [handleRedo, handleUndo, setContextWithProduce]);
|
|
@@ -277,15 +277,15 @@ var InputBox = function InputBox() {
|
|
|
277
277
|
};
|
|
278
278
|
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
279
279
|
var _a, _b;
|
|
280
|
-
if (isComposingRef.current || !inputRef.current) {
|
|
281
|
-
ensureNotEmpty();
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
280
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
285
281
|
preText.current = inputRef.current.innerText;
|
|
286
|
-
if (e.metaKey) {
|
|
287
|
-
if (e.code === "KeyB") {
|
|
282
|
+
if (e.metaKey && context.luckysheetCellUpdate.length > 0) {
|
|
283
|
+
if (e.code === "KeyB") {
|
|
284
|
+
(0, _fortuneCore.handleBold)(context, inputRef.current);
|
|
285
|
+
stopPropagation(e);
|
|
286
|
+
} else if (e.code === "KeyI") {
|
|
288
287
|
(0, _fortuneCore.handleItalic)(context, inputRef.current);
|
|
288
|
+
stopPropagation(e);
|
|
289
289
|
} else if (e.code === "KeyU") {
|
|
290
290
|
(0, _fortuneCore.handleUnderline)(context, inputRef.current);
|
|
291
291
|
stopPropagation(e);
|
|
@@ -300,7 +300,7 @@ var InputBox = function InputBox() {
|
|
|
300
300
|
}
|
|
301
301
|
var allowListNavigation = true;
|
|
302
302
|
if (e.key === "Delete" || e.key === "Backspace") {
|
|
303
|
-
requestAnimationFrame(ensureNotEmpty);
|
|
303
|
+
if (isComposingRef.current) requestAnimationFrame(ensureNotEmpty);
|
|
304
304
|
if ((0, _helper.getCursorPosition)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length)) {
|
|
305
305
|
setTimeout(function () {
|
|
306
306
|
(0, _helper.moveCursorToEnd)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
@@ -594,7 +594,11 @@ var InputBox = function InputBox() {
|
|
|
594
594
|
onCompositionUpdate: function onCompositionUpdate() {
|
|
595
595
|
isComposingRef.current = true;
|
|
596
596
|
},
|
|
597
|
-
onCompositionEnd: function onCompositionEnd() {
|
|
597
|
+
onCompositionEnd: function onCompositionEnd(e) {
|
|
598
|
+
if (e.data === "" && e.currentTarget.value === "") {
|
|
599
|
+
isComposingRef.current = true;
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
598
602
|
ensureNotEmpty();
|
|
599
603
|
isComposingRef.current = false;
|
|
600
604
|
},
|
|
@@ -512,7 +512,6 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
512
512
|
var resetDeleteRowTimer;
|
|
513
513
|
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
514
514
|
var _a, _b;
|
|
515
|
-
console.log("onKeyDown", e);
|
|
516
515
|
var _c = ref.current,
|
|
517
516
|
getSelection = _c.getSelection,
|
|
518
517
|
getSheet = _c.getSheet,
|
|
@@ -654,7 +653,6 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
654
653
|
return;
|
|
655
654
|
}
|
|
656
655
|
setContextWithProduce(function (draftCtx) {
|
|
657
|
-
console.log("handleGlobalKeyDown");
|
|
658
656
|
(0, _fortuneCore.handleGlobalKeyDown)(draftCtx, cellInput.current, fxInput.current, nativeEvent, globalCache.current, handleUndo, handleRedo, canvas.current.getContext("2d"));
|
|
659
657
|
});
|
|
660
658
|
}, [handleRedo, handleUndo, setContextWithProduce]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.2.90-bold-
|
|
3
|
+
"version": "1.2.90-bold-3",
|
|
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.90-bold-
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.90-bold-3",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|