Since GCN aggressively modifies this.$element, these classes
didn't survive for very long, and they weren't being used
anyway.
Change-Id: I6e9827499374941fbded983956c57cc250d957c8
Check if, after being fully rendered, a template is effectively
empty. If it is, add an icon and style to it so it displays for
the user and is clickable.
Bug: T51806
Change-Id: I11b9f0aba3398a3deb3e755051366e174a28e586
If an MWTransclusionNode is inserted, then immediately modified,
a race condition can occur where the GCN rendering arrives for the old
node, which is already detached and doesn't have a ModelHtmlDocument
any more. Protect against this happening so we don't cause a JS error
by passing null for the document parameter to ve.resolveUrl()
Change-Id: I1964baa3a9b294b130620e9b34a695584fc55143
Replace instances of .show() and .hide() with ooui 'hidden' class
to make performance better.
Related ooui change: Ibf7c99aa4aad
Bug: T87420
Bug: T88736
Change-Id: I3af8a322e88b7ba3364f350819d6dbcdc8b13270
Means we don't make unnecessary requests to the image API
and make the server side image resizer do extra work.
Bug: T88248
Change-Id: I20e1d37c913522eafc45a9a2e263051322b9b083
ce.InternalItem used to .hide() its .$element, but it doesn't
do this any more, so we don't need to counteract this with
.show() any more either.
Bug: T87160
Change-Id: Ic367508d821cc5c65678d4c878edc84911fd8178
$.parseHTML() always returns an array, except in this one case,
so checking .length of the return value almost always works except
when it blows up in your face.
Filed upsteam as https://github.com/jquery/jquery/issues/1997
Bug: T86056
Change-Id: If133a9df4d573b41b0ecb5bde47b3e6ada053921
Follows-up b0e8900, 447e8de, d3f26e65.
Contrary to binding a reference, this-overiddes for inline
functions gets messy and fragile. There's also a minor
performance overhead that can be avoided. No separation of
concerns, eiter, as the object is held by the closure.
Also:
* Remove left-over instances of @method.
* Remove redundant '0' argument to setTimeout.
* Use null instead of $ for apply() on static methods like $.when.
* Use .empty().append() instead of .html(). Does the same but
without additional overhead and without confusion association
with "html" which isn't used (it doesn't serialise and re-parse
or clone, it just appends when given one or more nodes).
Change-Id: I797a3667c67d52568150be9be5d043d149f22077
Use model HTMLDocument when parsing transclusion nodes and their link hrefs
As well as mobile, this also covers the issue I found in /w/index.php?veaction=edit
See also T76374
Bug: T76379
Change-Id: I07c9ba0adbcee32f7eb2ca280d3a1d46e963d28f
* Introduced MWLinkAction which opens the right link inspector
based on what is selected.
* Added MWLinkInspectorTool overriding core's 'link' tool that
executes MWLinkAction
* Removed MWLinkNodeInspectorTool and linkNode command,
they're unneeded now
Bug: 72150
Change-Id: I03bd6ab1f67f31a6e6cb717cf4298e80e64637b7
Only template nodes for now. Not sure what we can do about generated content nodes in general...
Bug: 65353
Change-Id: I848f36764b446ed30c74c0e641d0973008f6880b
New changes:
a047e72 [BREAKING CHANGE] Create ve.dm.Focusable and store focusable flag there
Local changes:
* Add new ve.dm.FocusableNode mixin where required
Change-Id: Ie9ee2de05acfe3c4c62c4864e65bd20397d6a069
By searching for CSS classes that don't exist in the code.
In some cases the classes were used but had been renamed.
Change-Id: I76442a632c18d2133cdf78c4555da149c0a7888c
Instead of using ve-ce-noHighlight we can just set and maintain
this.$focusable using getFocusableNode.
Change-Id: I0a6b2d6444df531b7c235ac9ff08a3ed8a0e99b3
Per the comment above, dm doc direction will be a better
estimate of wiki direction than CSS, which is very slow.
Change-Id: I231738d660b429df1598eaaadf7397b47d35ea0c
XML-like tags in wikitext are not actually XML and don't expect their
contents to be escaped. The contents are usually not parsed as
HTML/XML anyway.
It means that it is not possible for a tag '<foo>…</foo>' to contain
the string '</foo>', but that is prevented by change Ia566452a.
Bug: 57429
Change-Id: I2516a897c85b4a3b79a34ff6cad5d124fbc30170
The code previously appeared to add 'reference' (no "s"), but was
failing to do so due to passing variadic arguments to a method
that only takes one arguments (jQuery#addClass).
See also Ifae04e48.
Change-Id: Id59673c8033c82e51577f681221dbfd312da7b8d
Looks like I messed up in Ia67f9054 and got a setting backwards
Also prefix titles in a couple more places
Bug: 67384
Bug: 66893
Change-Id: Id6d5841ee1645be62a024308da48ddc6769c78b6
Merge the media edit and media insert dialogs. Allow editing
of media properties when inserting a new image, and also
allow the user to replace the image on edit.
Bug: 67170
Change-Id: I35bd95503565dbf95090ee8110284db5a8fbba83
Now that we don't wrap generated content nodes
UL.gallery is likely to be the root, so use an
appropriate jQuery selector.
Change-Id: Ic9d9f4c0fc12daae6cf8252e4d6562366b3d2df2
New changes:
d02cf3d Fix simulation of .prepend() in ve.ce.BranchNode#onSplice
c19fa38 [BREAKING CHANGE] Remove generated content node wrappers
Local changes to remove classes attached to GC nodes
Change-Id: Ide82c96db4803ef59d398788b46fa5d7fb9a2476
Our coding style has been upstreamed and first released
in node-jscs v1.5.0 (grunt-jscs-checker v0.6.0).
Change-Id: Ifc0cfc7177946b9d11407f60e38b0177883724c5
For {{echo}} we would show "echo", but for {{Echo}} we would
show "Echo". Same for {{cite web}} vs {{cite_web}}. Normalize
these template names before displaying them in the context menu.
Reported by Matma Rex on IRC.
Bug: 66893
Change-Id: I84945aab13e53cd0aba529c298b5cc0b2e7eff1e
Depends on I468d4eb4 in core.
Uses various hacks to trick the test runner into thinking
an MW target is in use, when in fact we still use SA targets.
Change-Id: If4611307d5d7aaee4af84f86ef82faf9078043b6
Remove RelocatableNode mixins for new FocusableNode.
New changes:
fc52878 [BREAKING CHANGE] Merge RelocatableNode into FocusableNode
Change-Id: Id8ce497b0fd1ff7732f68aa1ae8af4f4f8f9db0f
Remove ProtectedNode mixins for new FocusableNode.
New changes:
e1b0e33 [BREAKING CHANGE] Merge ProtectedNode into FocusableNode
Change-Id: Ie515704163c24317739fd34d35094b9ada6bfa66
New changes:
a53f101 Update OOjs UI to v0.1.0
1fa518b Update OOjs UI to v0.1.0-pre (15f4156bac)
257af53 Use ContextWidget instead of toolbar inside context menu
5f10e73 Follow-up Ia2076a42: Mark getDescription() as @inheritable for Annotation, Node
Local changes to adjust for the ContextWidget changes.
Change-Id: I47f68f5cf1b9583dab9bd0109fa6504481bdfc67
Previously they were always inline.
MWExtensionNode is now a mixin and classes which inherit it should
now inherit MWBlockExtensionNode or MWInlineExtensionNode.
Change-Id: I0ddcabeb63acdf852e252c41add5233c00723f4c
This inspector isn't designed for insertion mode yet; attempting to use
it in insertion mode causes nasty JS errors.
Bonus:
* Make its tool title "Simple link" rather than "Link", for when
we do reintroduce it.
* Make double-clicking / pressing enter while selecting a link node
open the link node inspector rather than the link annotation inspector.
* Make link nodes render with MW's external link arrow icon
* Move the link node inspector's messages to the right RL module
Bug: 66047
Change-Id: Ib94da7ed3a2a88297dbdd1529f20cd8dab7c8421
Prevent images from getting double borders due to slugs,
and prevent extraneous margins from piling up in captions.
Also add the ve-ce-mwBlockImageNode class which shockingly
wasn't being set (only ve-ce-mwBlockImageNode-TYPE was set).
Change-Id: I86b95aa0c0def92a9790b7cdb4b05837fb8f65e2
In getFilename(), decode URL encoding and replace the search
for 'File:' with a more standard ./ stripping regex.
The ./ regex came from generateContents) in the CE class;
made that code use getFilename() instead.
Also apply decodeURIComponent() to the result; but protect against
exceptions because it's a useless piece of garbage.
Bug: 65611
Change-Id: I7e81a8dc26d1c636c6571d96f43a394a53490587
This commit brings back the sizing of the <figure> in MWBlockImageNode.
The figure must have proper size in CE otherwise 'center' and 'none'
alignments don't work, and the <figure> stretches across the entire
width of the screen.
Bug: 65836
Change-Id: Iefed466fce87f265fbd08908f1171867f9d1e1fe
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
jshint:
* Update to grunt-contrib-jshint v0.10.0 (jshint v2.5.0).
* Remove coding style options covered by jscs.
* Enable new option "freeze" (prohibits changing native prototypes).
http://www.jshint.com/blog/new-in-jshint-oct-2013/#option-freeze
* Re-order to match http://www.jshint.com/docs/options/
jscs:
* Update to grunt-jscs-checker v0.4.4 (jscs v1.4.5).
* Format .jscsrc file in a more spacious way and order the
properties less arbitrarily (using the jscs's readme order).
* Enforce more details of our coding style
* Get rid of the unsable "sticky" operator rules which have been
deprecated in favour of using other rules instead that are able
to enforce this more accurately.
- disallowLeftStickedOperators: Remove deprecated rule.
* Ternary covered by requireSpacesInConditionalExpression.
* Rest covered by requireSpace{Before,After}BinaryOperators.
- requireLeftStickedOperators: Remove deprecated rule.
* Comma covered by disallowSpaceBeforeBinaryOperators.
- requireRightStickedOperators: Remove deprecated rule.
* Logical not (!) covered by disallowSpaceAfterPrefixUnaryOperators.
See also If46b94ce1, Ib731f11b1 and I0b0cadbc5 in oojs/core.
Also:
* Update grunt-contrib-watch to latest upstream version.
Change log at https://github.com/gruntjs/grunt-contrib-watch/blob/v0.6.1/CHANGELOG#L1-L17
Change-Id: I6c5a34afea8b05a3dca617897c192594df06ca90
ve.dm.Scalable is now a computational model for image scaling and
size manipulation. This commit adjusts the nodes and the edit and
insertion dialog to handle the new scalable model, and by that
use a centralized computational engine for all scaling and size
changes.
New changes:
3ec19fb8 Refactor Scalable functionality
Change-Id: I017a017924f544cc8bc9b7d8245335759ae0e890
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
TOC Widget is created in the mw target view class.
Adding and removing a heading rebuilds the TOC Widget based
on the the order of the page heading nodes.
TOC Widget considers TOC page settings and displays in the default manor
unless forced or disabled.
TOC Widget still needs to be finalized by being placed in the surface.
This could be a problem until we have a CE node for it to live in or
have some DM work added. Roan and I have discussed how to go forward.
To enable the widget you must add the following to LocalSettings.php:
$wgVisualEditorEnableTocWidget = true;
Change-Id: I488cfbbdb060e50d81f51e0f757e67d0114b8936
Make sure the magnify button in the caption is properly shown or
hidden when image type changes. The magnify icon will always be
built, but will be shown and hidden using CSS rules.
Bug: 62139
Change-Id: Ib9a4569239ed70d16a153fb0823e283203fba1d4
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
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
Adding a type change to the media edit dialog. Also changing SelectWidgets
to ButtonSelectWidgets for consistency.
Bug: 38129
Change-Id: I9c855e6381d970b5f08460822366f6333af24f82
wgSVGMaxSize sets the maximum size for the shortest edge of a
vector image. Pass this through to MWImageNodes.
Change-Id: I6410e7cda137cf4828d12280cb1e5cfc27805859
Implement new logic in ve.Scalable from I5b4f0f91b.
Also update VE core submodule to master (57ed8d3).
New changes:
59a0afe The great image scaling rewrite of 2014
Change-Id: I24a2976036310d3814cc7d1853a68745e0499bd5
Adding the ability to edit image size in the media edit dialog.
The size is now a separate widget.
The following changes were made:
* The dialog was changed to a booklet with 'general settings' and
'advanced settings', in preparation for other edit features.
* The original image maximum size is fetched from the API and cached.
* Maximum size is limited to the image's original maximum size.
* Aspect ratio is kept when changing height or width, using original
image size to preserve a sane ratio through the MediaSizeWidget.
* If an error is found in the size, the image will retain its previously
set dimensions.
Depends on MediaSizeWidget: I3d0f9348a52
Bug: 38129
Change-Id: I2946fb21c46ce05583b219f665ef68928188899e
For block images, show the bottom left/right anchor if the image
is right/left aligned, and both if it is centred.
For inline images, show the bottom right anchor unless the page is
RTL.
Change-Id: Icb5b74b954493257c517a5fbac5f0a0a457c544c