* Create a method to produce the correct label
* Override that method in the citation dialog subclass
Change-Id: Ic74a23dcf30aae201f3d6c312b760cf058aadf11
This fails before the reference has been inserted, because
it's not yet in keyedNodes at that point.
Bug: 63031
Change-Id: I34ea1a88c0f332c23e43597d1c42158bfb0f1e98
Objectives:
* Allow users on-wiki to create tools and dialogs for citation templates
of their choosing
* Allow editing of citation templates directly, without having to go
through the reference dialog
* Provide citation template tools within reference editing that use the
same titles and icons as the citation tools do, but don't wrap the
inserted content in a ref tag
Changes:
* Reference list was cloning the DOM element it was inserting into its
view before the generated content node could finish rendering, so it
never ended up showing the finished rendering in the reference list
* Documenting hack about use of reference list node's destroy method,
and how we are depending on destroy not canceling generated content
rendering
* Introduced reference model
* Added saving/updating method to transclusion model
* Added getPartsList method to dm transclusion node, which caches the
result and invalidates the cache on update
* Added citation dialog, which extends transclusion dialog
* Added cite group to toolbars, cite-template in reference dialog toolbar
* Factored out getting the node to edit and saving changes procedures in
transclusion dialog so they could be extended in citation dialog
* Updated uses of autoAdd as per changes in oojs-ui (Ic353f91)
* Renamed MWDialogTool file since there was only one tool in it
* Expanded TransclusionDialogTool file out since there is now more logic
to it
* Switched to using ve.dm.MWReferenceModel instead of plain objects in
reference search widget
Configuration:
If you add to MediaWiki:Visualeditor-cite-tool-definition.json the
following code you will magically be presented with a delightful array
of citation options:
[
{ "name": "web", "icon": "ref-cite-web", "template": "Cite web" },
{ "name": "book", "icon": "ref-cite-book", "template": "Cite book" },
{ "name": "news", "icon": "ref-cite-news", "template": "Cite news" },
{ "name": "journal", "icon": "ref-cite-journal", "template": "Cite journal" }
]
...or...
[
{
"name": "any-name",
"icon": "any-ooui-icon",
"template": "Any template",
"title": "Any title text"
}
]
The title text is derived either from the title property or from the name
property by pre-pending the string 'visualeditor-cite-tool-name-' to
generate a message key. Titles for 'web', 'book', 'news' and 'journal' are
provided. The icon is a normal oo-ui-icon name, and more icons can be
added, as usual, by adding a class called .oo-ui-icon-{icon name} to
MediaWiki:Common.css. 'ref-cite-web', 'ref-cite-book', 'ref-cite-news'
and 'ref-cite-journal' are provided. The template name is simply the name
of the template without its namespace prefix.
Depends on Ic353f91 in oojs-ui
Bug: 50110
Bug: 50768
Change-Id: Id401d973b8d5fe2faec481cc777c17a24fd19dd4
The request for originalDimensions is taken from the API, which can be
rather slow. There is a future (soon) fix that refactors the entire way
we read the originalDimensions asynchronously and load it into the dialog
but until that is available, this fix introduces a couple of basic
fallbacks in case originalDimensions are not yet available in the size
widget.
Bug: 62024
Change-Id: I8d00cea6f1d667359a44a6c185c16340bc6e81c9
It was excluded, but also promoted, and the toolbar resolves this ambiguity
in favor of promotion.
Bug: 62575
Change-Id: I2f1eadb27cbd16e3258aee0311c7b35f6311ea5a
This works the first time the dialog is opened, but if the user types
a value into the search widget that yields 0 results, then closes
and reopens the dialog, that value will persist and the search widget
will still be empty, so we'll wrongly disable the "Use existing reference"
button.
Instead, check what we're actually interested in directly: whether
the index of reusable references is empty.
Bug: 61960
Change-Id: If4bf6ced7dc3af643f602c07f3142a0e637a3247
* Corrected the condition that set default size only if the image
wasn't smaller than the default.
* Added a couple of sanity check conditions for the OO.Compare
condition
Bug: 62586
Bug: 62581
Change-Id: I4db996cec33ac9d53ef485b53568100e3912c4ae
* Use "Insert template" when adding a single template
* Use "Insert transclusion" when adding a multi-part template
* Use "Apply changes" when working with an existing tranclusion
* Use "Loading..." and disable while waiting for template data
* Disable when the transclusion has only a template placeholder
Bug: 50998
Change-Id: Ib2fb3d8711ed6d3ef41cc0db55740c95394dd3f9
When an image is smaller than the default size, the placeholder 'default'
value will be the image's actual size. This means that if a user selects
default thumb size for the image, it won't be changed unless the original
size is bigger than the default. Also adjusted so that default size limits
width only, and doesn't act as a bounding box on size change.
Bug: 62293
Change-Id: I8341776794843ff63a93bedeadf5921851c57a26
While the documentation is unclear, it seems that the 'thumbsize' in
$wgDefaultUserOptions is setting up width limit rather than a general
bounding box.
Things that are adapted in this fix:
* Only resize the image if the image is bigger than default and marked
as default size.
* Only limit width, even if the image is tall.
* Add rounding to calculated height value.
* Make sure new images follow these rules as well on insertion.
Bug: 62293
Bug: 62279
Change-Id: I37525bf3480bb1da8b0538f9b38576616aabbfa6
Fix a bug in MediaEditDialog that resulted from sync issues when the
'select' event is fired for OO.ui.ButtonSelectWidget widgets.
Use the details of the selected item given from the event rather than
checking the state of the widget with getSelectedItem().
Change-Id: Ifbbf722ff374e10b680a6b55ab99f5fc86480c40
* Automatically select single mode when possible
* Allow dynamic switching when possible
* Hide most of the controls and information when in single mode
* Allow parameter model to be instantiated without name and value args
* Place add param buttons at the bottom of template and param pages
which are only visible when in single mode and on the last page
Change-Id: Iaffbf1863b808c8089dfcf09a976d165f28c8b74
Also update for dialog size changes on oojs-ui, and make the
save dialog grow from 'medium' to 'large' when viewing a diff.
New changes:
ae195ac Update OOjs UI to v0.1.0-pre (e4f6ce0156)
ab70193 Pass surface set into ve.ui.Dialog and ve.ui.Inspector
Bug: 60494
Change-Id: Ib3065e228459aa00f18c309d234f3324fdb34059
The promote/demote rules in mw.Target had changed, but these changes
weren't copied to MWMediaEditDialog and MWReferenceDialog.
Also, we ideally shouldn't need to maintain these things
completely separately from each other.
Bug: 62286
Change-Id: I459c3310f2ac0d8860a686a05da4f45d9a888801
Fixing several inline comments from the previous commit, and
reorganizing the usability of size select clicks to prevent loop
click bug.
Change-Id: I259d86e9bbe90270d8883b7a3de96979b1d5a156
There are several conditions to defaultSize behavior of thumbnails and
frameless images and other images when it comes to default size. In the
same principle is 'border' which is not quite a type despite the fact
it 'behaves' as such in wikitext (and has a unique identifier that comes
instead of the other types.
This commit aims to organize this behavior for the user in an
understandable manner.
* Add 'basic' image type for images that have no specified type ('none')
* Handle the difference in 'default' size behavior between basic images
and thumbnails/frameless. The thumb/frameless images have the default
wiki size. Other images' default size is their original dimensions.
* Force wiki-configured default size for thumbnails and frameless images
in the DM. This is done because at the moment Parsoid's output is of
Wikipedia's default size rather than the local wiki's. The size is
adapted if needed, directly in the DM.
* Added 'border' as a pseudo-type checkbox flag that sets css class
'mw-image-border' is for parsoid rendering on save.
* Add 'make full size' to the size widget select and treat it as a faux
default button for basic and frame images.
Bug: 62013
Bug: 62024
Bug: 61155
Bug: 61059
Bug: 61282
Change-Id: I6778705306f0dd6bb96afeb91383089a4ddab7ed
Also, use new getClosestPage method in ooui to select which page should
be selected next when a page is removed.
Change-Id: I7ce4d2ca55aac72f3aaa14c98c7189a440598e08
Also update template/transclusion code for OOJS UI
OutlineControlWidget changes, and uses some of the new
functionality.
New changes:
ac4b49a Update OOjs UI to v0.1.0-pre (51f922ba17)
Change-Id: Id7a1f60cd6ce3bdaba7ccb8774563b9e81c75cad
Handling a bug where the placeholders weren't set to images that weren't
set to default size. The switch to 'default' failed because there were
no placeholders and data for default to go on. This is now fixed in this
commit; if the image is non-default, the values are given to the media
size widget from the config settings.
Change-Id: I402b8d4de606c0939daa316408fcf5de2f0b2181
Add a dynamic limit to image dimensions; image is limited to its max
size if it is 'thumb' and unlimited in size otherwise.
This change depends on ve-core Scalable/MediaSizeWidget adjustment
https://gerrit.wikimedia.org/r/115306 (merged)
Bug: 61282
Change-Id: I1247b1360ae50af039673fa3f2b3521e457ef578
* The name was getting super long, and the Template prefix doesn't
appear to be important.
* Soon we will add a placeholder class, which would have been
MWTemplateParameterPlaceholder, but now just MWParameterPlaceholder
which seems a little less ridiculous.
Change-Id: Ie2dfe0d4c7b960cd554f89fa6340173e8786c88a
This commit makes several adjustments to make sure default size is being
handled correctly:
* Add wiki's default size configuration parameter to the
VisualEditor.hooks.php file so it can be called from VE.
* Make sure new images are inserted with default size and are
marked 'defaultSize = true' for the DM to handle.
* Force default size if 'defaultSize=true' in the DM
* Add a 'default|custom' switch to the media edit dialog for size
inputs. When 'default' is chosen, the media size widget will be
emptied, displaying its placeholders (default size)
* When the size widget's values are 0 it will automatically turn to
default size values. If the value started default and the user
typed in a size, it will automatically override default and use
custom size.
Bug: 47804
Change-Id: Ib973ea2afa96090a4ba61b2b55ee63457f1329c1