In the case the node is empty and we need an icon, use a separate
icon element that is detached and reattached as needed.
Change-Id: I5bcbe531cb1db1a4ac25ed4a2f462dde08513b7b
When deciding to add an icon to a transclusion (specifically, when
it is hidden) do so only if it is justified. Otherwise the
node becomes the icon even when it has information in it, which,
starting from the latest OOjs UI change, also has specific (small)
sizing.
Change-Id: I521c92fc645a392077e6cc90f55557c4cea3cb11
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
Move reference style hack to MWReferenceNode.css, and move
heading style hack to ve.init.mw.Target.css
Change-Id: Icbd53f8df998c9f7bcc701b7c29dc226dfc5c05f
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
Also cleanup redundant overrides, documentation and
unused messages.
Depends on If22a5197 in core.
Change-Id: I533235f4eb5d703783a8fb45dff5e7be465f4ebb
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
Also remove CSS hack from MWTransclusionNode now that
we have properly styled Parsoid references.
Bug: 63983
Change-Id: I5e8dc4c618809f6dd923fe4676d57acd1094f93d
Reorganize stylesheets in VE-MW to match JS directory structures,
and update VisualEditor.php for similar reorganization in VE core.
New changes:
c6ed962 Reorganize stylesheets
Change-Id: I4f1070643744fb2ee6726cb03e012e31a9a05c64
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
If we render new links with a plain target, then if you're on a
subpage like Foo/Bar, [[Baz]] will point to Foo/Baz. In order to
avoid this, we fake the link target to be ../Baz and resolve that,
which produces the correct result.
This hack is only needed until Parsoid stops producing ../-prefixed
links. This hack is only applied in view mode, because applying
it to our DOM output back to Parsoid would confuse Parsoid and
cause bugs.
Bug: 58314
Change-Id: Ifb4b63a26235a04e6362fc3e3e57d8773831eb38