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

RTE drafts #12674

Merged
merged 21 commits into from
Aug 22, 2024
Merged

RTE drafts #12674

merged 21 commits into from
Aug 22, 2024

Conversation

langleyd
Copy link
Contributor

@langleyd langleyd commented Jun 24, 2024

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
@@ -154,6 +182,52 @@ export class MessageComposer extends React.Component<IProps, IState> {
SettingsStore.monitorSetting("feature_wysiwyg_composer", null);
}

private get editorStateKey(): string {
let key = `mx_wysiwyg_state_${this.props.room.roomId}`;
Copy link
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?

Copy link
Contributor Author

@langleyd langleyd Jun 26, 2024

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
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
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
Copy link
Contributor Author

langleyd commented Aug 8, 2024

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

@langleyd langleyd added this pull request to the merge queue Aug 22, 2024
Merged via the queue into develop with commit 70665d3 Aug 22, 2024
29 checks passed
@langleyd langleyd deleted the langleyd/rte_drafts branch August 22, 2024 13:10
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