frst-components 0.22.16 → 0.22.17
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
|
@@ -3470,6 +3470,7 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3470
3470
|
}
|
|
3471
3471
|
countChars();
|
|
3472
3472
|
createFormatAndTextContentToSaveComment();
|
|
3473
|
+
resizeDiv();
|
|
3473
3474
|
}
|
|
3474
3475
|
};
|
|
3475
3476
|
//create a method that increase the size of the div as the scroll height increases
|
|
@@ -3579,14 +3580,16 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3579
3580
|
const clearDivContent = () => {
|
|
3580
3581
|
if (!divInputRef.current)
|
|
3581
3582
|
return;
|
|
3582
|
-
console.log(
|
|
3583
|
-
console.log(
|
|
3583
|
+
console.log(`placeholder primeiro if divInputRef.current.childNodes.length === 0 && !focus resultado = ${divInputRef.current.childNodes.length === 0 && !focus}`);
|
|
3584
|
+
console.log(`placeholder segundo if divInputRef.current.childNodes.length >= 1 resultado = ${divInputRef.current.childNodes.length >= 1}`);
|
|
3584
3585
|
if ((divInputRef.current.childNodes.length === 0 && !focus)) {
|
|
3586
|
+
console.log(`placeholder vou incluir o placeholder`);
|
|
3585
3587
|
// create a textnode with the placeholder
|
|
3586
3588
|
divInputRef.current.innerText = placeholder;
|
|
3587
3589
|
setPlaceholder(true);
|
|
3588
3590
|
}
|
|
3589
3591
|
else if (!focus && divInputRef.current.childNodes.length >= 1) {
|
|
3592
|
+
console.log(`placeholder vou incluir o placeholder`);
|
|
3590
3593
|
// loop over all child element and check if they are empty
|
|
3591
3594
|
let isEmpty = true;
|
|
3592
3595
|
divInputRef.current.childNodes.forEach((child) => {
|
|
@@ -3594,6 +3597,10 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3594
3597
|
isEmpty = false;
|
|
3595
3598
|
setPlaceholder(false);
|
|
3596
3599
|
}
|
|
3600
|
+
else if (child.textContent === placeholder) {
|
|
3601
|
+
console.log(`placeholder child.textContent === placeholder resultado = ${child.textContent === placeholder}`);
|
|
3602
|
+
divInputRef.current.blur();
|
|
3603
|
+
}
|
|
3597
3604
|
});
|
|
3598
3605
|
console.log('placeholder isEmpty = ', isEmpty);
|
|
3599
3606
|
// if they are empty show the placeholder
|
|
@@ -3604,6 +3611,7 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3604
3611
|
}
|
|
3605
3612
|
}
|
|
3606
3613
|
else if (divInputRef.current.innerText === placeholder) {
|
|
3614
|
+
console.log(`placeholder terceiro divInputRef.current.innerText === placeholder resultado = ${divInputRef.current.innerText === placeholder}`);
|
|
3607
3615
|
// create a paragraph node
|
|
3608
3616
|
divInputRef.current.innerHTML = '';
|
|
3609
3617
|
// clear complete the div
|
|
@@ -3615,6 +3623,7 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3615
3623
|
divInputRef.current.appendChild(p);
|
|
3616
3624
|
console.log(`placeholder divInputRef.current.innerHtml= ${divInputRef.current.innerHTML}`);
|
|
3617
3625
|
setPlaceholder(false);
|
|
3626
|
+
divInputRef.current.blur();
|
|
3618
3627
|
}
|
|
3619
3628
|
};
|
|
3620
3629
|
React.useEffect(() => {
|
|
@@ -3624,7 +3633,7 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3624
3633
|
};
|
|
3625
3634
|
}, []);
|
|
3626
3635
|
React.useEffect(() => {
|
|
3627
|
-
if (!replyMentionedUser)
|
|
3636
|
+
if (!replyMentionedUser || !divInputRef?.current)
|
|
3628
3637
|
return;
|
|
3629
3638
|
divInputRef.current?.focus();
|
|
3630
3639
|
const selection = window.getSelection();
|
|
@@ -3636,7 +3645,6 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3636
3645
|
const spaceNode = document.createTextNode('\u00A0'); // Unicode for non-breaking space
|
|
3637
3646
|
addMentionToRangeAndSpaceNode(range, spaceNode, mentionedUser);
|
|
3638
3647
|
createNewRangeAndMoveCursorToTheEnd(selection, spaceNode);
|
|
3639
|
-
divInputRef.current?.focus();
|
|
3640
3648
|
}
|
|
3641
3649
|
}, [replyMentionedUser]);
|
|
3642
3650
|
React.useEffect(() => {
|
|
@@ -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,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,CAAC,QAAQ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