frst-components 0.22.16 → 0.22.18
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,18 @@ 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`);
|
|
3587
|
+
debugger;
|
|
3585
3588
|
// create a textnode with the placeholder
|
|
3586
3589
|
divInputRef.current.innerText = placeholder;
|
|
3587
3590
|
setPlaceholder(true);
|
|
3588
3591
|
}
|
|
3589
3592
|
else if (!focus && divInputRef.current.childNodes.length >= 1) {
|
|
3593
|
+
debugger;
|
|
3594
|
+
console.log(`placeholder vou incluir 2 o placeholder`);
|
|
3590
3595
|
// loop over all child element and check if they are empty
|
|
3591
3596
|
let isEmpty = true;
|
|
3592
3597
|
divInputRef.current.childNodes.forEach((child) => {
|
|
@@ -3594,6 +3599,10 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3594
3599
|
isEmpty = false;
|
|
3595
3600
|
setPlaceholder(false);
|
|
3596
3601
|
}
|
|
3602
|
+
else if (child.textContent === placeholder) {
|
|
3603
|
+
console.log(`placeholder child.textContent === placeholder resultado = ${child.textContent === placeholder}`);
|
|
3604
|
+
divInputRef.current.blur();
|
|
3605
|
+
}
|
|
3597
3606
|
});
|
|
3598
3607
|
console.log('placeholder isEmpty = ', isEmpty);
|
|
3599
3608
|
// if they are empty show the placeholder
|
|
@@ -3604,6 +3613,8 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3604
3613
|
}
|
|
3605
3614
|
}
|
|
3606
3615
|
else if (divInputRef.current.innerText === placeholder) {
|
|
3616
|
+
console.log(`placeholder terceiro divInputRef.current.innerText === placeholder resultado = ${divInputRef.current.innerText === placeholder}`);
|
|
3617
|
+
debugger;
|
|
3607
3618
|
// create a paragraph node
|
|
3608
3619
|
divInputRef.current.innerHTML = '';
|
|
3609
3620
|
// clear complete the div
|
|
@@ -3615,6 +3626,7 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3615
3626
|
divInputRef.current.appendChild(p);
|
|
3616
3627
|
console.log(`placeholder divInputRef.current.innerHtml= ${divInputRef.current.innerHTML}`);
|
|
3617
3628
|
setPlaceholder(false);
|
|
3629
|
+
divInputRef.current.blur();
|
|
3618
3630
|
}
|
|
3619
3631
|
};
|
|
3620
3632
|
React.useEffect(() => {
|
|
@@ -3624,7 +3636,7 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3624
3636
|
};
|
|
3625
3637
|
}, []);
|
|
3626
3638
|
React.useEffect(() => {
|
|
3627
|
-
if (!replyMentionedUser)
|
|
3639
|
+
if (!replyMentionedUser || !divInputRef?.current)
|
|
3628
3640
|
return;
|
|
3629
3641
|
divInputRef.current?.focus();
|
|
3630
3642
|
const selection = window.getSelection();
|
|
@@ -3636,7 +3648,6 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3636
3648
|
const spaceNode = document.createTextNode('\u00A0'); // Unicode for non-breaking space
|
|
3637
3649
|
addMentionToRangeAndSpaceNode(range, spaceNode, mentionedUser);
|
|
3638
3650
|
createNewRangeAndMoveCursorToTheEnd(selection, spaceNode);
|
|
3639
|
-
divInputRef.current?.focus();
|
|
3640
3651
|
}
|
|
3641
3652
|
}, [replyMentionedUser]);
|
|
3642
3653
|
React.useEffect(() => {
|
|
@@ -3885,7 +3896,7 @@ const Mentions = (mention) => {
|
|
|
3885
3896
|
|
|
3886
3897
|
function InputComment$1({ placeholder, onChange, limit, users, showCharacterCounter, styles, onSendMentions, onContentFormat, onContentUnformat, disabled, className, value, replyMentionedUser, group_uuid, limitMessageExceeded }) {
|
|
3887
3898
|
const { handleInput, isPlaceholder, focus, divInputRef, handleMentionUser, mentionTopPosition, setShowMention, showMention, textLength, styleLimitExceeded } = useInputHook({ limit, placeholder, onContentFormat, onContentUnformat, onSendMentions, onChange, value, replyMentionedUser });
|
|
3888
|
-
return (jsxRuntime.jsx(styled.ThemeProvider, { theme: FRSTTheme, children: jsxRuntime.jsxs("div", { style: { minHeight: '48px', ...styles }, tabIndex: 0, children: [jsxRuntime.jsxs(InputWrapper$2, { focus: focus, tabIndex: 1, isPlaceholder: isPlaceholder, isInputLimit: styleLimitExceeded, children: [jsxRuntime.jsx(InputText$4, { tabIndex: 2, contentEditable: true, ref: divInputRef, onKeyUpCapture: (event) => {
|
|
3899
|
+
return (jsxRuntime.jsx(styled.ThemeProvider, { theme: FRSTTheme, children: jsxRuntime.jsxs("div", { style: { minHeight: '48px', ...styles }, tabIndex: 0, contentEditable: false, children: [jsxRuntime.jsxs(InputWrapper$2, { focus: focus, tabIndex: 1, isPlaceholder: isPlaceholder, isInputLimit: styleLimitExceeded, contentEditable: false, children: [jsxRuntime.jsx(InputText$4, { tabIndex: 2, contentEditable: true, ref: divInputRef, onKeyUpCapture: (event) => {
|
|
3889
3900
|
handleInput(event);
|
|
3890
3901
|
}, "data-text": "enter", isPlaceholder: isPlaceholder, suppressContentEditableWarning: true, children: jsxRuntime.jsx("p", { children: jsxRuntime.jsx("br", {}) }) }), showMention && users && users.length > 0 && jsxRuntime.jsx(Mentions, { users: users, top: mentionTopPosition, onSelect: (user) => {
|
|
3891
3902
|
setShowMention(false);
|
|
@@ -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,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;;;;CA4TxC,CAAA"}
|