frst-components 0.22.21 → 0.22.22
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
|
@@ -3592,9 +3592,6 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3592
3592
|
const isFocused = divInputRef.current === document.activeElement;
|
|
3593
3593
|
if (divInputRef.current && !isFocused) {
|
|
3594
3594
|
divInputRef.current.childNodes.forEach((child) => {
|
|
3595
|
-
console.log(divInputRef.current.childNodes);
|
|
3596
|
-
console.log(divInputRef.current.innerText);
|
|
3597
|
-
console.log(child.textContent);
|
|
3598
3595
|
if (child.textContent.length <= 0) {
|
|
3599
3596
|
isEmpty = true;
|
|
3600
3597
|
}
|
|
@@ -3722,6 +3719,17 @@ const useInputHook = ({ limit, placeholder, onSendMentions, onContentFormat, onC
|
|
|
3722
3719
|
});
|
|
3723
3720
|
};
|
|
3724
3721
|
}, []);
|
|
3722
|
+
React.useEffect(() => {
|
|
3723
|
+
if (replyMentionedUser)
|
|
3724
|
+
return;
|
|
3725
|
+
if (!value || value.length <= 0 && document.activeElement !== divInputRef.current) {
|
|
3726
|
+
divPlaceholder.current?.style.setProperty('display', 'block');
|
|
3727
|
+
divInputRef.current.style.setProperty('display', 'none');
|
|
3728
|
+
divInputRef.current.innerHTML = '<p><br /></p>';
|
|
3729
|
+
setPlaceholder(true);
|
|
3730
|
+
countChars();
|
|
3731
|
+
}
|
|
3732
|
+
}, [value]);
|
|
3725
3733
|
return {
|
|
3726
3734
|
handleInput,
|
|
3727
3735
|
handlePlaceholderInputText,
|
|
@@ -3916,8 +3924,8 @@ const Mentions = (mention) => {
|
|
|
3916
3924
|
};
|
|
3917
3925
|
|
|
3918
3926
|
function InputComment$1({ placeholder, onChange, limit, users, showCharacterCounter, styles, onSendMentions, onContentFormat, onContentUnformat, disabled, className, value, replyMentionedUser, group_uuid, limitMessageExceeded }) {
|
|
3919
|
-
const { divPlaceholder, handleInput, isPlaceholder,
|
|
3920
|
-
return (jsxRuntime.jsx(styled.ThemeProvider, { theme: FRSTTheme, children: jsxRuntime.jsxs("div", { style: { minHeight: '48px', ...styles }, tabIndex: 0, children: [jsxRuntime.jsxs(InputWrapper$2, {
|
|
3927
|
+
const { divPlaceholder, handleInput, isPlaceholder, divInputRef, handleMentionUser, mentionTopPosition, setShowMention, showMention, textLength, styleLimitExceeded } = useInputHook({ limit, placeholder, onContentFormat, onContentUnformat, onSendMentions, onChange, value, replyMentionedUser });
|
|
3928
|
+
return (jsxRuntime.jsx(styled.ThemeProvider, { theme: FRSTTheme, children: jsxRuntime.jsxs("div", { style: { minHeight: '48px', ...styles }, tabIndex: 0, children: [jsxRuntime.jsxs(InputWrapper$2, { tabIndex: 1, isPlaceholder: isPlaceholder, isInputLimit: styleLimitExceeded, children: [jsxRuntime.jsx(InputText$4, { tabIndex: 2, contentEditable: true, ref: divInputRef, onKeyUpCapture: (event) => {
|
|
3921
3929
|
handleInput(event);
|
|
3922
3930
|
}, "data-text": "enter", suppressContentEditableWarning: true, children: jsxRuntime.jsx("p", { children: jsxRuntime.jsx("br", {}) }) }), jsxRuntime.jsx(InputPlaceholder, { style: { display: 'none' }, contentEditable: true, ref: divPlaceholder, children: placeholder }), showMention && users && users.length > 0 && jsxRuntime.jsx(Mentions, { users: users, top: mentionTopPosition, onSelect: (user) => {
|
|
3923
3931
|
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;I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