Page MenuHomePhabricator

Editing the Wikipedia Preview Word in Wordpress editor
Closed, ResolvedPublic

Assigned To
Authored By
SGautam_WMF
Jul 27 2023, 7:37 AM
Referenced Files
F37715489: 2023-09-12_12-57-41.mp4.gif
Sep 12 2023, 10:38 PM
F37715486: 2023-09-12_12-56-42.mp4.gif
Sep 12 2023, 10:38 PM
F37715482: 2023-09-12_12-55-31.mp4.gif
Sep 12 2023, 10:38 PM
F37676119: WP_MobiletoDesktop.webm
Sep 8 2023, 9:40 PM
F37676118: Mobile_WrongPreview.webm
Sep 8 2023, 9:40 PM
F37676129: WP_NewPreview.webm
Sep 8 2023, 9:40 PM
F37676117: WP_Edit.webm
Sep 8 2023, 9:40 PM
F37153559: image.png
Jul 28 2023, 2:00 PM

Description

Background

In the current WordPress editor, when a user edits a word or phrase linked to a Wikipedia preview, the preview remains visible. This could lead to confusion, especially if the user modifies the word to something unrelated.

Proposed Solution

  • Once a user starts editing a word or phrase with a linked Wikipedia preview, the preview should disappear. This ensures that the preview only represents a word or phrase when it's not being altered.
  • Once user has finished editing the word, they can manually initiate the process to add a new preview.
  • The user should be able to use the native "undo" feature to restore a preview after an edit

Acceptance Criteria

  • When a word or phrase linked to a Wikipedia preview starts being edited, the preview disappears.
  • If a user edits a word but then clicks undo (cmd+z), the original preview is restored.

Test Scenarios

  • Test by editing a word linked to a Wikipedia preview and verify that the preview disappears.
  • Verify that the user can manually add a new preview to the edited word.
  • Verify undo behavior works as expected

QA Results - WordPress- Dev

ACStatusDetails
1Test by editing a word linked to a Wikipedia preview and verify that the preview disappears.
2Verify that the user can manually add a new preview to the edited word.
3Verify undo behavior works as expected

Event Timeline

Note: if the highlighted text includes a space, when editor remove that space, the wikipedia preview should remain.

image.png (150×175 px, 3 KB)

what about the case for Word Press?

image.png (130×319 px, 6 KB)

PWaigi-WMF triaged this task as Medium priority.Aug 1 2023, 3:41 PM

PR ready for review: https://github.com/wikimedia/wikipediapreview-wordpress/pull/90

Note: if the highlighted text includes a space, when editor remove that space, the wikipedia preview should remain.

Agreed. I've added code to make sure there are no untrimmed preview word formats to begin with.

what about the case for Word Press?

Current approach removes the entire format from both words "Word Press"

what about the case for Word Press?

image.png (130×319 px, 6 KB)

Can you say more about it? is it removing the space between Word and Press? If so, we need to see how does that impacts the meaning of the overall word.

what about the case for Word Press?

image.png (130×319 px, 6 KB)

Can you say more about it? is it removing the space between Word and Press? If so, we need to see how does that impacts the meaning of the overall word.

Text Word Press, user remove the space to WordPress. I think the meaning of this case not always valid, may bring the code complexity here, so better not to do it as @eamedina mentioned.

what about the case for Word Press?

image.png (130×319 px, 6 KB)

Can you say more about it? is it removing the space between Word and Press? If so, we need to see how does that impacts the meaning of the overall word.

Text Word Press, user remove the space to WordPress. I think the meaning of this case not always valid, may bring the code complexity here, so better not to do it as @eamedina mentioned.

So if a user removes the space in between then we remove the entire preview right?

@eamedina For AC1, it does what it's supposed to do but would you still want the preview to come up if you deleted some of the letters of the original? Also, let me know what you think of the last 2 .webm
in the possible issue section.

✅AC1: Test by editing a word linked to a Wikipedia preview and verify that the preview disappears. Verify that undo behavior works as expected

✅AC2: Verify the user can manually add a new preview to the edited word.

Possible Issues:
Wrong Preview: When you go from Desktop to mobile via dev tools and click on the word "Philadelphia", it always first chooses a different preview of "Bert Bell" but when you click on it a 2nd time, it will be the "Philadelphia" preview

Desktop to Mobile: When you go Desktop to mobile, click on "Philadelphia" so it can be in the mobile format. Switch back to the desktop and click on the "Philadelphia" preview, it stays in mobile format. It will only go back to desktop format if you refresh the page.

Hey @GMikesell-WMF, let's talk more about the Philadelphia case: I suspect it's a set up issue that the plugin you're testing doesn't have the latest from the main branch yet.

Regarding the other possible two issues: usually when switching from mobile to desktop view like that in a browser, it is necessary to refresh the page to obtain the correct view settings, so I think we can scratch them as non-isssues

@eamedina My testing above was done in Prod. The testing below is from Dev. I did not come across any of the issues that I got from Prod, which was the point as seen in the gifs below. I'll move this to Done. Thanks for all your work!

Status: ✅ PASS
Environment: WordPress- Dev
OS: macOS Ventura
Browser: Chrome 116
Device: MBA M2
Emulated Device:: N/A
Test Link:
http://dev-test.local/wp-admin/post.php?post=6&action=edit

✅AC1: Test by editing a word linked to a Wikipedia preview and verify that the preview disappears.

2023-09-12_12-55-31.mp4.gif (1×2 px, 569 KB)

✅AC2: Verify that the user can manually add a new preview to the edited word.

2023-09-12_12-56-42.mp4.gif (1×2 px, 1 MB)

✅AC3: Verify undo behavior works as expected

2023-09-12_12-57-41.mp4.gif (1×2 px, 777 KB)