While all of the following are valid in the model:
1. <mwBlockImage></mwBlockImage>
Image with no caption. Must use the media dialog to insert one.
2. <mwBlockImage><mwImageCaption></mwImageCaption></mwBlockImage>
Image with empty caption. There is a slug to insert a paragraph.
3. <mwBlockImage><mwImageCaption><paragraph></paragraph></mwImageCaption></mwBlockImage>
Image with caption with empty paragraph. Nice and intuitive!
(Same for <mwGalleryImage> / <mwGalleryImageCaption>.)
The third option is the most convenient for the user. We should always
generate that when converting documents from HTML and from the editing
tools (MWGalleryDialog, MWMediaDialog/MWImageModel).
Previously, the editing tools generated option 2 if no caption text
was entered, and the converter generated option 2 if there was no
caption node or if it was empty. Curiously, option 1 was never used.
Wikitext for manual testing:
```
[[File:Foo.png|thumb]]
[[File:Foo.png|thumb|]]
[[File:Foo.png|thumb|Caption]]
<gallery mode="packed">
File:Foo.png
File:Foo.png|
File:Foo.png|Caption
</gallery>
```
Bug: T200387
Change-Id: Ie82fb339f6bd8ae1b289235bf5402490722d9a7c
New changes:
71baf1c02 Create an 'htmlMsg' function for HTML messages with HTML or DOM arguments
9a7af223e Use ve.htmlMsg to highlight values in attribute changes
a1fd90540 DiffElement: Refactor describeChanges tests
Local changes:
Implement getHtmlMessage in mw.Platform and use for DiffElement
Bug: T195243
Depends-On: Ib4ad16858e4241d33d018830dbcfded63ff703af
Change-Id: Ib5fa39e4f2f529948354b03a141542e23d169fe0
Adds support for align=none.
Also don't show changes from class names.
Change-Id: Ia00a51dd52af73183e98c8a87f4c60ee5380d81f
Depends-On: Ic668454c4b4b069dab46a608530c85a5bb7e7ad8
New changes:
7551f6c66 [BREAKING CHANGE] Rename class ve.dm.IndexValueStore->ve.dm.HashValueStore
Local changes:
Follow-through rename of IndexValueStore->HashValueStore
Bug: T188900
Change-Id: If60d0c637fe92f0e7afe916c064fafb17980d063
Parsoid now handles empty headings for us in
scrub_wikitext mode (which we use).
This reverts commit 884f301aa0.
Bug: T187913
Change-Id: I8690bbced64be76622929f78f9c9e0d8f85d4be8
This lets copy-paste between documents retain the numbered status rather than
falling back on pasting "<a>[3]</a>".
Update the part of LinkCache which selects on mw:ExtLink, so it will handle
possible multiple values in the link rel.
Bug: T188429
Change-Id: Ia5e4c9fa45e94da9cbfcd2a42d017d0fda1c511f
Let's keep the ugly regexp and the comments about why we do this in a
single place.
This is mostly without behavior changes, with three exceptions:
* ve.dm.MWImageModel#attachScalable now passes a title with spaces
instead of underscores to the Scalable (this doesn't matter because
it's normalized to use spaces later anyway).
* ve.dm.MWImageNode#getFilename now returns a title with spaces
instead of underscores. This is used in some API queries and when
rendering thumbnails for missing files, and this format is actually
more correct for both of these.
* ve.dm.MWTemplateModel now URI-decodes the template title. This
actually fixes a bug where trying to edit a template transclusion
whose title contains a '?' would throw an exception about invalid
title.
Also, clarify that the return value of ve.dm.MWImageModel#getFilename
and ve.dm.MWImageNode#getFilename is different :(
Change-Id: I8e09015cea82308017ed925ec755b7231518126e
The latter was introduced for this very purpose: defining
which attributes affect the rendering (in this case the
thumbnail URL). getHashObject should be reserved for making
full semantic comparisons.
Bonus: Don't distinguish between block/inline images
for URL caching purposes.
Change-Id: I6e6d2547a0d110f07c4d18b8179c168d8c251059
Resolving attributes means turning 'href' and 'src' URLs from possibly
relative to absolute, so that they don't depend on the base URI of the
document.
This is necessary when rendering for clipboard (and in some other
cases), but at the point when toDomElements() is called, the document
these elements are in does not necessary have a sane base URI set,
giving us hrefs pointing to nonexistent pages.
Don't do it here; it will happen later when we know what the right
document (and right base URI) is, e.g. in ve.ce.Surface#onCopy or
ve.ui.PreviewElement#replaceWithModelDom.
Bug: T169675
Bug: T175157
Change-Id: Ie0a5d6e1c57b8efdbbfba0c24f31ca91d156e200
Avoid confusion by using `twoway` instead of `bidir`, which could be
confused with the Unicode bidirectional layout algorithm.
Depends-On: Ib59dff22e64f235e30778a5a5b3e525e4fc7fdd3
Change-Id: I7efb35245d48125b167dc0f0ef8f12aa0fff94e5
We used (\.+\/)* instead of (\.\.?\/)* in some places,
but that doesn't make much sense since we won't and shouldn't
ever see stuff like '.../'
Change-Id: I9efcff2d2a34499ca57321dfbae29392ecb422d7
As type is always 'mwTransclusionInline/Block'.
Bug: T166801
Change-Id: I76cdf0add780d556206c439797cfcca19133d94d
Depends-On: I0f24d9d81b5491a8f09bc59e5f544f99751fd506
Implement special node types for language variant markup, so that they
display appropriately based on the currently-selected variant.
(Parsoid uses empty elements to represent this markup, so without this
patch anything in -{ ... }- is alienated and disappears.)
A follow-up patch will implement context items and inspectors to
allow editing these nodes. This patch is basic "read-only" support.
Depends on I4fcdebc2290ec35ba188f4c2e69d578791fbcd67 in Parsoid to
generate the appropriate markup, but this patch is safe to merge
independently.
Bug: T49411
Change-Id: Ie11e9301d2513bfe4a36036481cee9a047f46d37
A missing image should return some data to say the
image is missing, not just reject the promise.
Bug: T169337
Change-Id: Ib41a64a783c1baca88f428417c98e7fb913d14a1
We were incorrectly handling transclusions with trailing
newlines after the template name.
This also improves handling of non-template transclusions,
e.g. parser functions like `{{int:mainpage}}`, which are
no longer mangled as if they were page names.
ve.dm.MWTransclusionNode#isSingleTemplate will now match
a template even if it's name is itself template-generated.
Logic for turning Parsoid's hrefs into page names stolen
from ve.dm.MWImageNode.prototype.getFilename.
Bug: T167613
Change-Id: Ibecf71338eb37bb3da81a7372e4ed41140a9af57