@fileverse-dev/fortune-react 1.2.90-bold-3 → 1.2.90-toast-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.
|
@@ -268,9 +268,13 @@ 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
|
+
}
|
|
271
275
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
272
276
|
preText.current = inputRef.current.innerText;
|
|
273
|
-
if (e.metaKey
|
|
277
|
+
if (e.metaKey) {
|
|
274
278
|
if (e.code === "KeyB") {
|
|
275
279
|
handleBold(context, inputRef.current);
|
|
276
280
|
stopPropagation(e);
|
|
@@ -291,7 +295,7 @@ var InputBox = function InputBox() {
|
|
|
291
295
|
}
|
|
292
296
|
var allowListNavigation = true;
|
|
293
297
|
if (e.key === "Delete" || e.key === "Backspace") {
|
|
294
|
-
|
|
298
|
+
requestAnimationFrame(ensureNotEmpty);
|
|
295
299
|
if (getCursorPosition(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.innerText.length)) {
|
|
296
300
|
setTimeout(function () {
|
|
297
301
|
moveCursorToEnd(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
@@ -585,11 +589,7 @@ var InputBox = function InputBox() {
|
|
|
585
589
|
onCompositionUpdate: function onCompositionUpdate() {
|
|
586
590
|
isComposingRef.current = true;
|
|
587
591
|
},
|
|
588
|
-
onCompositionEnd: function onCompositionEnd(
|
|
589
|
-
if (e.data === "" && e.currentTarget.value === "") {
|
|
590
|
-
isComposingRef.current = true;
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
592
|
+
onCompositionEnd: function onCompositionEnd() {
|
|
593
593
|
ensureNotEmpty();
|
|
594
594
|
isComposingRef.current = false;
|
|
595
595
|
},
|
|
@@ -277,9 +277,13 @@ 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
|
+
}
|
|
280
284
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
281
285
|
preText.current = inputRef.current.innerText;
|
|
282
|
-
if (e.metaKey
|
|
286
|
+
if (e.metaKey) {
|
|
283
287
|
if (e.code === "KeyB") {
|
|
284
288
|
(0, _fortuneCore.handleBold)(context, inputRef.current);
|
|
285
289
|
stopPropagation(e);
|
|
@@ -300,7 +304,7 @@ var InputBox = function InputBox() {
|
|
|
300
304
|
}
|
|
301
305
|
var allowListNavigation = true;
|
|
302
306
|
if (e.key === "Delete" || e.key === "Backspace") {
|
|
303
|
-
|
|
307
|
+
requestAnimationFrame(ensureNotEmpty);
|
|
304
308
|
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
309
|
setTimeout(function () {
|
|
306
310
|
(0, _helper.moveCursorToEnd)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
@@ -594,11 +598,7 @@ var InputBox = function InputBox() {
|
|
|
594
598
|
onCompositionUpdate: function onCompositionUpdate() {
|
|
595
599
|
isComposingRef.current = true;
|
|
596
600
|
},
|
|
597
|
-
onCompositionEnd: function onCompositionEnd(
|
|
598
|
-
if (e.data === "" && e.currentTarget.value === "") {
|
|
599
|
-
isComposingRef.current = true;
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
601
|
+
onCompositionEnd: function onCompositionEnd() {
|
|
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.90-toast-2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"tsc": "tsc"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@fileverse-dev/fortune-core": "1.2.90-
|
|
20
|
-
"@fileverse/ui": "
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.90-toast-2",
|
|
20
|
+
"@fileverse/ui": "4.2.1-toast-5",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|
|
23
23
|
"immer": "^9.0.12",
|