@fileverse-dev/fortune-react 1.2.90-bold-1 → 1.2.90-bold-2
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";
|
|
@@ -71,6 +71,7 @@ var InputBox = function InputBox() {
|
|
|
71
71
|
var el = inputRef.current;
|
|
72
72
|
if (!el) return;
|
|
73
73
|
var text = el.textContent;
|
|
74
|
+
console.log(text, "yoooo");
|
|
74
75
|
if (!text || text === ZWSP) {
|
|
75
76
|
el.innerHTML = ZWSP;
|
|
76
77
|
moveCursorToEnd(el);
|
|
@@ -268,19 +269,23 @@ var InputBox = function InputBox() {
|
|
|
268
269
|
};
|
|
269
270
|
var onKeyDown = useCallback(function (e) {
|
|
270
271
|
var _a, _b;
|
|
271
|
-
|
|
272
|
-
ensureNotEmpty();
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
272
|
+
console.log(e.code, "onKeyDown in InputBox");
|
|
275
273
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
276
274
|
preText.current = inputRef.current.innerText;
|
|
277
|
-
if (e.metaKey) {
|
|
278
|
-
|
|
275
|
+
if (e.metaKey && context.luckysheetCellUpdate.length > 0) {
|
|
276
|
+
console.log(e.code, "e.code");
|
|
277
|
+
if (e.code === "KeyB") {
|
|
278
|
+
handleBold(context, inputRef.current);
|
|
279
|
+
stopPropagation(e);
|
|
280
|
+
} else if (e.code === "KeyI") {
|
|
279
281
|
handleItalic(context, inputRef.current);
|
|
282
|
+
stopPropagation(e);
|
|
280
283
|
} else if (e.code === "KeyU") {
|
|
284
|
+
console.log("underline");
|
|
281
285
|
handleUnderline(context, inputRef.current);
|
|
282
286
|
stopPropagation(e);
|
|
283
287
|
} else if (e.code === "KeyS") {
|
|
288
|
+
console.log("strikethrough");
|
|
284
289
|
handleStrikeThrough(context, inputRef.current);
|
|
285
290
|
stopPropagation(e);
|
|
286
291
|
}
|
|
@@ -291,7 +296,7 @@ var InputBox = function InputBox() {
|
|
|
291
296
|
}
|
|
292
297
|
var allowListNavigation = true;
|
|
293
298
|
if (e.key === "Delete" || e.key === "Backspace") {
|
|
294
|
-
requestAnimationFrame(ensureNotEmpty);
|
|
299
|
+
if (isComposingRef.current) requestAnimationFrame(ensureNotEmpty);
|
|
295
300
|
if (getCursorPosition(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length)) {
|
|
296
301
|
setTimeout(function () {
|
|
297
302
|
moveCursorToEnd(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
@@ -585,7 +590,11 @@ var InputBox = function InputBox() {
|
|
|
585
590
|
onCompositionUpdate: function onCompositionUpdate() {
|
|
586
591
|
isComposingRef.current = true;
|
|
587
592
|
},
|
|
588
|
-
onCompositionEnd: function onCompositionEnd() {
|
|
593
|
+
onCompositionEnd: function onCompositionEnd(e) {
|
|
594
|
+
if (e.data === "" && e.currentTarget.value === "") {
|
|
595
|
+
isComposingRef.current = true;
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
589
598
|
ensureNotEmpty();
|
|
590
599
|
isComposingRef.current = false;
|
|
591
600
|
},
|
|
@@ -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]);
|
|
@@ -80,6 +80,7 @@ var InputBox = function InputBox() {
|
|
|
80
80
|
var el = inputRef.current;
|
|
81
81
|
if (!el) return;
|
|
82
82
|
var text = el.textContent;
|
|
83
|
+
console.log(text, "yoooo");
|
|
83
84
|
if (!text || text === ZWSP) {
|
|
84
85
|
el.innerHTML = ZWSP;
|
|
85
86
|
(0, _helper.moveCursorToEnd)(el);
|
|
@@ -277,19 +278,23 @@ var InputBox = function InputBox() {
|
|
|
277
278
|
};
|
|
278
279
|
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
279
280
|
var _a, _b;
|
|
280
|
-
|
|
281
|
-
ensureNotEmpty();
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
281
|
+
console.log(e.code, "onKeyDown in InputBox");
|
|
284
282
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
285
283
|
preText.current = inputRef.current.innerText;
|
|
286
|
-
if (e.metaKey) {
|
|
287
|
-
|
|
284
|
+
if (e.metaKey && context.luckysheetCellUpdate.length > 0) {
|
|
285
|
+
console.log(e.code, "e.code");
|
|
286
|
+
if (e.code === "KeyB") {
|
|
287
|
+
(0, _fortuneCore.handleBold)(context, inputRef.current);
|
|
288
|
+
stopPropagation(e);
|
|
289
|
+
} else if (e.code === "KeyI") {
|
|
288
290
|
(0, _fortuneCore.handleItalic)(context, inputRef.current);
|
|
291
|
+
stopPropagation(e);
|
|
289
292
|
} else if (e.code === "KeyU") {
|
|
293
|
+
console.log("underline");
|
|
290
294
|
(0, _fortuneCore.handleUnderline)(context, inputRef.current);
|
|
291
295
|
stopPropagation(e);
|
|
292
296
|
} else if (e.code === "KeyS") {
|
|
297
|
+
console.log("strikethrough");
|
|
293
298
|
(0, _fortuneCore.handleStrikeThrough)(context, inputRef.current);
|
|
294
299
|
stopPropagation(e);
|
|
295
300
|
}
|
|
@@ -300,7 +305,7 @@ var InputBox = function InputBox() {
|
|
|
300
305
|
}
|
|
301
306
|
var allowListNavigation = true;
|
|
302
307
|
if (e.key === "Delete" || e.key === "Backspace") {
|
|
303
|
-
requestAnimationFrame(ensureNotEmpty);
|
|
308
|
+
if (isComposingRef.current) requestAnimationFrame(ensureNotEmpty);
|
|
304
309
|
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
310
|
setTimeout(function () {
|
|
306
311
|
(0, _helper.moveCursorToEnd)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
@@ -594,7 +599,11 @@ var InputBox = function InputBox() {
|
|
|
594
599
|
onCompositionUpdate: function onCompositionUpdate() {
|
|
595
600
|
isComposingRef.current = true;
|
|
596
601
|
},
|
|
597
|
-
onCompositionEnd: function onCompositionEnd() {
|
|
602
|
+
onCompositionEnd: function onCompositionEnd(e) {
|
|
603
|
+
if (e.data === "" && e.currentTarget.value === "") {
|
|
604
|
+
isComposingRef.current = true;
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
598
607
|
ensureNotEmpty();
|
|
599
608
|
isComposingRef.current = false;
|
|
600
609
|
},
|
|
@@ -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-2",
|
|
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-2",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|