@fileverse-dev/fortune-react 1.2.90 → 1.2.91

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.
@@ -268,13 +268,9 @@ 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) {
273
+ if (e.metaKey && context.luckysheetCellUpdate.length > 0) {
278
274
  if (e.code === "KeyB") {
279
275
  handleBold(context, inputRef.current);
280
276
  stopPropagation(e);
@@ -295,7 +291,7 @@ var InputBox = function InputBox() {
295
291
  }
296
292
  var allowListNavigation = true;
297
293
  if (e.key === "Delete" || e.key === "Backspace") {
298
- requestAnimationFrame(ensureNotEmpty);
294
+ if (isComposingRef.current) requestAnimationFrame(ensureNotEmpty);
299
295
  if (getCursorPosition(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length)) {
300
296
  setTimeout(function () {
301
297
  moveCursorToEnd(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
@@ -589,7 +585,11 @@ var InputBox = function InputBox() {
589
585
  onCompositionUpdate: function onCompositionUpdate() {
590
586
  isComposingRef.current = true;
591
587
  },
592
- onCompositionEnd: function onCompositionEnd() {
588
+ onCompositionEnd: function onCompositionEnd(e) {
589
+ if (e.data === "" && e.currentTarget.value === "") {
590
+ isComposingRef.current = true;
591
+ return;
592
+ }
593
593
  ensureNotEmpty();
594
594
  isComposingRef.current = false;
595
595
  },
@@ -277,13 +277,9 @@ 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) {
282
+ if (e.metaKey && context.luckysheetCellUpdate.length > 0) {
287
283
  if (e.code === "KeyB") {
288
284
  (0, _fortuneCore.handleBold)(context, inputRef.current);
289
285
  stopPropagation(e);
@@ -304,7 +300,7 @@ var InputBox = function InputBox() {
304
300
  }
305
301
  var allowListNavigation = true;
306
302
  if (e.key === "Delete" || e.key === "Backspace") {
307
- requestAnimationFrame(ensureNotEmpty);
303
+ if (isComposingRef.current) requestAnimationFrame(ensureNotEmpty);
308
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)) {
309
305
  setTimeout(function () {
310
306
  (0, _helper.moveCursorToEnd)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
@@ -598,7 +594,11 @@ var InputBox = function InputBox() {
598
594
  onCompositionUpdate: function onCompositionUpdate() {
599
595
  isComposingRef.current = true;
600
596
  },
601
- onCompositionEnd: function onCompositionEnd() {
597
+ onCompositionEnd: function onCompositionEnd(e) {
598
+ if (e.data === "" && e.currentTarget.value === "") {
599
+ isComposingRef.current = true;
600
+ return;
601
+ }
602
602
  ensureNotEmpty();
603
603
  isComposingRef.current = false;
604
604
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.90",
3
+ "version": "1.2.91",
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",
19
+ "@fileverse-dev/fortune-core": "1.2.91",
20
20
  "@fileverse/ui": "^4.1.7-patch-40",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",