When you set a redirect in VisualEditor, it doesn't display anything, so it looks like it didn't work.
- Mentioned In
- T69147: VisualEditor should support redirects to sections on a page
T140032: Redirect HTML not restored after editing
T127268: Dismantle ResourceLoader's "targets" system
T88081: Redirect syntax under text is considered a redirect
- Mentioned Here
- T88081: Redirect syntax under text is considered a redirect
We should probably show the same as the MW-rendered redirect:
… or ideally a better system that doesn't use an image, and fix MW whilst we're at it.
I spoke to Roan about what I would need to know to do this today. After some explanation we realised that this relies on meta items (e.g. redirects) having the possibility of being visible (at the moment they are just stripped from the model data so we don't know where they are). That is somewhere on his work list but he is not particularly close to starting it.
Also, I thought for a moment that since a valid redirect must be in a certain position (at the top of the document - if it's under something else then it's actually just a list element starting with 'redirect' and with a link to the target page), we could perhaps rely on that to make it visible. But I suspect that would be a pretty ugly solution.
When checking that I was right about the valid positioning of redirects, I found that Parsoid implements redirects wrong (or rather, differently to MediaWiki core's parser): it seems quite happy to accept a redirect that is anywhere in the document.
Created attachment 15753
In this case, I re-pointed a redirect, so it was displayed, and now it *looks like* changing it caused the redirect to be removed rather than changed.
As discussed on IRC there are two approaches: Make the redirect render as a node (the patch just submitted) or keep it in metadata and render a new control above the document.
Having it as a node gives us selection and delete for free, but there are no systems in place to make that node un-moveable, or un-copyable. Given that an unmovebale node can only ever be at the start or end of a document (by definition) I'm not sure we need to support that.
If all we need is a bit of rendering in the surface we can add a styled button above the document showing the redirect, and which launches the dialog.