Fix issues with /me emote two liner (#33081)
* Fix issues with me emote liner * Fix Prettier
This commit is contained in:
@@ -1378,6 +1378,10 @@ $left-gutter: 64px;
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_EventTile_annotatedInline {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
.mx_EventTile_footer {
|
.mx_EventTile_footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--cpd-space-2x);
|
gap: var(--cpd-space-2x);
|
||||||
|
|||||||
@@ -301,6 +301,9 @@ class InnerTextualBody extends React.Component<Props> {
|
|||||||
const isCaption = [MsgType.Image, MsgType.File, MsgType.Audio, MsgType.Video].includes(
|
const isCaption = [MsgType.Image, MsgType.File, MsgType.Audio, MsgType.Video].includes(
|
||||||
content.msgtype as MsgType,
|
content.msgtype as MsgType,
|
||||||
);
|
);
|
||||||
|
const annotatedClassName = isEmote
|
||||||
|
? "mx_EventTile_annotated mx_EventTile_annotatedInline"
|
||||||
|
: "mx_EventTile_annotated";
|
||||||
|
|
||||||
const willHaveWrapper =
|
const willHaveWrapper =
|
||||||
this.props.replacingEventId || this.props.isSeeingThroughMessageHiddenForModeration || isEmote;
|
this.props.replacingEventId || this.props.isSeeingThroughMessageHiddenForModeration || isEmote;
|
||||||
@@ -315,7 +318,7 @@ class InnerTextualBody extends React.Component<Props> {
|
|||||||
|
|
||||||
if (this.props.replacingEventId) {
|
if (this.props.replacingEventId) {
|
||||||
body = (
|
body = (
|
||||||
<div dir="auto" className="mx_EventTile_annotated">
|
<div dir="auto" className={annotatedClassName}>
|
||||||
{body}
|
{body}
|
||||||
{this.renderEditedMarker()}
|
{this.renderEditedMarker()}
|
||||||
</div>
|
</div>
|
||||||
@@ -323,7 +326,7 @@ class InnerTextualBody extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
if (this.props.isSeeingThroughMessageHiddenForModeration) {
|
if (this.props.isSeeingThroughMessageHiddenForModeration) {
|
||||||
body = (
|
body = (
|
||||||
<div dir="auto" className="mx_EventTile_annotated">
|
<div dir="auto" className={annotatedClassName}>
|
||||||
{body}
|
{body}
|
||||||
{this.renderPendingModerationMarker()}
|
{this.renderPendingModerationMarker()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -146,6 +146,28 @@ describe("<TextualBody />", () => {
|
|||||||
expect(content).toMatchSnapshot();
|
expect(content).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("keeps edited emote bodies inline with the sender", () => {
|
||||||
|
DMRoomMap.makeShared(defaultMatrixClient);
|
||||||
|
|
||||||
|
const ev = mkEvent({
|
||||||
|
type: "m.room.message",
|
||||||
|
room: room1Id,
|
||||||
|
user: "sender",
|
||||||
|
content: {
|
||||||
|
body: "winks",
|
||||||
|
msgtype: "m.emote",
|
||||||
|
},
|
||||||
|
event: true,
|
||||||
|
});
|
||||||
|
jest.spyOn(ev, "replacingEventDate").mockReturnValue(new Date(1993, 7, 3));
|
||||||
|
|
||||||
|
const { container } = getComponent({ mxEvent: ev, replacingEventId: ev.getId() });
|
||||||
|
|
||||||
|
const annotated = container.querySelector(".mx_MEmoteBody > .mx_EventTile_annotatedInline");
|
||||||
|
expect(annotated).not.toBeNull();
|
||||||
|
expect(annotated?.tagName).toBe("DIV");
|
||||||
|
});
|
||||||
|
|
||||||
it("renders m.notice correctly", () => {
|
it("renders m.notice correctly", () => {
|
||||||
DMRoomMap.makeShared(defaultMatrixClient);
|
DMRoomMap.makeShared(defaultMatrixClient);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user