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; touch-action: none;
} }
&--seen-by {
min-width: 14rem;
}
.avatars { .avatars {
display: flex; display: flex;
align-self: center; align-self: center;
margin-left: auto; margin-inline-start: auto;
padding-left: 1rem; padding-inline-start: 1rem;
.Avatar { .Avatar {
border: 0.0625rem solid var(--color-background); 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>} {canReport && <MenuItem icon="flag" onClick={onReport}>{lang('lng_context_report_msg')}</MenuItem>}
{(canShowSeenBy || canShowReactionsCount) && ( {(canShowSeenBy || canShowReactionsCount) && (
<MenuItem <MenuItem
className="MessageContextMenu--seen-by"
icon={canShowReactionsCount ? 'reactions' : 'group'} icon={canShowReactionsCount ? 'reactions' : 'group'}
onClick={canShowReactionsCount ? onShowReactors : onShowSeenBy} onClick={canShowReactionsCount ? onShowReactors : onShowSeenBy}
disabled={!canShowReactionsCount && !message.seenByUserIds?.length} disabled={!canShowReactionsCount && !message.seenByUserIds?.length}

View File

@ -1,7 +1,8 @@
const ELEMENT_NODE = 1; const ELEMENT_NODE = 1;
export default function getMessageIdsForSelectedText() { 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) { if (!selectedFragments || selectedFragments.childElementCount === 0) {
return; return;
} }