Page MenuHomePhabricator

Can't reliably gather list of annotation views from a DM offset
Open, Needs TriagePublic

Description

In ve.ce.Surface.prototype.annotationsAtModelSelection we move the cursor one to the right, and use getNodeAndOffset to find the inner annotation, then traverse the DOM to find all surrounding annotations.

The technique fails when the annotation is one character wide, and is generally quite hacky.

We can easily gather annotation models just by looking at he linear data, so there should be a way to do this for the view.

Event Timeline

Esanders created this task.Apr 26 2019, 1:48 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 26 2019, 1:48 PM

A side effect of this is if you cursor onto a link from the right, the preview doesn't render:

DLynch added a comment.May 2 2019, 4:17 PM

I recall poking around for this in the past, and we've been fairly good at avoiding the model knowing about its views. Which is sensible design, but inconvenient at times like this.

That's correct, but the pattern for nodes is view.getNodeFromOffset( modelOffset ) which doesn't violate that rule, so we should have something similar for annotations.

marcella moved this task from To Triage to Revisit on the VisualEditor board.May 6 2019, 7:49 PM
Esanders updated the task description. (Show Details)

@dchan Perhaps we need a new data structure to keep track of annotations and their offsets?

matmarex added a subscriber: matmarex.EditedJul 1 2019, 9:46 PM

A side effect of this is if you cursor onto a link from the right, the preview doesn't render:

With the hacks from T226708 and T225541, this is now only apparent for single-character links.