It appears like this was never tested.
Now that it is covered it's much easier to play around with the
implementation and compact it a bit.
Change-Id: Ie9cc14082f69e7240380d352fb362d0a3fa4d341
It's possible to specify a parameter with no name via TemplateData.
This confuses the template dialog because the empty string is a
reserved, internal value for parameters that are in the process of
being named.
Fixing TemplateData is not so easy. Therefor this workaround here.
See T333826 for a detailed description.
Bug: T333826
Change-Id: I5f4efd7069e71ba51138a23f3c3cb40e1b50d339
Parsoid will start populating the link content with the alt text if it's
available before falling back to the filename. Preserving what's there
is needed to avoid dirty diffs during the transition and for cached
content. In the future, we can remove errorText and replicate Parsoid's
new behaviour..
Bug: T273014
Needed-By: Iddf3e204d6e489cc8a33034da0d9e540efe65553
Change-Id: I7ab3d141b1df92d4447f7e3d6164082844d5bd10
Our encoding for the hrefs like "./Foo" that we send to Parsoid
differed slightly from how Parsoid outputs them, so to avoid dirty
diffs, we had to store the original ones we received from Parsoid
and send them back if they were unchanged.
Change the encoding to match Parsoid's exactly (by referring to the
Parsoid source code), and then remove 'rawTitle'/'origTitle'.
On a historical note, 'rawTitle'/'origTitle' were originally added to
fix other issues with links, which I hope are long behind us:
* bb45d984ca (T145978)
* fda2e6c1b5 (T44140)
Follow-up to 362df66b47, which removed
some other old stuff from the handling of Parsoid links.
Bug: T325766
Change-Id: I0ad0a655380eb2fb29b5ac01e2e399ac550ce34a
While at it, also fix a few broken uses of `@see` where `@link` was
intended or for full names, there is no syntax needed, as JSDuck
already links those.
Change-Id: Iaeb46b05c6f2e6f00198bc2ae773c895935b4cea
Redlinks now come down with a `mw:LocalizedAttrs` typeof, and have the
display URL parameters rather than being bare titles.
Bug: T324352
Change-Id: Ia1776e6e1f171d227c7c402b39ca96d17fb56cdb
We need to strip the protocol on both sides. This might have been broken
by Ic00b38b04ce78178c64c13bab7f1b2e4b6c5b803 in MediaWiki core.
Bug: T321437
Change-Id: I11903b767aebfdb189a8d54fbf6fb7f8ce9ffb6a
This patch follows the audit made on the extensions to check the usage
of the "rel" attribute and check that it's compatible with multi-values.
Bug: T315209
Change-Id: Ib323736d93ea96c86f9d56599e515c9e6d72a76e
This code was for when the dialog had a trash can icon for every
parameter, and parameters could actually be deleted. It's unreachable
now.
We missed this when removing the old workflow.
Change-Id: Ic94df506ea84009a1e1863a4e9847a70498df448
The need for something like this was anticipated in
I2bf43c7e83283f43e047229eb53c244918fcbb0c.
As of version 2.5.0 of Parsoid's output, if alternate text is missing
for an image but a caption is present and image isn't displaying the
caption (ie. it isn't a thumb or frame), then the text content of the
caption will be set as the alt attribute. Parsoid will then drop the
alt attribute when serializing if it matches the caption text, since
it's unnecessary.
However, if the caption is modified and the alt text isn't, the alt will
be serialized. This is likely to be unexpected to editor. They may
have missed that the both the caption and alt are populated in VE and
only edited one place.
Since all of the above is happening only for images where the caption
isn't visible, it doesn't appear to be a much used feature since, at
least for inline images, the experience of caption editing was already
less than optimal.
However, because of a quirk in how galleries are rendered in Parsoid,
this affects gallery caption editing, which is visible and presumably
used more often. See T268250 for a discussion on an improved gallery
structure. But for now, gallery images are effectively inline and set
the alternate text, thus subject to the above.
Here we add a checkbox so that the default is to ignore the alt if it's
the same as the caption. And only make use of it if it differed
originally or was explicitly unchecked to modify.
Bug: T311677
Change-Id: Idf297d8a98995971c5835b0cea56c3317a3626e2
It is no longer necessary to prepend a colon in Parsoid HTML
to ensure they are interpreted as links rather than an image
inclusion or categorization.
Instead, the colon causes Parsoid to generate piped links
when they could be unpiped, so remove it.
This code was added in 1e62e9f64c (2012),
the Parsoid bug was fixed in b62b93c678 (2013).
Bug: T312700
Change-Id: I3d71fd658b5dd627445e60b850f647081ef842e7
Only 'altText' should be described, everything else
is computed or, in the case of `resource`, results in
nodes being incomparable.
Change-Id: I586b67a0cfa30fae10a86fe3791f7e532c0ed754
This was done in 3 rather "random" places:
1. Whenever a template is manually added. But rather late, after the
template was added, in an event handler that is about focus
behavior. It should not continue to manipulate the template that
was just added.
2. When the dialog opens with a template preloaded by name, as it is
done from the citation menu.
3. When the dialog is about to finish loading.
This patch fixes 2 issues:
* Get rid of a duplicate call (number 2 and 3) when using the
citation menu.
* Move number 1 to a place where it's executed much earlier, and
only when the user clicks "add template" in a template placeholder.
There is no other way to add a template to an existing transclusion,
but it's still a more appropriate place I feel.
Bug: T311069
Change-Id: I8a65ad703b95ba2092e9ef73493e9903e96b0dd6
The "mediaClass" property now only serves to capture the original class
found on the media so that it can be roundtripped without causing dirty
diffs. In the 2.4.0 version of Parsoid's output, that will still be
the usual Image/Audio/Video. As of 2.5.0, it will always be File and
the mediaClass property can be dropped.
Parsoid is currently forward compatible with serializing mw:File, so
edited or new media can use that type already.
The contextmenu item for media has been updated to make use of the
"mediaTag" instead of mediaClass to continue distinguishing media types.
That was the only place a grep of mediaClass turned up any use.
Bug: T273505
Change-Id: If5dc6b794dacd6973d3b2093e6b385591b91d539
Before the (intentional) design decision was to not do anything special
when the same parameter is used multiple times (via aliases). Garbage
in, garbage out. Only the first usage of the parameter would work as
intended. The rest was ignored and subsequently removed from the
wikitext.
New design decision: Track and display duplicates as they appear in the
wikitext.
Notes:
* It's not possible to create such a situation in VE. Do this via
wikitext.
* Labels will be made distinguishable via T309198.
* Possible warning messages will be added later.
* The behavior when unchecking a duplicate will be specified later.
Bug: T309198
Bug: T310248
Change-Id: I6011344638cdad8529d8f57513ef51b5237eb878
Parsoid stopped emitting figure-inline in content version 2.2.0 and VE
requests 2.4.0, which isn't satisfied by the earlier versions.
Change-Id: I5f47fbe85fdca7fe429952709b62f5d1cc548daf
The previous comment was true, but we forgot another edge-case. The
same parameter can appear multiple times. The old code tried to
delete it 2 times, which deleted something else.
Note that the behavior for duplicates is larely unspecified. We
will work on this soon. This is only a first quick step to fix this
specific bug.
Bug: T309203
Change-Id: If0afb2c19626c3d9db0d109d6559ae74698ed378
* Implement ve.dm.MWGalleryImageNode.static.isDiffComparable to
match ve.dm.MWImageNode, in that images with different resources
are not compared.
* Diff galleries as documents so remove/inserts are rendered.
Bug: T308747
Change-Id: Ide6f4110e65cad7f6bb6d13766815413602fd991
New changes:
72bd71dbc Localisation updates from https://translatewiki.net.
b7f38d993 Re-apply "Fix for showing "invisible icon" when root node is hidden""
Local changes:
* Ensure templates are attached to DOM before rendering invisible
icon in converter hack.
Bug: T305110
Change-Id: I0e4c02619b2a06b9932f214ae482093fdb0cb22c
Such comments don't add any new information. The method signature
alone already tells the full story.
We did this already to a lot of the template related code we touched.
This is just a bit of cleanup to make it consistent.
Change-Id: I932b620910924a16dc0d31d6c8a3ab11818316fe
The numeric part of these ids is never used on it's own. There is no
need to expose it.
Note we renamed the method not long ago in I6eeab8b to reflect better
what it does. This is the next step. We just forgot it back then.
Change-Id: I5da82855e99ea3a42a5d91379c6974ae9c154518