Page MenuHomePhabricator

[M] Add support in native editor to scroll directly to target text from article
Closed, ResolvedPublic

Description

Goal:
Enable user to highlight article text and be taken directly to that text in the Native Editor

Requirements:

  • After highlighting a word, and tapping edit in the contextual menu the NativeEditor appears and scrolls directly to the word that you highlighted.

Testing notes

  1. Select text in article. Tap "Edit" in contextual menu.
  2. Confirm editor scrolls to the correct selected spot upon load.

This feature existed before, so you can compare and regression test against the current App Store build.

Engineering note

For this to work, we must currently do some wild html > wikitext conversion regex somewhere in our javascript, but it works surprisingly well!
This task is to dig up that javascript and reuse it if possible. Allow the native editor to be passed in a “scroll to this html” string, and it will do it’s best to find it (with our old javascript regex converted to native regex) and scroll to it.

The area of interest for porting is highlightAndScrollToWikitextForSelectedAndAdjacentText in codemirror-editTextSelection.js.

Event Timeline

Seddon renamed this task from Add support in native editor to scroll directly to target text from article to [Task] Add support in native editor to scroll directly to target text from article.
Seddon renamed this task from [Task] Add support in native editor to scroll directly to target text from article to [M] Add support in native editor to scroll directly to target text from article.Feb 1 2024, 6:10 PM

https://github.com/wikimedia/wikipedia-ios/pull/4735

Skipping design review for this one, since this is pretty much identical to what it did before.

JTannerWMF claimed this task.