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

RTE drafts - #12674

Merged
langleyd merged 21 commits into
developfrom
langleyd/rte_drafts
Aug 22, 2024
Merged

RTE drafts#12674
langleyd merged 21 commits into
developfrom
langleyd/rte_drafts

Conversation

@langleyd

@langleyd langleyd commented Jun 24, 2024

Copy link
Copy Markdown
Contributor

What's container in the PR

Add drafts to the rich text editor so that changing rooms or closing the browsers saves/restores the message typed in the composer.

Supports:

  • Rich and plain text modes
  • Drafts in replies
  • Drafts in Threads
  • Draft is saved/restored if you change rooms or if you close/open the browser.

How it looks:

Screen.Recording.2024-06-25.at.15.25.20.mov

@langleyd langleyd added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Jun 24, 2024
@langleyd langleyd changed the title Add drafts to the RTE and tests RTE drafts Jun 24, 2024
}

private get editorStateKey(): string {
let key = `mx_wysiwyg_state_${this.props.room.roomId}`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given there's no code to clean up drafts from rooms which you are no longer in can we move it to IDB where we have less space pressure?

@langleyd langleyd Jun 26, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t3chguy IDB appears to be a bit slower for small values than localstorage and because it's async setting the initial content outside of the constructor makes the initialisation of the editor feel a bit slow/janky. And introduced a weird issue where the initial text is sometimes selected.

Maybe we could stick with localstorage for consistency between it and CIDER but then look to add the cleanup for both? Is it just clearing the data when we leave or are kicked from a room?

Any other ideas?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd have to be a periodic scan comparing the drafts stored vs known rooms at a known good client state, as the client may not receive kicks/leaves depending on if the room was forgotten via another client before it syncs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@langleyd
langleyd added this pull request to the merge queue Aug 8, 2024
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 8, 2024
@langleyd

langleyd commented Aug 8, 2024

Copy link
Copy Markdown
Contributor Author

This introduced a flaky test, and failed in the merge queue. @florianduros Is going to take a look at it next week.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants