[go: up one dir, main page]

Page MenuHomePhabricator

VisualEditor: Make each reference editable where it appears in the reference list as well as on the edit surface
Closed, ResolvedPublicFeature

Description

At https://en.wikipedia.org/w/index.php?title=Wikipedia:VisualEditor/Feedback&oldid=568194420#I_can.27t_edit_the_references it has been proposed that it would be helpful to editors if they could edit references in the reference list, as well as where they appear inline.

"As just about every object you see on a page is directly editable with the VE, of course having the reflist not editable is counter-intuitive. "

This proposal would make T54736 either unnecessary or just a "workaround"/interim measure, depending on the timescale to implement.


#2 in the 2023 wishlist: https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2023/Citations/Allow_citations_to_be_edited_in_the_references_section_with_VisualEditor

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

New feedback from a user (a beginner) who wants to change a reference rom the reflist while editing with VE.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:13 AM
Aklapper removed a subscriber: rmoen.

Copying my comment in from the other ticket, since I think it remains relevant here:

The major hangup on this is that it's going to expose the challenges with VE seeing references that're defined within templates. (Because of the current lack of a centralized way to edit references, this is only really visible to users from the "reuse citation" part of the cite dialog, where such references don't appear.) I suspect that if we accept having those ones greyed out in the list with a "this can't be edited here" tooltip, the rest of this should be fairly simple to do -- unless I'm not thinking of something, it's "just" hooking up a few bits of already-existing functionality and doing some UI work to expose them.

Following on from David's point, there are two ways the the reference list is rendered in the VisualEditor surface:

  1. Using the HTML of the ref list supplied by Parsoid: This will include all references, included those defined inside templates (e.g. infoboxes), but the numbers will not necessarily map to those in VE's data model, so mapping from these references to editable references will be hard.
  2. Generating a reference list by iterating over references in the document model: This will exclude references defined inside templates, but can easily be mapped back to the reference data in VE's data model. This list could be edited directly, or be used to launch a reference editor relatively easily.

(1) is used on the first load mostly for performance reasons (implemented in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Cite/+/411101) as it's a lot quicker to use the pre-generated HTML; rebuilding the reference list can be pretty slow on large pages. It also helps on wikis where most references are defined in templates, such as he.wiki.

Even if we switch to just using (2) this will mean that references are re-numbered when switching from read mode to edit mode.

From a UI perspective, we will need a way of showing the reference list context, probably by not embedding it but also thinking about where a user can click to show it (as clicking the reference list contents would now let you edit the list in some way)

image.png (205×827 px, 45 KB)

image.png (264×826 px, 55 KB)

I was thinking that a quick path forward would be for the reference list to offer a button that opened up a variant on the reuse dialog. In its context item would be the easiest place.

image.png (852×848 px, 68 KB)

Even if we switch to just using (2) this will mean that references are re-numbered when switching from read mode to edit mode.

I think we're stuck with the references renumbering in the reflist if the user edits any of them anyway, so it might be better to do it up-front and have them stay consistent throughout the entire session.

Even if we switch to just using (2) this will mean that references are re-numbered when switching from read mode to edit mode.

I think we're stuck with the references renumbering in the reflist if the user edits any of them anyway, so it might be better to do it up-front and have them stay consistent throughout the entire session.

It takes ~800ms to render the list on [[Barack Obama]], hence not doing it up-front. Also on he.wiki, the initial rendering is the only rendering with content.

Once it becomes possible to edit <references />, will editing through {{reflist}} require rich editing of templates?

Once it becomes possible to edit <references />, will editing through {{reflist}} require rich editing of templates?

Probably not – we already have a special-case support for templates that generate a reflist. Since we already treat it like a "real" references list, any new features should work here as well. For example, note how in https://en.wikipedia.org/wiki/Holcocera_immaculella?veaction=edit (random article) the references are labelled like this:

en.wikipedia.org_wiki_Holcocera_immaculella_veaction=edit (2).png (244×800 px, 28 KB)
…and not like this:
en.wikipedia.org_wiki_Holcocera_immaculella_veaction=edit (3).png (160×800 px, 12 KB)
…despite being generated from a {{Reflist}} markup.


However, supporting references defined using {{reflist|refs= ... }} would require rich editing of templates. For example https://en.wikipedia.org/wiki/Bali#cite_ref-Foley_128-0. We already detect those and disable editing in visual mode, and presumably something similar woul happen inside this new feature:

image.png (2×3 px, 1 MB)

Change 903311 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/Cite@master] Launch reference editors from ve.ce.MWReferencesListNode

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

WIP UI: https://patchdemo.wmflabs.org/wikis/6689bcdde2/wiki/Douglas_Adams?veaction=edit&section=26

Looks quite promising :-). One note: at the moment in the demo, after saving the changes, the script jumps to the link in the article. If it's not obvious, I think it would be good to stay where you started...

Hm... And I think double click is not working correctly. When I click [64] and then click [66] the edit window opens. I assume 1st click should only select as with other templates. I assume that is part of the WIP, but reporting just to be sure :)

Looks quite promising :-). One note: at the moment in the demo, after saving the changes, the script jumps to the link in the article. If it's not obvious, I think it would be good to stay where you started...

Yes - this will require some more upstream changes to fix.

I assume 1st click should only select as with other templates

These aren't real focusable templates, it's just a CSS hover and JS click handler. It could be changed to double click, but there is nothing to show after a single click (or any other interaction to be had, e.g. drag/drop).

We have previously implemented this single click -> dialog interaction with the categories list.

Currently it works like that (both in Chrome and FF):

1. before click2. first click3. second click
obraz.png (746×898 px, 108 KB)
obraz.png (746×898 px, 110 KB)
obraz.png (746×898 px, 73 KB)

So first click could just change highlighted ref. That would work similar to tables and templates I guess.

but there is nothing to show after a single click (or any other interaction to be had, e.g. drag/drop).

You could always show an edit button like with templates.

Test wiki created on Patch demo by ESanders (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/0f949bd767/wiki/Douglas Adams?veaction=edit

Test wiki on Patch demo by ESanders (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/0f949bd767/w/

Test wiki on Patch demo by ESanders (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/6247694800/w/

Change 903311 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Launch reference editors from ve.ce.MWReferencesListNode

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

Change 922153 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/Cite@master] Fix ref list click-to-edit on mobile

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

Change 922153 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Fix ref list click-to-edit on mobile

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

For Tech News, please confirm if this is an accurate summary, below?

Citations and footnotes can now be edited directly in the references section using VisualEditor. This feature request was voted #2 in the 2023 Community Wishlist Survey.

And confirm the timing: Will it be on the deployment train next week, or live on Monday, or other/later?
And is there a documentation page that it should link to, or just plaintext?
Thanks.

Citations and footnotes can now be edited directly in the references section using VisualEditor.

I wouldn't describe it like this (which I think is how the wish was described). You can't edit the citations in-place, like you can a image caption, but you can launch the editing dialog for each reference from the list. Maybe:

Citation and footnote editing can now be started from the reference list when using the visual editor.

The changes are in wmf10 which is on mediawiki.org (e.g. https://www.mediawiki.org/w/index.php?title=Composer&veaction=edit&section=10) and would already be on Wikipedias but for the train being blocked at the moment (T330216).

There is no documentation at the moment, just the text description.

Test wiki on Patch demo by ESanders (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/e045f72283/w/

ppelberg claimed this task.

Change 950231 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/Cite@master] Don't warn that reference list is uneditable

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

Test wiki created on Patch demo by Novem Linguae using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/d94eddd976/w

Change 950231 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Don't warn that reference list is uneditable

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

Test wiki on Patch demo by Novem Linguae using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/d94eddd976/w/