Make the pill text single line (#8744)
parent
a434402b41
commit
b1e07e8ef0
|
@ -21,7 +21,9 @@ limitations under the License.
|
||||||
vertical-align: text-top;
|
vertical-align: text-top;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
color: $accent-fg-color !important; // To override .markdown-body
|
color: $accent-fg-color !important; // To override .markdown-body
|
||||||
|
@ -50,6 +52,13 @@ limitations under the License.
|
||||||
.mx_BaseAvatar {
|
.mx_BaseAvatar {
|
||||||
margin-inline-start: -0.3em; // Otherwise the gap is too large
|
margin-inline-start: -0.3em; // Otherwise the gap is too large
|
||||||
margin-inline-end: 0.2em;
|
margin-inline-end: 0.2em;
|
||||||
|
min-width: $font-16px; // ensure the avatar is not compressed
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_Pill_linkText {
|
||||||
|
white-space: nowrap; // enforce the pill text to be a single line
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
a& {
|
a& {
|
||||||
|
|
|
@ -24,6 +24,7 @@ limitations under the License.
|
||||||
&.mx_AccessibleButton_kind_link_inline {
|
&.mx_AccessibleButton_kind_link_inline {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
color: unset;
|
color: unset;
|
||||||
|
white-space: nowrap; // Enforce 'In reply to' to be a single line
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $links;
|
color: $links;
|
||||||
|
|
|
@ -57,6 +57,10 @@ limitations under the License.
|
||||||
user-select: all;
|
user-select: all;
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: unset; // We don't want indicate clickability
|
cursor: unset; // We don't want indicate clickability
|
||||||
|
display: inline-block;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
// We don't want indicate clickability | To override the overriding of .markdown-body
|
// We don't want indicate clickability | To override the overriding of .markdown-body
|
||||||
|
@ -65,8 +69,10 @@ limitations under the License.
|
||||||
|
|
||||||
// avatar psuedo element
|
// avatar psuedo element
|
||||||
&::before {
|
&::before {
|
||||||
|
display: inline-block;
|
||||||
content: var(--avatar-letter);
|
content: var(--avatar-letter);
|
||||||
width: $font-16px;
|
width: $font-16px;
|
||||||
|
min-width: $font-16px; // ensure the avatar is not compressed
|
||||||
height: $font-16px;
|
height: $font-16px;
|
||||||
margin-inline-end: 0.24rem;
|
margin-inline-end: 0.24rem;
|
||||||
background: var(--avatar-background), $background;
|
background: var(--avatar-background), $background;
|
||||||
|
|
|
@ -264,18 +264,20 @@ export default class Pill extends React.Component<IProps, IState> {
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onMouseOver={this.onMouseOver}
|
onMouseOver={this.onMouseOver}
|
||||||
onMouseLeave={this.onMouseLeave}
|
onMouseLeave={this.onMouseLeave}
|
||||||
|
dir="auto"
|
||||||
>
|
>
|
||||||
{ avatar }
|
{ avatar }
|
||||||
{ linkText }
|
<span className="mx_Pill_linkText">{ linkText }</span>
|
||||||
{ tip }
|
{ tip }
|
||||||
</a> :
|
</a> :
|
||||||
<span
|
<span
|
||||||
className={classes}
|
className={classes}
|
||||||
onMouseOver={this.onMouseOver}
|
onMouseOver={this.onMouseOver}
|
||||||
onMouseLeave={this.onMouseLeave}
|
onMouseLeave={this.onMouseLeave}
|
||||||
|
dir="auto"
|
||||||
>
|
>
|
||||||
{ avatar }
|
{ avatar }
|
||||||
{ linkText }
|
<span className="mx_Pill_linkText">{ linkText }</span>
|
||||||
{ tip }
|
{ tip }
|
||||||
</span> }
|
</span> }
|
||||||
</MatrixClientContext.Provider>;
|
</MatrixClientContext.Provider>;
|
||||||
|
|
|
@ -331,11 +331,11 @@ describe("<TextualBody />", () => {
|
||||||
'<span class="mx_EventTile_body markdown-body" dir="auto">' +
|
'<span class="mx_EventTile_body markdown-body" dir="auto">' +
|
||||||
'A <span><a class="mx_Pill mx_RoomPill" ' +
|
'A <span><a class="mx_Pill mx_RoomPill" ' +
|
||||||
'href="https://matrix.to/#/!ZxbRYPQXDXKGmDnJNg:example.com' +
|
'href="https://matrix.to/#/!ZxbRYPQXDXKGmDnJNg:example.com' +
|
||||||
'?via=example.com&via=bob.com"' +
|
'?via=example.com&via=bob.com" dir="auto"' +
|
||||||
'><img class="mx_BaseAvatar mx_BaseAvatar_image" ' +
|
'><img class="mx_BaseAvatar mx_BaseAvatar_image" ' +
|
||||||
'src="mxc://avatar.url/room.png" ' +
|
'src="mxc://avatar.url/room.png" ' +
|
||||||
'style="width: 16px; height: 16px;" alt="" aria-hidden="true">' +
|
'style="width: 16px; height: 16px;" alt="" aria-hidden="true">' +
|
||||||
'room name</a></span> with vias</span>',
|
'<span class="mx_Pill_linkText">room name</span></a></span> with vias</span>',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -425,4 +425,3 @@ describe("<TextualBody />", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -14,4 +14,4 @@ exports[`<TextualBody /> renders formatted m.text correctly pills do not appear
|
||||||
</span>"
|
</span>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`<TextualBody /> renders formatted m.text correctly pills get injected correctly into the DOM 1`] = `"<span class=\\"mx_EventTile_body markdown-body\\" dir=\\"auto\\">Hey <span><a class=\\"mx_Pill mx_UserPill\\"><img class=\\"mx_BaseAvatar mx_BaseAvatar_image\\" src=\\"mxc://avatar.url/image.png\\" style=\\"width: 16px; height: 16px;\\" alt=\\"\\" aria-hidden=\\"true\\">Member</a></span></span>"`;
|
exports[`<TextualBody /> renders formatted m.text correctly pills get injected correctly into the DOM 1`] = `"<span class=\\"mx_EventTile_body markdown-body\\" dir=\\"auto\\">Hey <span><a class=\\"mx_Pill mx_UserPill\\" dir=\\"auto\\"><img class=\\"mx_BaseAvatar mx_BaseAvatar_image\\" src=\\"mxc://avatar.url/image.png\\" style=\\"width: 16px; height: 16px;\\" alt=\\"\\" aria-hidden=\\"true\\"><span class=\\"mx_Pill_linkText\\">Member</span></a></span></span>"`;
|
||||||
|
|
Loading…
Reference in New Issue