Message Context Menu: Fix width jumps, fix not copying text (#1747)

This commit is contained in:
Alexander Zinchuk 2022-03-04 16:21:16 +03:00
parent 01002f8eb3
commit 4c33acddf0
3 changed files with 9 additions and 3 deletions

View File

@ -28,11 +28,15 @@
touch-action: none;
}
&--seen-by {
min-width: 14rem;
}
.avatars {
display: flex;
align-self: center;
margin-left: auto;
padding-left: 1rem;
margin-inline-start: auto;
padding-inline-start: 1rem;
.Avatar {
border: 0.0625rem solid var(--color-background);

View File

@ -249,6 +249,7 @@ const MessageContextMenu: FC<OwnProps> = ({
{canReport && <MenuItem icon="flag" onClick={onReport}>{lang('lng_context_report_msg')}</MenuItem>}
{(canShowSeenBy || canShowReactionsCount) && (
<MenuItem
className="MessageContextMenu--seen-by"
icon={canShowReactionsCount ? 'reactions' : 'group'}
onClick={canShowReactionsCount ? onShowReactors : onShowSeenBy}
disabled={!canShowReactionsCount && !message.seenByUserIds?.length}

View File

@ -1,7 +1,8 @@
const ELEMENT_NODE = 1;
export default function getMessageIdsForSelectedText() {
let selectedFragments = window.getSelection()?.getRangeAt(0).cloneContents();
const selection = window.getSelection();
let selectedFragments = selection && selection.rangeCount ? selection.getRangeAt(0).cloneContents() : undefined;
if (!selectedFragments || selectedFragments.childElementCount === 0) {
return;
}