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

Copy formatted text to clipboard on selecting chat #7192

Closed
wants to merge 7 commits into from

Conversation

jaiwanth-v
Copy link
Contributor

@jaiwanth-v jaiwanth-v commented Nov 24, 2021

Fixes element-hq/element-web#19726
Fixes element-hq/element-web#17844
Fixes element-hq/element-web#893

Writes an irc style log to the clipboard on selecting and copying chat.

copy-format.mp4

Here's what your changelog entry will look like:

✨ Features

Preview: https://61a0cfde0b1968681b0d1619--matrix-react-sdk.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.

@jaiwanth-v jaiwanth-v requested a review from a team as a code owner November 24, 2021 11:29
@SimonBrandner SimonBrandner added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Nov 24, 2021
@SimonBrandner
Copy link
Contributor

I have a feeling there is an issue that should be fixed by this, can't find it though

@andybalaam andybalaam requested a review from a team November 25, 2021 09:33
@andybalaam
Copy link
Contributor

I've asked the design team to take a look at this. Code-wise, after a brief look, it looks pretty sane to me.

Thanks for working on this!

@andybalaam
Copy link
Contributor

Looks like some type check is complaining @jaiwanth-v

@andybalaam
Copy link
Contributor

I had a quick chat with the team and apparently this is something @ara4n has asked for over a reasonably long period of time.

@t3chguy
Copy link
Member

t3chguy commented Nov 25, 2021

element-hq/element-web#19726 being the latest issue (but I doubt the only)
element-hq/element-web#893 being the older

@jaiwanth-v
Copy link
Contributor Author

Looks like some type check is complaining @jaiwanth-v

@andybalaam it should be fixed now.

@andybalaam
Copy link
Contributor

@andybalaam it should be fixed now.

Yep. Let's see what @janogarcia says about this, and then I'll get into reading the code properly.

@nadonomy
Copy link
Contributor

@andybalaam it should be fixed now.

Yep. Let's see what @janogarcia says about this, and then I'll get into reading the code properly.

Just to be clear, definitely want this feature and thanks @jaiwanth-v for putting it together.

From design @janogarcia would be great to just get quick sense checks and suggestions on the format of the text (date formats, where to use commas vs hyphens vs brackets, etc).

Copy link
Contributor

@germain-gg germain-gg left a comment

Choose a reason for hiding this comment

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

Pretty excited about this feature!
Thank you for working on it

src/components/structures/TimelinePanel.tsx Outdated Show resolved Hide resolved
src/components/structures/TimelinePanel.tsx Outdated Show resolved Hide resolved
src/components/structures/TimelinePanel.tsx Outdated Show resolved Hide resolved
src/components/structures/TimelinePanel.tsx Outdated Show resolved Hide resolved
src/components/structures/TimelinePanel.tsx Outdated Show resolved Hide resolved
src/utils/exportUtils/exportUtils.ts Outdated Show resolved Hide resolved
src/utils/exportUtils/exportUtils.ts Show resolved Hide resolved
Copy link
Contributor

@germain-gg germain-gg left a comment

Choose a reason for hiding this comment

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

Looks good to me code-wise!

Copy link
Contributor

@janogarcia janogarcia left a comment

Choose a reason for hiding this comment

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

@jaiwanth-v Thank you for working on such a useful feature! 👍

Could we please make the parsed range a bit less eager when selecting a full message line by double/tripe clicking on it?

Please check out the following screen recording for examples (e.g. double/tripe clicking on a message and then copying only works as expected when there's a single message by the user at that point in the timeline, but fails if there are multiple consecutive message by the same user)

double-click-selections.mp4

@jaiwanth-v @gsouquet
Also, can you guys please confirm if we're reusing here exactly the same rendering rules we use for regular chat exports (Room info → Export chat) when selecting "Plain Text" as the export format? I did some test on different content types and it seems to be the case, but I'd like to double-check with you to make sure we're not maintaining separate/diverging specs.

@MadLittleMods MadLittleMods added the Z-Community-PR Issue is solved by a community member's PR label Jun 1, 2022
@weeman1337 weeman1337 requested a review from a team as a code owner August 31, 2023 09:24
CHANGELOG.md Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
@weeman1337

This comment was marked as resolved.

@weeman1337 weeman1337 marked this pull request as draft August 31, 2023 09:35
@weeman1337
Copy link
Contributor

Unfortunately the base code has changed in the meantime. After updating this PR to the current develop, the feature does not seem to work any more. @jaiwanth-v thank you for putting the work into this. Can you have another look at this PR? I've also moved this PR to draft until it is ready to be reviewed again.

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 Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
10 participants