Frame images are not resizable; disable the media size widget when
the frame type is selected.
Depends on the change in ve-core:
Id1010798d30e2928358acb5694c429b9ab68ad57
Bug: 66353
Change-Id: I8c8da8933c51ba709a834731425d19445009673f
Make sure that image model and media edit dialog initialize the
default size properties according to the scalable correctly.
Also make sure that on creation of a new node or edit of existing
node's properties follow on whether the image is set to default
size or custom size.
Depends on the ve-core change:
Ia6bb041bfc050a48d8c40bbff4b73ed2893085e2
Bug: 66149
Change-Id: I6f60fba28e11a111bb40a100148ed1f12d518890
Fixing the behavior of alignment select and checkbox in the edit
dialog. Adding a check on all UI events to make sure they update
the model only if the model value is different than the UI value.
Also adding the ability to check the default direction of a
specific node type, to predict default alignment values.
Bug: 65916
Change-Id: I82f624fa788383dec0a12afb473aef01593e670e
Make sure that if the image has default dimensions set up in the
media edit dialog, the scalable (and image CE rendering) receives
the correct dimensions.
Bug: 65886
Change-Id: I6bd2d1681a3d780554767fe77b2640795170184f
Make sure svg drawings on block images have the default size as
the wiki default, no matter their original set size.
Also took the opportunity to clarify the synchronization method
for scalable and image type in ve.dm.MWImageNode and call it when
the image model is loaded to make sure the details are always
synchronized before edit.
Followup to I682d832e456a501836f33ed1dfc7dbd78a4edf53
Bug: 62893
Change-Id: Ic47016d171634c532092067957cc2c3d431e9746
Once more with feeling; default alignment when switching between
inline to block and vise versa. This time, the problem was mainly
that the checkbox for position cannot be updated without triggering
its update event. It was triggered, however, before setting up the
positioning, which caused the model to run positioning twice and
get things wrong.
Another smaller fix in this commit was done to make sure that
the image model remembers the previous alignment, so when image
type changes from inline to block and vise versa, and the alignment
was default, it can recalculate default value for the new node.
Bug: 65564
Change-Id: I6c16a7855ad7e3ce302fa3d042d0a402251b31f0
This time in the installment: Allow the model to predict the type
and default alignment based on parameters rather than just the
current status. This is important for initializing images, especially
inline images whose 'align' attribute is null or undefined, but must
be examined for default alignment.
Also changed:
* Make sure that model operations change each other, rather than
let the editor change 'unrelated' model parameters.
* Use selectItem rather than chooseItem to avoid emiting the 'choose'
event on edit dialog initialization.
Bug: 65564
Change-Id: I8c23fc53e7738d59565294d8b98fe7351bebbc67
Make default alignment a computed value, and make sure the GUI listens
to 'choose' instead of 'select' events for SelectWidgets so to prevent
recursive calls and make sure the GUI is updated properly.
Also added a default alignment check on type change so the user can
visually have an indication that the new image will have a different
alignment. The user can then change the value manually.
Bug: 65564
Bug: 65596
Bug: 62852
Bug: 65617
Change-Id: I55e16775d18e0a4bf7f1fa73bbb3aa5e0aa51a79
Relies on If6fb5856 to do anything useful, but degrades gracefully to current
behaviour.
Bug: 50964
Change-Id: Ia35c2f433a1a604d7794f367fd10dbccac102b89
When inserting a new node, get the proper fragment range and ask
for the node from within the search loop. Also added a fallback
for the case that the node wasn't found, and a caption cannot
be added.
Change-Id: Ic19d9b1cd2739435137f633de09a13b25a11a0cb
* Fixing a typo in the getImageNodeType() method ('frame' was supposed
to be 'frameless').
* Adding a check for type 'mwBlockImage' before editing/adding captions
* Using the node's getType() method instead of the model's where possible.
* Adjusting default alignment, so that when we check if it is set, it gives
us the actual answer, which is always useful.
Bug: 65568
Change-Id: I1687d8c7430c723b52448a9e24641e2c30d85d6a
Creating an MWImageModel that handles all image edit operations.
If the new attributes mean a change of image types from inline
to block or vice versa, the model will handle the creation and
insertion of the new node.
Change-Id: Ibe71bc8bd74e4ba5a024ac722432ccf0b8f65e71
* Move description to a popup behind a little info icon button
* Make required indicator generic status indicator (required/deprecated)
and move to left of the field
* Move param name and actions to above the field
* Show deprecated status and description
Bonus:
* Use auto-focus on CitationDialog (whoops!)
* Make pages that aren't meant to scroll not scroll (whoops again!?)
Depends on I59211b2 in OOUI
Bug: 53612
Change-Id: I3b968ad14aa6c43b6484e2565a9367d2ebc72fc5
These were being used indirectly in the MW*Model's. Use surface
fragments instead.
Fixes I0fae3e5ff2bd.
Change-Id: I1d6aa5e00a9315cf7088f87f9e9d828833feec64
When using a tool that opens a citation or citation transclusion dialog,
the dialog shouldn't use edit mode unless the template in the node and the
template the tool would insert match.
Bug: 63452
Change-Id: I34a5a2da576247f4046da45f742bccc3cec22c5a
this.refGroup is only ever read and never written, so obviously it's
always undefined. And it turns out that creating references with
listGroup='mwReference/undefined' crashes when you try to remove
them again.
Bug: 63085
Change-Id: Id326208bd6b3fe3b602ed6e3b57b7ea06d8ceb2c
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
Apparently adding a parameter whose name is an empty string causes Parsoid
to output |undefined= . And I can't say I blame them.
Bug: 62621
Change-Id: I01bc401ae60935dcce309b743057641e2e503528
* 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
The error occurs when moving an item down (increasing index) which
removes the item, adjusts the index and then inserts the item. The index
shouldn't be adjusted when moving one down, however, because once
removed everything shifts and the +1 index set initially to move it is
still good.
Change-Id: I44bd2b3eb4bbbef58a6ac181e75969ec7c2cab6f
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
* 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
Symptoms:
* When adding a transclusion part that already exists, if the item is
being moved to the right it will inserted at a position one place too
far
Diagnoses:
* When an index is provided with an item in a queue given to
TransclusionModel's process method, the part is automatically removed,
but the index, if given, is never adjusted accordingly
Prognosis:
* Cautiously optimistic
Treatment:
* Decrement the insertion index, if given and after the existing index
Change-Id: If321df8f63dae07c76663e76e14864e2f4518920
Symptoms:
* When adding a template with required parameters, the last parameter
is initially focused
* Parameters and parts appear out of order, and adding/remove/moving
them shows them in almost random placement
Diagnoses:
* Parameters are auto-focused when added, and parameters are auto-added
in forward order
* TransclusionModel's process method had a bug in which the code to
derive an offset from the item being removed would not be reachable
due to an inverted logic statement
Prognosis:
* Fatal, with a 10% chance of survival
Treatment:
* Set focus on the first parameter after auto-adding required
parameters to a template
* Invert the logic in TransclusionModel's process method, so that if
the index IS undefined we will proceed to define it
Change-Id: I299053b63045ec933747831f1b4aa63493760f8b
* Reduce duplication by calling #removePart (equal, line by line)
* Reset `remove` at the start of each iteration, it was leaking
through to future iterations.
* Minor simplification in property access.
Change-Id: Ie0a83d582804bc50131ca5a8da36b0605dd4a6c3
This will make generating live previews possible.
Changes:
* Add change events to template model.
* Set up connect/disconnect.
Also:
* Add missing fallback for getParameterLabel (Param#label is
optional per the TemplateData spec).
* Implement getWikitext, to be used by the UI dialog later
to create a preview from the wikitext.
* Correctly mark ve.dm.MWTransclusionNode#escapeParameter as
being a static method.
Change-Id: Ie306ed03babf11568e954b1813ce5324f57d7f0e
Parameters are ordered using 2 consecutive buckets, the intersection of
paramOrder and parameters in use ordered using paramOrder followed by the
remaining parameters in alpha-numeric order.
A patch to TemplateData was needed to make this work, but we won't get a
crash without it, just no order specification:
Ic5b42c4189868412138680654c499b6c8bc8f47e
The paramOrder property needs some help still, as it currently requires
being either omitted or containing an exhaustive list of all known
parameters. It should backfill unmentioned params in JSON specified order
instead.
Bug: 51930
Change-Id: Ic3eb665389380c8e3dd6562b059c2f6655a22588
Use OOJS-UI's newly-extended paged dialogs (in e08eb2a03b) to refactor
how the Transclusion and Meta dialogs work, splitting out the code for
each of the panels into its own file and simplifying extensibility.
The Meta dialog (ve.ui.MWMetaDialog) now has two self-managing panels:
* ve.ui.MWCategoriesPage for categories and the default sort key
* ve.ui.MWLanguagesPage for language links
The Transclusion dialog (ve.ui.MWTransclusionDialog) now has four:
* ve.ui.MWTemplatePage for a template's primary panel
* ve.ui.MWTemplateParameterPage for each parameter of a template
* ve.ui.MWTemplatePlaceholderPage for a placeholder to insert a template
* ve.ui.MWTransclusionContentPage for non-template transclusion
Additionally, the Transclusion dialog has been slightly cleaned up:
* Replace add/remove events with replace events in transclusion model
* Actually return and resolve a promise (as documented)
* Get rid of "origin" info in template models
* Add method for adding required parts
TODO:
* Decide how and when we will choose between advanced transclusion and
template dialogs
* Work out design issues with how template descriptions will be visible
and how adding parameters will work if only showing parameters in
outline
* Add preview to template dialog
* Consider ways to further improve pages for use in continuous mode
WARNING:
* Right now the template dialog gets overridden by the advanced
transclusion dialog because they have the same symbolic name and the
latter is registered later than the former. To test the template
dialog, just change the symbolic name of the advanced transclusion
dialog.
Change-Id: I51e74b322aec9a4c3918e6f792bdb3d318060979
Also removed comment in ui.MWTransclusionDialog that was
copied from dm.MWTemplateSpecModel.
Bug: 50888
Change-Id: I9dcfef3ae65fe716bae91f703f9169171448797a
Instead of using @emits in both, use our custom @fires in
production (JSDuck 4), and in the future it'll just naturally
use the native one.
This way we can also index oojs without issues, which seems to
have started using @fires already.
Change-Id: I7c3b56dd112626d57fa87ab995d205fb782a0149
`new mw.Title` throws on invalid input. Converting uses to
mw.Title.newFromText instead and converting try/catch to if/else.
mw.Title in general (regardless of which constructor) has been
improved in core. It will no longer crash on pages where the page
title was a false hit for invalid (e.g. we couldn't load VE on
[[.com]] because the js parser thought it was invalid).
However, though the initialisation works since core has been
fixed, there are still plently of cases where we take real user
input that can genuinely be invalid.
In cases where the code did not catch exceptions and there was
no obvious way to handle it, I left it as is (let's revisit them
in a separate commit). It would be an exception either way, and
I'd rather see "mw.Title: Parser error" than
"TypeError: null does not have method getNamespaceId".
Change-Id: I5b1b23d56d39cdb7ecb0809e3d721992e0c30f54
The Parsoid team has changed their spec to always use multi-part
format even for one-part transclusions. This commit changes VE's
output format to always be multi-part, but still accepts single-part
format on the way in.
Change-Id: I6b3156b0b599ad042bb52d7f53dcdeb1c4a0954a
Return an array of languages instead of a single language. Languages
containing hyphens return themselves along with the root code e.g.
'en-GB' => ['en-GB', 'en']
Change-Id: I840b689d0021d865f93d16d075473a2ed0a9f0d8
Not having a description yet is fine, but they should at least
be indexed as blocks so that they are searchable and listed
in the jsduck generated pages. jsduck defaults to @method + name
of prototype property. And it even guesses parameters sometimes.
Search: \n\n([a-zA-Z\.]+\.prototype\.[a-zA-Z]+)
Where: modules/ve,modules/ve-mw
Where-Not: modules/ve/test
Replace: \n\n/** */\n$1
Added @return in a few places where it was easy to add.
Change-Id: I830c94cc7dbc261bd7a077391f930cbfff165f9d
Whenever there is more than 2 spaces (except the extra space
on a continued line of an @ tag, or the extra space on a
continued line of a list item) it causes a <pre> context.
Removed both spurious spaces that caused a <pre> and ones that
didn't but looked like it could.
When making an ordered or unordered list, the first item needs
to be on a new line and in block context (e.g. an empty line
before it). Otherwise it is rendered inline as 1. Foo 2. Bar
(such as in #rebuildNodes where both the ordered and unordered
lists were broken).
Change-Id: Id0f154854afbdc8e5a8387da92e6b2cdf0875f69
Problem:
Adding or moving templates or content resulted in the incorrect item
being selected.
Diagnosis:
Although recently we solved a few issues by making addPart async, it
caused some other issues where callers of addPart were assuming
otherwise
Solution:
Return a promise from addPart which is resolved after the part is
actually added and setup callers to use the promise when needed
Changes:
ve.ui.MWTransclusionDialog.js
* Use promises to auto-select new or moved parts
ve.dm.MWTranclusionModel.js
* Make addPart return a promise
* Resolve promise when queue is processed
* Automatically remove existing items before adding them in different
locations at the time of processing the queue we don't yield between
removing and adding
Change-Id: Ie43c5b89ca4ed34d5f797714e19c9a7e1824cdec
Problem:
Parsoid has a property called "i" which we don't use, but they need for
round-tripping purposes. Since we were generating a structure from
Parsoid data and then generating data from the structure without
preserving properties we didn't use, it was getting lost.
Solution:
Abstract creating a template from data vs. creating it from name. Make
only templates have an origin argument in their constructors, so and
set it within a set of static constructors that create a template for
either data or a template name. Store the original data in the former
case, and use it as a base when serializing.
Changes:
ve.ui.MWTranslcusionDialog.js
* Remove no-longer-needed mw global declaration
* Move most of the addTemplate function to a static constructor in the
template model class
ve.dm.MWTransclusionPartModel.js,
ve.dm.MWTransclusionContentModel.js,
ve.dm.MWTemplatePlaceholder
* Remove unused origin argument/property/getter
* Add serialize method (if needed)
ve.dm.MWTranclusionModel.js
* Move template/parameter generation from data into static constructor
of template model
* Move serialization to part classes
ve.dm.MWTemplateModel.js
* Add mw global declaration
* Stop passing origin to parent constructor, store it locally instead
* Add original data property/setter for preserving unused properties
when round tripping
* Add static constructors for generating a template from data or by name
* Add serialize method
Bug: 51150
Change-Id: Ide596a0ca0ae8f93ffce6e79b7234a1db7e0586c