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

Commit c037b84

Browse files
author
Germain
authored
Upgrade wysiwyg editor for ctrl+backspace windows fix (#11324)
* Upgrade wysiwyg editor for ctrl+backspace windows fix * upgrade lockfile * Fix after upgrading the wysiswyg package
1 parent b496fe0 commit c037b84

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
},
6161
"dependencies": {
6262
"@babel/runtime": "^7.12.5",
63+
"@matrix-org/matrix-wysiwyg": "^2.4.1",
6364
"@matrix-org/analytics-events": "^0.6.0",
64-
"@matrix-org/matrix-wysiwyg": "^2.3.1",
6565
"@matrix-org/react-sdk-module-api": "^1.0.0",
6666
"@sentry/browser": "^7.0.0",
6767
"@sentry/tracing": "^7.0.0",

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

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1806,10 +1806,10 @@
18061806
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-sdk-crypto-wasm/-/matrix-sdk-crypto-wasm-1.0.1.tgz#21a0557a7bb3f60b37c6d412be8906c056fe79b8"
18071807
integrity sha512-VTwV5IowvhhLXwAsDDAv02bC5/qBQbG2YtpYAije11253sQ3MePIoSR+dS40Ih3lAlEzqQ00GU3O+i45jMzIRQ==
18081808

1809-
"@matrix-org/matrix-wysiwyg@^2.3.1":
1810-
version "2.3.1"
1811-
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-wysiwyg/-/matrix-wysiwyg-2.3.1.tgz#4b607323f3ffd8c332abeba7226010ecc031ed12"
1812-
integrity sha512-OxJvA+pSGdP2f55foZGEDmU2qvILFLLjV53MOgPw1F6zDAp8nDL1rPPIzFv1qgDj5W7d4Rzq7FnN25vINnAu+A==
1809+
"@matrix-org/matrix-wysiwyg@^2.4.1":
1810+
version "2.4.1"
1811+
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-wysiwyg/-/matrix-wysiwyg-2.4.1.tgz#e1325a42366a1c891b2ba90c88e597b39187b2cb"
1812+
integrity sha512-RyUijZXVKenE9s3LczDUhWFeOfIyLcsOrAyHqYxnizXX5nxMkHxTgLeoTvaIJ+1dOhI+H2SS9G4VcN6odZ0aNg==
18131813

18141814
"@matrix-org/olm@https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz":
18151815
version "3.2.14"

0 commit comments

Comments
 (0)