mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 02:08:57 +00:00
Render message preview in single line
Co-authored-by: Jamie <113370520+jamiebuilds-signal@users.noreply.github.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
|||||||
import type { HydratedBodyRangesType } from '../../../types/BodyRange.std.js';
|
import type { HydratedBodyRangesType } from '../../../types/BodyRange.std.js';
|
||||||
import { AxoSymbol } from '../../../axo/AxoSymbol.dom.js';
|
import { AxoSymbol } from '../../../axo/AxoSymbol.dom.js';
|
||||||
import { missingCaseError } from '../../../util/missingCaseError.std.js';
|
import { missingCaseError } from '../../../util/missingCaseError.std.js';
|
||||||
|
import { stripNewlinesForLeftPane } from '../../../util/stripNewlinesForLeftPane.std.js';
|
||||||
|
|
||||||
export type PinMessageText = Readonly<{
|
export type PinMessageText = Readonly<{
|
||||||
body: string;
|
body: string;
|
||||||
@@ -483,6 +484,11 @@ function MessageTextPreview(props: {
|
|||||||
text: PinMessageText;
|
text: PinMessageText;
|
||||||
}) {
|
}) {
|
||||||
const { i18n } = props;
|
const { i18n } = props;
|
||||||
|
|
||||||
|
const messagePreview = useMemo(() => {
|
||||||
|
return stripNewlinesForLeftPane(props.text.body);
|
||||||
|
}, [props.text.body]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MessageTextRenderer
|
<MessageTextRenderer
|
||||||
bodyRanges={props.text.bodyRanges}
|
bodyRanges={props.text.bodyRanges}
|
||||||
@@ -491,7 +497,7 @@ function MessageTextPreview(props: {
|
|||||||
jumboEmojiSize={null}
|
jumboEmojiSize={null}
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
isSpoilerExpanded={{}}
|
isSpoilerExpanded={{}}
|
||||||
messageText={props.text.body}
|
messageText={messagePreview}
|
||||||
originalMessageText={props.text.body}
|
originalMessageText={props.text.body}
|
||||||
onExpandSpoiler={undefined}
|
onExpandSpoiler={undefined}
|
||||||
onMentionTrigger={() => null}
|
onMentionTrigger={() => null}
|
||||||
|
|||||||
Reference in New Issue
Block a user