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

Remove all text when cutting in the composer #3848

Merged
merged 3 commits into from
Jan 16, 2020
Merged

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Jan 16, 2020

The previous function did in fact remove the elements, but left the model thinking there was a zero-length string. This approach replaces the selection with empty text, making the model more accurate given the change in text goes through the model eventually.

Part of element-hq/element-web#11378
Fixes element-hq/element-web#11883

The previous function did in fact remove the elements, but left the model thinking there was a zero-length string. This approach deletes the text from the model and the DOM, resulting in the placeholder being shown when cutting all the text.

Part of element-hq/element-web#11378
@turt2live turt2live requested review from a team and removed request for a team January 16, 2020 02:08
@turt2live
Copy link
Member Author

Actually this won't work if you only highlight part of the text and cut it - you lose the whole message.

@turt2live turt2live self-assigned this Jan 16, 2020
This gives people the option of cutting parts or all of their message.
We get an NPE when the user cuts their entire message, and this fixes it.
@t3chguy
Copy link
Member

t3chguy commented Jan 16, 2020

This'll probably fix element-hq/element-web#11883

@turt2live
Copy link
Member Author

it does

Copy link
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

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

Seems plausible! 😬

@turt2live turt2live merged commit 43f97af into develop Jan 16, 2020
@turt2live turt2live deleted the travis/fix-cut branch January 16, 2020 22:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cutting an entire message persists the formatting bar in the composer
3 participants