Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Mentions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,13 @@ const InternalMentions = forwardRef<MentionsRef, MentionsProps>(
>
<TextArea
classNames={{ textarea: mentionClassNames?.textarea }}
/**
* Example:<Mentions style={{ resize: 'none' }} />.
* If written this way, resizing here will become invalid.
* The TextArea component code and found that the resize parameter in the style of the ResizeTextArea component is obtained from prop.style.
* Just pass the resize attribute and leave everything else unchanged.
*/
style={{ resize: style?.resize }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加个备注吧,说明一下是参考 TextArea 的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

styles={{ textarea: styles?.textarea }}
ref={textareaRef}
value={mergedValue}
Expand Down
14 changes: 14 additions & 0 deletions tests/Mentions.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,5 +355,19 @@ describe('Mentions', () => {
container.querySelector('.rc-mentions-affix-wrapper'),
);
});

it('should apply resize style to textarea', () => {
const { container } = render(
<Mentions style={{ resize: 'none' }}>
<Option value="bamboo">Bamboo</Option>
<Option value="light">Light</Option>
<Option value="cat">Cat</Option>
</Mentions>,
);

const textarea = container.querySelector('textarea');
expect(textarea).not.toBeNull();
expect(textarea?.style.resize).toBe('none');
});
});
});