frst-components 0.22.15 → 0.22.16
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.
package/dist/index.js
CHANGED
|
@@ -3518,20 +3518,23 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3518
3518
|
return;
|
|
3519
3519
|
// Get the text before the cursor
|
|
3520
3520
|
const completeText = range.startContainer.textContent;
|
|
3521
|
-
textBeforeCursor = range.startContainer.textContent.substring(0, range.startOffset);
|
|
3522
3521
|
// Find the last index of "@" in the text before the cursor
|
|
3523
3522
|
const atIndex = completeText.lastIndexOf('@');
|
|
3523
|
+
textBeforeCursor = range.startContainer.textContent.substring(atIndex, range.startOffset);
|
|
3524
3524
|
hasSpaceBeForeKey = completeText.substring(atIndex - 1, atIndex).trim() === "";
|
|
3525
3525
|
console.log(`teste - completeText = ${completeText}`);
|
|
3526
3526
|
console.log(`teste textBeforeCursor ${textBeforeCursor}`);
|
|
3527
3527
|
console.log(`teste - atIndex = ${atIndex}`);
|
|
3528
3528
|
console.log(`teste - spaceBefore = ${completeText.substring(atIndex - 1, atIndex).trim() === ""}`);
|
|
3529
3529
|
console.log(`teste hasSpaceBeForeKey ${hasSpaceBeForeKey}`);
|
|
3530
|
+
console.log(`teste textBeforeCursor = @ ? ${textBeforeCursor === "@"}`);
|
|
3530
3531
|
if (hasSpaceBeForeKey || textBeforeCursor === "@") {
|
|
3531
3532
|
if (atIndex !== -1) {
|
|
3532
3533
|
// Get the characters after the last "@"
|
|
3533
3534
|
const afterAt = completeText.substring(atIndex);
|
|
3534
|
-
|
|
3535
|
+
console.log(`teste afterAt = ${afterAt}`);
|
|
3536
|
+
if (afterAt.length > 1 || event.key === "@" || textBeforeCursor === "@") {
|
|
3537
|
+
console.log(`teste hasKeyPresent ${hasKeyPresent}`);
|
|
3535
3538
|
hasKeyPresent = true;
|
|
3536
3539
|
}
|
|
3537
3540
|
inputSearch = afterAt.replace('@', '');
|
|
@@ -3554,6 +3557,7 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3554
3557
|
!!onChange && onChange(inputSearch);
|
|
3555
3558
|
}
|
|
3556
3559
|
else {
|
|
3560
|
+
console.log(`teste resultado foi ${hasSpaceBeForeKey && hasKeyPresent} e textBeforeCursor = @ ${textBeforeCursor === "@"}`);
|
|
3557
3561
|
console.log(`teste, não chamou o backend ${inputSearch}`);
|
|
3558
3562
|
}
|
|
3559
3563
|
countChars();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputHook.d.ts","sourceRoot":"","sources":["../../../../src/components/input-comment/useInputHook.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,UAAU,UAAU;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IAC5C,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,IAAI,CAAA;CAC5B;AAED,eAAO,MAAM,YAAY,oHAAqH,UAAU;yBA2HxH,mBAAmB;;;;;;;;;8BA/Ed,IAAI;;;;
|
|
1
|
+
{"version":3,"file":"useInputHook.d.ts","sourceRoot":"","sources":["../../../../src/components/input-comment/useInputHook.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,UAAU,UAAU;IAChB,KA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