Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Copy With Headers to grid cell popup. #1208

Merged
merged 7 commits into from
Sep 30, 2024

Conversation

rtwfroody
Copy link
Contributor

@rtwfroody rtwfroody commented Sep 13, 2024

Context

Add Copy With Headers to grid cell popup. This is what you want when you're going to paste into e.g. an email.

User story: I want to copy and paste from a grist table into email. The table contents don't make much sense without the headers, so I need them in the email as well.

Proposed solution

Add new entry to the grid cell popup.

Related issues

None

Has this been tested?

I wrote a new test: CopyWithHeaders. This makes sure headers are copied when pasting plain text.

Tested by manually trying copy and paste into an editor and an email, and then again using the new variant to confirm the headers show up.

Screenshots / Screencasts

image

@rtwfroody
Copy link
Contributor Author

Those Formulas tests pass for me locally:

~/proj/grist-core$ GREP_TESTS="Formulas.*" yarn test:nbrowser --bail
yarn run v1.22.22
$ GRIST_TEST_LOGIN=1 TEST_SUITE=nbrowser TEST_SUITE_FOR_TIMINGS=nbrowser TIMINGS_FILE=test/timings/nbrowser.txt ./test/test_env.sh mocha ${DEBUG:+-b --no-exit} $([ -z $DEBUG ] && echo --forbid-only) -g "${GREP_TESTS}" --slow 8000 -R test/xunit-file '_build/test/nbrowser/**/*.js' --bail
(node:2003124) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Formulas
2024-09-13 09:13:24.325 - warn: Test logs and data are at: /tmp/grist_test_tnewsome_merged_0/
2024-09-13 09:13:24.328 - warn: Running without redis and without multiple doc workers
2024-09-13 09:13:24.331 - info: Waiting for node server to respond at http://localhost:8295
(node:2003124) [DEP0044] DeprecationWarning: The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.
  ✔ Formulas should highlight column in full edit mode
  ✔ Formulas should evaluate formulas requiring lazy-evaluation
  ✔ Formulas should support formulas returning unmarshallable or weird values
  ✔ Formulas should strip out leading equal-sign users might think is needed
  ✔ Formulas should not fail when formulas have valid indent or leading whitespace
  ✔ Formulas should support autocompletion from lowercase values
  ✔ Formulas should link some suggested functions to their documentation
2024-09-13 09:13:49.919 - info: Stopping node server

Done in 27.84s.

This is what you want when you're going to paste into e.g. an email.

Tested just by manually trying copy and paste into an editor and an
email, and then again using the new variant to confirm the headers show
up.
This only tests the plain text copy, not the HTML copy functionality.
@paulfitz paulfitz added the preview Launch preview deployment of this PR label Sep 16, 2024
Copy link
Contributor

Deployed commit 194cf7c9c31326bec4ad1a4fe768bc4f5f6e18a2 as https://grist-rtwfroody-grist-core-copy-headers.fly.dev (until 2024-10-16T21:58:24.730Z)

Copy link
Member

@paulfitz paulfitz left a comment

Choose a reason for hiding this comment

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

Neat functionality, thanks @rtwfroody ! I think we'd like to have this, thanks for working on it. This isn't a code review yet. Here are two points that came up in some testing:

  • Capitalization in menu is inconsistent, "Copy with headers" would be better.
  • Shortcut isn't too conflicty, but in Chrome and Firefox that shortcut opens the dev console (there are other ways though), and in Excel it copies formatting, no values. Is there another shortcut that still appeals to you but has less conflict?

@rtwfroody
Copy link
Contributor Author

  • Capitalization in menu is inconsistent, "Copy with headers" would be better.

I noticed this too. The code already does that, but the screenshot up top is out of date. Should I update the screenshot?

  • Shortcut isn't too conflicty, but in Chrome and Firefox that shortcut opens the dev console (there are other ways though), and in Excel it copies formatting, no values. Is there another shortcut that still appeals to you but has less conflict?

I'm pretty much open to anything, and don't know anything about shortcuts that work well with browsers. Is Ctrl + Alt + C available?

@paulfitz
Copy link
Member

  • Capitalization in menu is inconsistent, "Copy with headers" would be better.

I noticed this too. The code already does that, but the screenshot up top is out of date. Should I update the screenshot?

I see that now. Code is enough, thanks!

  • Shortcut isn't too conflicty, but in Chrome and Firefox that shortcut opens the dev console (there are other ways though), and in Excel it copies formatting, no values. Is there another shortcut that still appeals to you but has less conflict?

I'm pretty much open to anything, and don't know anything about shortcuts that work well with browsers. Is Ctrl + Alt + C available?

Looking through shortcut databases, that isn't obviously better. Your original choice may be good enough. Given that you are open to changing it if needed, we'll go ahead and get a code review on this asap, thanks for the contribution! ❤️

app/client/components/commandList.ts Outdated Show resolved Hide resolved
app/client/lib/tableUtil.ts Outdated Show resolved Hide resolved
app/client/lib/tableUtil.ts Outdated Show resolved Hide resolved
app/client/lib/tableUtil.ts Outdated Show resolved Hide resolved
test/nbrowser/CopyWithHeaders.ts Show resolved Hide resolved
app/client/components/Clipboard.js Outdated Show resolved Hide resolved
test/nbrowser/CopyWithHeaders.ts Show resolved Hide resolved
No current code was taking advantage of the argument.
Copy link
Contributor

Deployed commit c8ea3e23c34b93569eb83fecb2502d4b0e679b1e as https://grist-rtwfroody-grist-core-copy-headers.fly.dev (until 2024-10-28T03:22:22.027Z)

Copy link
Contributor

@berhalak berhalak left a comment

Choose a reason for hiding this comment

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

Thanks @rtwfroody.

@berhalak berhalak merged commit 755a742 into gristlabs:main Sep 30, 2024
11 checks passed
@rtwfroody rtwfroody deleted the copy_headers branch October 2, 2024 15:07
@rtwfroody
Copy link
Contributor Author

Thank you! I look forward to seeing this live on getgrist.com. :-)

@paulfitz
Copy link
Member

paulfitz commented Oct 2, 2024

Thank you! I look forward to seeing this live on getgrist.com. :-)

There's some chance it will be there from Monday (2024/10/7) on, otherwise a week from then. Thanks @rtwfroody !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Launch preview deployment of this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants