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

Fix pasting tables from Google Sheets; update tests. #10327

Merged
merged 6 commits into from
Jun 21, 2024

Conversation

kazcw
Copy link
Contributor

@kazcw kazcw commented Jun 20, 2024

Pull Request Description

Part of #10275 (AG Grid support will be a separate PR).

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.

@kazcw kazcw self-assigned this Jun 20, 2024
@@ -52,7 +54,7 @@ class MockClipboardItem {
this.types = Object.keys(data)
}

getType(type: string): Blob {
async getType(type: string): Promise<Blob> {
Copy link
Contributor

Choose a reason for hiding this comment

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

async is not needed if there's no await AFAIK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

async is the simplest way to turn the returned Blob into a Promise, which is necessary to match the mocked API

Copy link
Contributor

Choose a reason for hiding this comment

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

I would use Promise.resolve but ok.

// clipboard data. We want to avoid false negatives (even if a browser changes its sanitization), and in case of a
// false positive the user is pasting data we don't have any good way to handle, so trying to make a Table from it is
// acceptable.
return /<table[ >]/.test(htmlContent)
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we would like to be case-insensitive, just in case?

@kazcw kazcw added CI: Ready to merge This PR is eligible for automatic merge and removed CI: Ready to merge This PR is eligible for automatic merge labels Jun 21, 2024
@kazcw kazcw added the CI: Ready to merge This PR is eligible for automatic merge label Jun 21, 2024
@mergify mergify bot merged commit b8a1b0c into develop Jun 21, 2024
35 checks passed
@mergify mergify bot deleted the wip/kw/paste-google-sheets branch June 21, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants