Update rich text editor dependency and associated changes (#11098)

* fix logic error

* update types

* extract message content to variable

* use the new messageContent property

* sort out mention types to make them a  map

* update getMentionAttributes to use AllowedMentionAttributes

* add plain text handling

* change type and handling for attributes when creating a mention in plain text

* tidy, add comment

* revert TS config change

* fix broken types in test

* update tests

* bump rte

* fix import and ts errors

* fix broken tests
This commit is contained in:
alunturner 2023-06-19 09:00:11 +01:00 committed by GitHub
parent 97765613bc
commit fa31ed55d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 108 additions and 77 deletions

View file

@ -164,7 +164,7 @@ describe("WysiwygComposer", () => {
const mockCompletions: ICompletion[] = [
{
type: "user",
href: "www.user1.com",
href: "https://matrix.to/#/@user_1:element.io",
completion: "user_1",
completionId: "@user_1:host.local",
range: { start: 1, end: 1 },
@ -172,7 +172,7 @@ describe("WysiwygComposer", () => {
},
{
type: "user",
href: "www.user2.com",
href: "https://matrix.to/#/@user_2:element.io",
completion: "user_2",
completionId: "@user_2:host.local",
range: { start: 1, end: 1 },
@ -189,7 +189,7 @@ describe("WysiwygComposer", () => {
},
{
type: "room",
href: "www.room1.com",
href: "https://matrix.to/#/#room_1:element.io",
completion: "#room_with_completion_id",
completionId: "@room_1:host.local",
range: { start: 1, end: 1 },
@ -197,7 +197,7 @@ describe("WysiwygComposer", () => {
},
{
type: "room",
href: "www.room2.com",
href: "https://matrix.to/#/#room_2:element.io",
completion: "#room_without_completion_id",
range: { start: 1, end: 1 },
component: <div>room_without_completion_id</div>,
@ -285,9 +285,9 @@ describe("WysiwygComposer", () => {
it("pressing enter selects the mention and inserts it into the composer as a link", async () => {
await insertMentionInput();
// press enter
await userEvent.keyboard("{Enter}");
screen.debug();
// check that it closes the autocomplete
await waitFor(() => {