From 506cb0f5ddff8575bacc465766fed30b594a6785 Mon Sep 17 00:00:00 2001 From: Germain Date: Thu, 27 Jul 2023 12:45:56 +0100 Subject: [PATCH] Fix after upgrading the wysiswyg package --- .../rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx | 4 +++- .../rooms/wysiwyg_composer/utils/createMessageContent.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx b/src/components/views/rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx index ba41bd4055de..2e02fb571936 100644 --- a/src/components/views/rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx +++ b/src/components/views/rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx @@ -45,9 +45,11 @@ export const dynamicImportConversionFunctions = async (): Promise<{ * ensure that HTML entities are correctly interpreted, and to prevent newline characters being turned into `
`. * * @param rich - html to convert + * @param inMessageFormat - `true` to format the return value for use as a message `formatted_body`. + * `false` to format it for writing to an editor element. * @returns a string of plain text that may contain markdown */ - richToPlain(rich: string): Promise; + richToPlain(rich: string, inMessageFormat: boolean): Promise; /** * Creates a rust model from plain text input (interpreted as markdown) and uses it to generate the rich text diff --git a/src/components/views/rooms/wysiwyg_composer/utils/createMessageContent.ts b/src/components/views/rooms/wysiwyg_composer/utils/createMessageContent.ts index aa469a5fd29c..58a4795c2a7f 100644 --- a/src/components/views/rooms/wysiwyg_composer/utils/createMessageContent.ts +++ b/src/components/views/rooms/wysiwyg_composer/utils/createMessageContent.ts @@ -96,7 +96,7 @@ export async function createMessageContent( // if we're editing rich text, the message content is pure html // BUT if we're not, the message content will be plain text where we need to convert the mentions - const body = isHTML ? await richToPlain(message) : convertPlainTextToBody(message); + const body = isHTML ? await richToPlain(message, false) : convertPlainTextToBody(message); const bodyPrefix = (isReplyAndEditing && getTextReplyFallback(editedEvent)) || ""; const formattedBodyPrefix = (isReplyAndEditing && getHtmlReplyFallback(editedEvent)) || "";