Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit a662296

Browse files
author
Germain
committed
Fix after upgrading the wysiswyg package
1 parent b957783 commit a662296

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/components/views/rooms/MessageComposer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ export class MessageComposer extends React.Component<IProps, IState> {
371371

372372
const { isRichTextEnabled, composerContent } = this.state;
373373
const convertedContent = isRichTextEnabled
374-
? await richToPlain(composerContent)
374+
? await richToPlain(composerContent, false)
375375
: await plainToRich(composerContent, false);
376376

377377
this.setState({

src/components/views/rooms/wysiwyg_composer/DynamicImportWysiwygComposer.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ export const dynamicImportConversionFunctions = async (): Promise<{
4545
* ensure that HTML entities are correctly interpreted, and to prevent newline characters being turned into `<br>`.
4646
*
4747
* @param rich - html to convert
48+
* @param inMessageFormat - `true` to format the return value for use as a message `formatted_body`.
49+
* `false` to format it for writing to an editor element.
4850
* @returns a string of plain text that may contain markdown
4951
*/
50-
richToPlain(rich: string): Promise<string>;
52+
richToPlain(rich: string, inMessageFormat: boolean): Promise<string>;
5153

5254
/**
5355
* Creates a rust model from plain text input (interpreted as markdown) and uses it to generate the rich text

src/components/views/rooms/wysiwyg_composer/utils/createMessageContent.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export async function createMessageContent(
9696

9797
// if we're editing rich text, the message content is pure html
9898
// BUT if we're not, the message content will be plain text where we need to convert the mentions
99-
const body = isHTML ? await richToPlain(message) : convertPlainTextToBody(message);
99+
const body = isHTML ? await richToPlain(message, false) : convertPlainTextToBody(message);
100100
const bodyPrefix = (isReplyAndEditing && getTextReplyFallback(editedEvent)) || "";
101101
const formattedBodyPrefix = (isReplyAndEditing && getHtmlReplyFallback(editedEvent)) || "";
102102

0 commit comments

Comments
 (0)