Page MenuHomePhabricator

CX2 - Selecting an option from 'Add link' selection does not update a link card.
Closed, ResolvedPublic

Description

  1. Double-click some word(s) to bring 'Add link' card. e.g. in the screenshot below, '1998' was highlighted and a matching link is found and displayed in the link card:

  1. Click on 'Add link' button - the drop-down link options appear.
  2. Make a selection (click on an option) - the drop-down closes immediately (not even allowing a user to click on 'Done'). The displayed link on the link card will not be updated to the selection made.

A link inspector in VE behaves differently - it gives a user immediate update after the selection of links was made.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 19 2018, 1:46 PM
Pginer-WMF triaged this task as Normal priority.May 23 2018, 7:07 AM
Pginer-WMF moved this task from Needs Triage to CX2 on the ContentTranslation board.
Pginer-WMF moved this task from Backlog to Priority backlog on the Language-2018-Apr-June board.

Change 440844 had a related patch set uploaded (by Nikerabbit; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Use new link card for user-added links

https://gerrit.wikimedia.org/r/440844

Vvjjkkii renamed this task from CX2 - Selecting an option from 'Add link' selection does not update a link card. to vocaaaaaaa.Jul 1 2018, 1:09 AM
Vvjjkkii removed Petar.petkovic as the assignee of this task.
Vvjjkkii raised the priority of this task from Normal to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii edited subscribers, added: Petar.petkovic; removed: gerritbot, Aklapper.
CommunityTechBot renamed this task from vocaaaaaaa to CX2 - Selecting an option from 'Add link' selection does not update a link card. .Jul 2 2018, 12:28 AM
CommunityTechBot assigned this task to Petar.petkovic.
CommunityTechBot lowered the priority of this task from High to Normal.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot edited subscribers, added: gerritbot, Aklapper; removed: Petar.petkovic.

Change 440843 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/VisualEditor@master] Make link annotations more flexible

https://gerrit.wikimedia.org/r/440843

Change 440843 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Make link annotations more flexible

https://gerrit.wikimedia.org/r/440843

In latest patchset of my patch, I have introduced new ve.ui.Command that does not open the link inspector when "Add link" is clicked.
After click on "Add link" button, we should add link annotation and display link context item in the tools column. VE works differently; when you add link, annotation is added, but you don't immediately get the link context item (VE uses popups). Because of that difference, we have two problems to solve:

  • When ve.ui.MWInternalLinkContextItem is created, body of the context item is created, with usage of link cache to get additional info, like description and thumbnail URL. Doing the same in CX will result in link context item blinking when user-added links are selected. See this gerrit comment.
  • When some text is selected, "Add link" clicked and link annotation added, ve.ce.Surface.prototype.annotationsAtFocus returns nothing, so we don't have any active annotations in ve.ce.Surface.prototype.getSelectedModels, because of which link annotation is filtered out by the code below. Because of that, after clicking on "Add link", we still have text selection context item and not link context item.
activeModels = this.activeAnnotations.map( function ( view ) {
    return view.getModel();
} );

return models.filter( function ( annModel ) {
    // If the model is an annotation that can be active, only show it if it *is* active
    if ( annModel instanceof ve.dm.Annotation && ve.ce.annotationFactory.canAnnotationBeActive( annModel.getType() ) ) {
        return activeModels.indexOf( annModel ) !== -1;
    }
    return true;
} );

@Esanders, could you give me an opinion about the former and help for the latter?

  1. Make a selection (click on an option) - the drop-down closes immediately (not even allowing a user to click on 'Done').

Note that this is upstream behaviour.

It looks like your command is causing the selection to end up surrounding the anchor tags. I don't see any easy fix for that at the moment, so for the time being I would avoid that, and use the existing workflow where the link inspector is opened (with the modifications to create a CX link type).

Change 440844 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Use new link card for user-added links

https://gerrit.wikimedia.org/r/440844

Etonkovidova closed this task as Resolved.Nov 21 2018, 1:03 AM

Checked the fix in cx2 and testwiki.