Compose side fixes (#40000)
This commit is contained in:
8 files changed
+86
-21
No files matched your search
@@ -23,12 +23,12 @@ export const textAtCursorMatchesToken = (
|
||||
word = word.trim();
|
||||
|
||||
if (word.length < 3 || (word[0] && !searchTokens.includes(word[0]))) {
|
||||
return [null, null];
|
||||
return [null, null] as const;
|
||||
}
|
||||
|
||||
if (word.length > 0) {
|
||||
return [left + 1, word];
|
||||
return [left + 1, word] as const;
|
||||
} else {
|
||||
return [null, null];
|
||||
return [null, null] as const;
|
||||
}
|
||||
};
|
||||
@@ -153,7 +153,7 @@ const AutosuggestTextarea = forwardRef(({
|
||||
}
|
||||
}, [lang]);
|
||||
|
||||
const renderSuggestion = (suggestion, i) => {
|
||||
const renderSuggestion = useCallback((suggestion, i) => {
|
||||
let inner, key;
|
||||
|
||||
if (suggestion.type === 'emoji') {
|
||||
@@ -172,7 +172,7 @@ const AutosuggestTextarea = forwardRef(({
|
||||
{inner}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}, [selectedSuggestion, handleSuggestionClick]);
|
||||
|
||||
const handleRef = useCallback((element) => {
|
||||
textareaRef.current = element;
|
||||
|
||||
@@ -95,13 +95,18 @@ export interface PopoverProps {
|
||||
* enable it to be sized and positioned. The `ref` prop
|
||||
* is not passed when the `popoverElement` prop is provided.
|
||||
*/
|
||||
props: Record<string, unknown> & {
|
||||
ref?: React.RefCallback<HTMLElement>;
|
||||
style: React.CSSProperties;
|
||||
};
|
||||
props: PopoverChildProps;
|
||||
}) => React.ReactNode;
|
||||
}
|
||||
|
||||
export interface PopoverChildProps {
|
||||
ref?: React.RefCallback<HTMLElement>;
|
||||
style: React.CSSProperties;
|
||||
'data-popover-placement': Placement;
|
||||
'data-popover-reference-hidden'?: boolean;
|
||||
'data-popover-escaped'?: boolean;
|
||||
}
|
||||
|
||||
export const Popover: React.FC<PopoverProps> = ({
|
||||
isOpen,
|
||||
onClose,
|
||||
|
||||
Reference in new issue
Block a user