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

Handle paste events for images and text properly #7679

Merged
merged 13 commits into from
Apr 16, 2024
Merged

Handle paste events for images and text properly #7679

merged 13 commits into from
Apr 16, 2024

Conversation

davetsay
Copy link
Contributor

@davetsay davetsay commented Apr 9, 2024

Closes #7686

Describe your changes:

  • paste text outside text area: no-op
  • paste text inside text area (editing): default paste event behavior
  • paste image outside text area: image attached
  • paste image inside text area (editing): image attached (FEATURE, DEFINITELY NOT A BUG: this persists the notebook entry, including any text edits made prior to the image paste, and leaves the entry in edit mode. If you want the entry to be committed on image paste, not in edit mode, or something else entirely, let me know @charlesh88 )

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this a notable change that will require a special callout in the release notes? For example, will this break compatibility with existing APIs or projects that consume these plugins?

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

@davetsay
Copy link
Contributor Author

davetsay commented Apr 9, 2024

Code is ready and smoke tested, @akhenry . Just gonna write up some tests

@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 56.29%. Comparing base (b18aa48) to head (ea52e82).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7679      +/-   ##
==========================================
- Coverage   56.63%   56.29%   -0.34%     
==========================================
  Files         672      672              
  Lines       27124    27135      +11     
  Branches     2632     2634       +2     
==========================================
- Hits        15361    15276      -85     
- Misses      11436    11531      +95     
- Partials      327      328       +1     
Flag Coverage Δ
e2e-full 23.63% <ø> (-18.38%) ⬇️
e2e-stable 60.36% <ø> (+0.01%) ⬆️
unit 49.09% <0.00%> (-0.05%) ⬇️
Files Coverage Δ
src/plugins/notebook/components/NotebookEntry.vue 15.42% <0.00%> (-0.90%) ⬇️

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b18aa48...ea52e82. Read the comment docs.

@davetsay davetsay marked this pull request as ready for review April 12, 2024 22:32
@ozyx ozyx self-requested a review April 14, 2024 23:32
@ozyx ozyx added this to the Target:4.0.1 milestone Apr 15, 2024
@ozyx ozyx added the type:bug label Apr 16, 2024
Copy link
Contributor

@ozyx ozyx left a comment

Choose a reason for hiding this comment

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

Looks mostly G2G just a few small comments

e2e/helper/hotkeys/hotkeys.js Outdated Show resolved Hide resolved
@@ -27,6 +27,7 @@ This test suite is dedicated to tests which verify the basic operations surround
import { fileURLToPath } from 'url';

import { createDomainObjectWithDefaults } from '../../../../appActions.js';
import hotkeys from '../../../../helper/hotkeys/hotkeys.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import hotkeys from '../../../../helper/hotkeys/hotkeys.js';
import { copy, paste, selectAll } from '../../../../helper/hotkeys/hotkeys.js';

Comment on lines 567 to 568
await hotkeys.selectAll(page);
await hotkeys.copy(page);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await hotkeys.selectAll(page);
await hotkeys.copy(page);
await selectAll(page);
await copy(page);

etc

Comment on lines +596 to +597
await expect(await page.locator(`text="${TEST_TEXT.repeat(1)}"`).count()).toEqual(1);
await expect(await page.locator(`text="${TEST_TEXT.repeat(2)}"`).count()).toEqual(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await expect(await page.locator(`text="${TEST_TEXT.repeat(1)}"`).count()).toEqual(1);
await expect(await page.locator(`text="${TEST_TEXT.repeat(2)}"`).count()).toEqual(0);
expect(await page.locator(`text="${TEST_TEXT.repeat(1)}"`).count()).toEqual(1);
expect(await page.locator(`text="${TEST_TEXT.repeat(2)}"`).count()).toEqual(0);

// If the clipboard contained an image, prevent the paste event from reaching the textarea.
if (hasImage) {
addTextFromPaste(event) {
if (!this.editMode) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is easily confused for the API's Edit mode. Can we rename this to make it clear that it refers to the notebook entry being editable?

Co-authored-by: Jesse Mazzella <[email protected]>
@ozyx ozyx added the pr:e2e:couchdb npm run test:e2e:couchdb label Apr 16, 2024
@ozyx ozyx self-requested a review April 16, 2024 20:48
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Apr 16, 2024
Copy link
Contributor

@ozyx ozyx left a comment

Choose a reason for hiding this comment

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

LGTM

@ozyx ozyx merged commit e91aba2 into master Apr 16, 2024
19 checks passed
@ozyx ozyx deleted the VIPEROMCT-474 branch April 16, 2024 20:54
@unlikelyzero unlikelyzero added this to the Target:4.0.1 milestone Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Paste frequently does not work in notebook entries
4 participants