Page MenuHomePhabricator

Empty ref after switching editor after inserting an automatic citation
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  1. Edit a random page using VisualEditor
  2. Ensure that the "Publish changes…" button is active, e.g. add some text
  3. Generate an automated citation using Citoid
  4. After the citation is generated, without clicking "Insert" switch to the source editor

What happens?:
An empty <ref /> tag is added where the citation was introduced. The empty ref does not appear if the "Publish changes…" button wasn't active.

What should have happened instead?:

  • Drop the citation completely. Same behavior as when the page is saved.
  • Add the citation before switching. Not possible. There is not always something to add.
  • Prompt the user to decide before switching.

Event Timeline

I can reproduce this even without the first mode switch – it seems you just need to ensure that the "Publish changes…" button is active, either by switching as you described, or by just making some changes in visual mode.

If you try to publish the changes instead of switching, the citation is dropped completely, so probably the same thing should happen here (although maybe the better behavior would be to never drop it: T173437).

matmarex renamed this task from Empty ref after multiple editor switches to Empty ref after switching editor after inserting an automatic citation.Nov 29 2021, 2:55 PM
matmarex updated the task description. (Show Details)

I can still reproduce this. It does not happen when I try to publish, but really only when switching editors.

Change #1214449 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] Don't export ref placeholder in MWReferenceNode.toDomElements

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

We talked about this in a larger round and decided to make it behave the same as when saving the page, i.e. nothing is inserted. This is necessary because there is usually no content to insert in place of the […] placeholder.

We realize there is an edge-case where the ref content is already generated by Citoid's "automatic" feature, but not inserted yet. If this is a relevant edge-case needs to be discussed later and is out of scope of this ticket.

Change #1214523 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] [POC] Close inspectors before switching to wikitext editor

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

Change #1214449 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Don't export ref placeholder in MWReferenceNode.toDomElements

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

Change #1214523 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Close inspectors before switching to wikitext editor

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