Commit graph

801 commits

Author SHA1 Message Date
Ed Sanders e006449c7f Vertically center the progress bar within the visible part of #content
On short pages which don't extend below the fold, the progress
bar should center within the #content element.

Change-Id: I0b99e42f5bab8177d3b4ca6dd372d6403ae9b136
2015-03-23 02:34:40 +00:00
Ed Sanders 6d8fbd8221 Make loading progress bar determinate
Estimate loading times to show smooth loading progress.

Bug: T90622
Bug: T92456
Bug: T52206
Change-Id: Ic6e31a938b474c5a11c0c12302ec6c0ebc2c414d
2015-03-20 20:08:01 +00:00
Alex Monk 74cb83d2f8 Fix edit conflicts
When we moved to mw.Api, edit conflict errors stopped going via onSave and
started going to onSaveError instead. So the case to check for them in onSave
would not have worked - instead, they would go through onSaveError and get
picked up by our unknown error code, which just picks out error.info and shows
it, instead of showing our edit conflict screen.

Also return in a couple of other error cases where we probably should've been
(but not necessarily must've been... that didn't necessarily show to the user
if another error emit already caused saveDeferred to be rejected)

Change-Id: Iae7a66a8aa96ee777e9fa780005feeb429129d5f
2015-03-19 02:36:21 +00:00
Ori Livneh 94877eb668 Set mwtiming events' target to 'mwTarget', if unset
We're currently rewriting "mwtiming.performance.system.domLoad" to
"timing.ve.undefined.performance.system.domLoad". The "undefined" comes from
the missing targetName property on the event. I'm not sure why it is missing,
but having it default to 'mwTarget' will Do the Right Thing™.

Task: T93156
Change-Id: If70ff601b6c54ec8f95171cbc43c82c87a177508
2015-03-19 00:40:28 +00:00
jenkins-bot 1046d309b2 Merge "Handle TitleBlacklist errors" 2015-03-18 22:44:36 +00:00
Alex Monk 88088d4ecc Set action.saveFailure.message key in Edit schema
This relies on WikimediaMessages' version of the Edit schema being updated at
the same time.

Change-Id: Iee97fdd2a867f2c252ca7756f2e6341377d9fbb7
2015-03-18 22:24:40 +00:00
Alex Monk c286511f17 Handle TitleBlacklist errors
Relies on I69cf0a88

Using our own new message because TitleBlacklist's own one includes text that
we can't parse on the client and relies on a parameter we don't get from the
API.

This relies on WikimediaMessages' version of the Edit schema being updated at
the same time.

Change-Id: I4c75369b8b97973b72899bfaecbd5a996a440c68
2015-03-18 21:58:51 +00:00
jenkins-bot 05766564d1 Merge "Remove font tags on import (paste/drop)" 2015-03-18 18:29:57 +00:00
jenkins-bot 275ba972bb Merge "Follow-up f620111b: pass parameters to fallback requestPageData() call" 2015-03-18 18:25:24 +00:00
Ed Sanders ba20a26292 mw.ViewPageTarget: Grey-out body content as soon as edit is clicked
Set 've-activated' as soon as edit is clicked, with a 've-loading' state.

This necessitates moving the relevant styles to mw.ViewPageTarget.init.css.

Change-Id: Ic9757cdbf63a2f72eda0dd03ff5588d79028ba0e
2015-03-18 17:56:28 +00:00
Roan Kattouw 3375411afd Follow-up f620111b: pass parameters to fallback requestPageData() call
Bug: T93036
Change-Id: I84eba70d9c0af63b442993c8c59fee89da45c14f
2015-03-18 16:23:37 +00:00
Ed Sanders fbe207fabf Remove font tags on import (paste/drop)
Change-Id: I46c7d4aee2f35ccf8ab6967c0273bc46c5a79347
2015-03-18 08:51:13 +00:00
jenkins-bot 4ef6eb8010 Merge "Unbreak TargetLoader when ViewPageTarget.init isn't present" 2015-03-18 00:42:10 +00:00
Roan Kattouw 812cb9aa2c Unbreak TargetLoader when ViewPageTarget.init isn't present
By lazy-initializing mw.libs.ve

Change-Id: I2fea8a0935b43b5a25287f68bd7487c448d006b6
2015-03-17 17:38:29 -07:00
Alex Monk aac31c9c72 Fix action.abort.mechanism value in ViewPageTarget#onUnload
Was causing EventLogging schema validation failures.

Bug: T92869
Change-Id: I6ecdb4b5b39fe05448664316894314492da4379b
2015-03-17 19:02:44 +00:00
Roan Kattouw f620111b9e Send Parsoid API request immediately when user clicks edit
Move requestPageData from mw.Target to TargetLoader, call it
in init init, and pass the promise it returns into load()
via activate().

Bug: T90372
Change-Id: I828b8474e5a76b3d0d7d08735b4d865c29d2f820
2015-03-16 08:56:42 -07:00
Roan Kattouw d371014e5d Load RL modules in one load.php request, rather than in two stages
This introduces TargetLoader, which manages plugins and RL modules
in a slightly more generic fashion so that Targets themselves don't
have to. This allows us to load all RL modules in one load.php
request, rather than first loading ViewPageTarget which then
loads the other modules.

TargetLoader loads in the bottom queue, so it will be loaded
as part of the main load.php request, but in VPT.init.js we
still have to wait for it with using() because it might not
have arrived yet. This also degrades gracefully on cached pages
where TargetLoader isn't in the bottom queue: it'll be loaded
as a separate request instead, which is suboptimal but no
worse that what we were doing before.

Right now TargetLoader is small enough that it could also be in
the top queue, but in the future we want to add things like
the action=visualeditor API request to it, and mw.Api is
relatively big.

Note: this also makes a breaking change to the plugin API:
plugin callbacks no longer receive the target instance
as a parameter, as they're now executed before the target
has been constructed rather than after. In the long term,
if we want to give plugins access to the target instance,
we could give them the target promise somehow. For now,
I've killed this feature because nothing used it and
the change from a direct object reference to a promise
would have been a breaking change anyway.

Also fixed incorrect documentation index for ve.init.mw.ViewPageTarget.init.

Bug: T53569
Change-Id: Ibfa6abbeaf872ae2aadc6ed9d5beba7473ea441a
2015-03-15 03:43:05 +01:00
Timo Tijhof 93f5697586 mw.ViewPageTarget: Hide ve-ui-surface during activation as well
Follows-up 77f016a.

Bug: T91442
Change-Id: I69072b25add712c8acfcf6fc45aeb6abe8afb0c2
2015-03-12 16:04:13 +00:00
Timo Tijhof caa58d31c5 mw.ViewPageTarget: Hide ve-ui-surface instead of ve-ce-surface
ve-ce-surface is a child of ve-ui-surface. The ve-ui-surface has
margins that would remain in the document flow causing a temporary
growth outwards to the bottom during deactivation (causing the
white area and blue border on Vector's grey background to move down)
after which it would restore again.

Follows-up 77f016a.

Bug: T91442
Change-Id: I5b999b580c968fcd24f07d9a895cfa17afc80c0d
2015-03-12 17:03:30 +01:00
jenkins-bot 9249b4a70f Merge "ve.init.mw.ViewPageTarget: Recalculate toolbar sizes when adding "Save" button" 2015-03-10 21:48:06 +00:00
jenkins-bot 46a9718c74 Merge "Focus the surface after VE is already active" 2015-03-10 20:57:58 +00:00
jenkins-bot a9f2b7e717 Merge "Remove unused iconModuleStyles property" 2015-03-10 19:50:14 +00:00
Roan Kattouw afa4f20e62 Remove unused iconModuleStyles property
It seems to have been intended to allow overriding of which icons
are used, but this isn't used anywhere.

Change-Id: I312f6c8e69d5a4d9c11f4af5f9487d0890a1f4e1
2015-03-10 20:32:47 +01:00
Moriel Schottlender 1fd395e26e Focus the surface after VE is already active
Move the surface focus() call to be done after VE has loaded, to
make sure that the position of the content editable field is at the
top of the page and not -- as happens in Firefox -- after the read
page contents.

Bug: T90420
Change-Id: If91cea42c083d67b1ee6396402c3f607dde70471
2015-03-10 19:22:17 +00:00
jenkins-bot ff31db5314 Merge "Reduce complexity around onbeforeunload handler" 2015-03-10 19:17:34 +00:00
jenkins-bot 07f2992a6a Merge "Do not call Toolbar#initialize twice during editor setup" 2015-03-10 18:16:09 +00:00
Bartosz Dziewoński 11d9c55b07 ve.init.mw.ViewPageTarget: Recalculate toolbar sizes when adding "Save" button
This really should not be necessary.

Depends on I17d22ba6 in OOjs UI.

Bug: T52227
Change-Id: I024dccb0c1cc24dd8390dd44fb7a2d987eef56ea
2015-03-10 17:30:56 +00:00
jenkins-bot 557e0e28ad Remove use of ve.indexOf and ve.getObjectKeys
Change-Id: Icbaa729209605fca8018e4bcbbe29c9ded64e7f2
2015-03-10 17:28:00 +01:00
Bartosz Dziewoński 1dced9e78d Do not call Toolbar#initialize twice during editor setup
Depends on Ib9471bc0 in VisualEditor core. Without that patch
this is actually necessary, because we were removing some event
handlers in the meantime.

Change-Id: I145f1891efd1c91eeb6154e11e96e3fc160e2be3
2015-03-10 14:11:16 +00:00
jenkins-bot eb79687c83 Merge "mw.ViewPageTarget: Hide ve-ce-surface during deactivation" 2015-03-10 09:58:52 +00:00
Timo Tijhof c1accbb61d mw.ViewPageTarget: Cache '#mw-imagepage-content' query
Follows-up eb7b727a53.

Change-Id: If8bed5626ccba9e69d30b770bb2eeed3c6264c7d
2015-03-10 02:53:05 +01:00
Timo Tijhof 77f016ae8f mw.ViewPageTarget: Hide ve-ce-surface during deactivation
While showing the content earlier as soon as possible is nice, the ve-ce-surface
remained visible until toolbar and surface were torn down.

This avoids the split second where the new pageview content *and*
CE surface were visible in the page (this it also messed with the scroll position,
and would temporarily cause a scrollbar to appear).

Bug: T91442
Change-Id: I0a7232cd0264bff28ad66aa328de29d339891aa1
2015-03-10 02:48:24 +01:00
Bartosz Dziewoński d5bf7e9e9e ve.init.mw.ViewPageTarget: Use mw.Api#postWithToken for setting hidebetawelcome pref
We can't use it for saving because we need to display a warning if
the user's identity changed.

Change-Id: I05919e407cd19d96c506671020bcdb95f3e2acaf
2015-03-06 11:11:03 +00:00
Bartosz Dziewoński 1656d3495e ve.init.mw.Target: Don't go into infinite recursion on API errors
The #tryWithPreparedCacheKey method was assuming that the request
could only fail because of invalid cache key. It can also fail because
of a bad token, and probably for a number of other reasons.

So only retry only once, and then fail. If it's a 'badtoken' error
during save, the caller will handle it and retry with a working token.
If it's something else, who knows, but we don't go into infinite loop
at least.

Failing in a way that will be handled is weird because 8e48f945 changed
the signatures of the promises, but not the functions that use them.
This must be fixed later.

Bug: T91158
Change-Id: I103cf888d339b44e3fd4fe2376edf5e37ce4157f
2015-03-06 02:47:47 +01:00
Ed Sanders 94fe054257 Update VE core submodule to master (a65ad7c)
New changes:
a65ad7c Move special character inserter to toolbar dialog manager

… and add it to the toolbar as a terminal option.

Change-Id: I35834d866a13c5dea7f5a520c63b8a99451fcf6d
2015-03-03 18:20:13 -08:00
Roan Kattouw ea3fccccaa Reduce complexity around onbeforeunload handler
We used to attempt to not break Firefox's bfcache, but this
didn't really work very well, and it's not clear that avoiding
bfcache breakage is even a good idea. It's more sensible and
consistent to deliberately break bfcache while VE is active.
On top of that, the Firefox people believe that our trick
shouldn't even have worked to begin with:
https://bugzilla.mozilla.org/show_bug.cgi?id=1102664

Because the onbeforeunload handler is removed when VE
is deactivated, bfcache still works if you first click
Read, then navigate away.

Also clean up the management of the unload handler, using
addEventListener() and removing the return value fallback
code that is needed for beforeunload but not unload.
For beforeunload this is harder to clean up because
the addEventListener()-based API for returning a value
isn't consistent across browsers.

Change-Id: Ie4fe9ea3a59a54ba462733aa5e42bfc0ed5b15eb
2015-03-03 16:36:22 +01:00
Alex Monk 6f1b6c85a5 Send abort event on unload
Still misses some preinit aborts because we need to figure out
a way to attach the unload handler early enough to catch these.

Change-Id: I0ce721e24e69c31318064c6b443c1bfe01077546
2015-03-03 15:25:57 +00:00
jenkins-bot 4b840ab725 Merge "Promote the Language tool Beta Feature to always-on status" 2015-03-02 23:58:27 +00:00
jenkins-bot 91d0c4ff03 Merge "mw.ViewPageTarget: Use CSS for toolbar transition" 2015-03-02 11:39:13 +00:00
jenkins-bot 78a014ce9f Merge "Show the toolbar as soon as the target has been activated" 2015-03-02 11:32:48 +00:00
James D. Forrester bddd84b1e9 Promote the Language tool Beta Feature to always-on status
No complaints in over nine months. Time to just make this available.

Change-Id: I601699573c0d50384720e5a1f0098c7f780de8cf
2015-03-01 17:15:48 -08:00
jenkins-bot 6c5cb61139 Merge "ImageInfoCache: Don't try to access imageinfo result if it's not set" 2015-02-28 01:40:52 +00:00
Alex Monk 944e7d7a86 ImageInfoCache: Don't try to access imageinfo result if it's not set
Bug: T90916
Change-Id: Iebd393b0cff8016cc8917b86ca277eddf7810d4e
2015-02-28 01:25:12 +00:00
Roan Kattouw 2b67617179 Make generateCitationFeatures() idempotent
Add checks so it doesn't generate and register the same
tool twice. This makes it safe to run it multiple times.

Change-Id: I882b51bd0422222f2e80555910c69b059136a503
2015-02-27 16:18:15 -08:00
Trevor Parscal 34da7d56b8 Update VE core submodule to master (2e1a0bb)
New changes:
04a5947 Localisation updates from https://translatewiki.net.
dd4691b Update OOjs to v1.1.5
2e1a0bb Context refactor

Local changes:
Add context item support for references, citations, templates and links

Change-Id: I5d488ecbf9768dc63de6e545505dbfd5eb84cc61
2015-02-27 18:21:13 -05:00
Alex Monk a6dbdb4788 Follow-up I18162f04: Send uselang parameter with paction=parse request
Change-Id: I70c2e6c448c175ebe9d46c2003499e22a79b28b1
2015-02-26 01:45:48 +00:00
Alex Monk ac2242af5f Follow-up I18162f04: Set contentType: 'multipart/form-data' on some requests again
But not all

Change-Id: If9d88bb8d6c532992e8118e504f2fae45c0ca96a
2015-02-26 01:24:16 +00:00
Alex Monk 8e48f94580 Use mw.Api to run requests rather than our own stuff in ve.init.mw.Target
Bug: T58659
Bug: T89435
Change-Id: I18162f04c50f48606378aed62ee99fccdc3159f6
2015-02-25 01:57:22 +00:00
jenkins-bot 057b24ce13 Merge "Factor out the Parsoid API request into its own method" 2015-02-24 02:45:20 +00:00
Roan Kattouw 86e1d1214b Factor out the Parsoid API request into its own method
This will allow us to more easily split the API request
into two requests (one for the HTML, one for metadata)
by returning a $.when() promise, and to initiate these
requests earlier (by storing a promise and returning it
in this method).

Change-Id: I4a5d1b8c47a3dc2edfe89925e63dcf90d7038e45
2015-02-24 02:41:21 +00:00
Ed Sanders d73e9d6a84 Update VE core submodule to master (e6a37e2)
New changes:
822236c Simplify slug behaviour

Local changes:
Add Vector-specific rules for slug animation

Change-Id: I812f6f8afc8733aae245f3606302f032e5e54675
2015-02-23 17:18:40 -08:00
Timo Tijhof 1c5c13fd16 mw.ViewPageTarget: Use CSS for toolbar transition
The toolbar now uses a CSS transition for its height instead of
JavaScript animation through slideDown().

* The animation is on toolbar instead of toolbar-bar so that it
  contains the padding and borders. Otherwise it slides up until
  there is the top and left (quite thick) borders stacked on
  each other which then disappear at once.

* Add transform/translateY so that toolbar also transitions
  when it is in floating state.

* Move class addition to attachToolbar() to avoid additional
  reflow.

Bug: T89543
Change-Id: I30a7b69b77b874d220f60ebe7f7e616cd77bcc36
2015-02-23 19:25:58 +00:00
Ed Sanders 703b2c2ed0 Show the toolbar as soon as the target has been activated
Still to load at this point are
* Additional modules (first load only)
* Parsoid HTML

To account for this we disable the toolFactory event listeners
to prevent flickering, and create a hidden blank dummy surface to
attach the toolbar to.

Bug: T76523
Change-Id: Iab24858f23f4db944dcaa6683a82b950ea9ee1b1
2015-02-23 17:50:17 +00:00
Timo Tijhof 4c1de2edb2 mw.ViewPageTarget: Remove obsolete transitions for margin
These were there to match Vector, however as of 4cec8a70589
Vector no longer has these. Having these in VisualEditor causes
the toolbar to be a few pixels behind (like a slingshot) when the
rest of the skin has already moved.

Change-Id: Ia5886a58316ccb3b0420553c3f466b5256089c73
2015-02-23 17:16:46 +00:00
jenkins-bot f17414f9d5 Merge "Use prefixed page title for browser title bar" 2015-02-23 17:12:20 +00:00
Roan Kattouw f69eb9fef8 Use prefixed page title for browser title bar
We can't use wgTitle directly because it has spaces
but no namespace prefix (e.g. "Foo bar"), and we can't
use wgPageName directly because it has the namespace prefix
but underscores instead of spaces (e.g. "Project:Foo_bar"),
so run wgPageName through mw.Title.

Bug: T90433
Change-Id: If431f5b9f6efa2690cfd964f80d6ac71cb568087
2015-02-23 08:55:47 -08:00
jenkins-bot d9734f56ad Merge "mw.ViewPageTarget: Remove workaround for cascading defaultUserOptions" 2015-02-23 16:51:12 +00:00
Roan Kattouw c57b89616d Follow-up 14a4a4ae1: *actually* fix back compat for this.timeStamp
Introducing a variable doesn't help if you then don't use it :|

Change-Id: Ibf1c230dcb8b17941fcd6e0c82dd7a054a3287f0
2015-02-23 16:14:07 +00:00
Timo Tijhof 60e5ac0902 mw.ViewPageTarget: Remove JS animations from transformPage()
Follows-up 62c1d64ad0.

* Remove '.mw-indicators' animation for opacity. Was a left-over from other
  elements previously stripped in 62c1d64ad0.

* '#siteNotice' no longer slides. It's hidden at the same time as '#contentSub',
  '#toc', and other elements. This is an annoying jump, and we should find a
  way to do it consistently and in a performant manner.

* Fix state classes added in 62c1d64ad0. During deactivation, the ve-active
  class was kept for too long. This created a temporary state in which ve-active
  *and* ve-deactivating were applied. This was harmless as nothing ises the
  've-deactivating' class yet.

* Leaving toolbar as-is for another commit.

Bug: T89543
Change-Id: Ide49f93c45a12f2c13eb4412a9a16a82fefeb43e
2015-02-23 09:08:21 +00:00
Timo Tijhof f687ba7ce0 mw.ViewPageTarget.init: Add missing 'return target'
Follows-up I002322beaae. I had this in the local patch but got
lost in rebasing. The missing return statement caused an uncaught
error when clicking section edit links as it was not forwarding
the return value.

Change-Id: I66b6a789f7182a4446122e94f19cfdb324f8d675
2015-02-23 08:51:20 +00:00
jenkins-bot 07077da54e Merge "mw.ViewPageTarget.init: Reduce duplication around getTarget() calls" 2015-02-22 21:44:36 +00:00
Roan Kattouw 14a4a4ae1e Follow-up 9b582485: implement back compat for timeStamp correctly
timeStamp was used in two places, but we only had back-compat
code in one, so the other ended up using NaN.

Bonus: make jshint happy with the indentation of the $.extend() call.

Change-Id: I69000d11822658f2a227f9756093bc278f5fbaf5
2015-02-22 18:33:19 +00:00
Timo Tijhof a34ccc2f3b mw.ViewPageTarget.init: Reduce duplication around getTarget() calls
De-duplicate the logic of:
* Call showLoading()
* Call getTarget()
* Call activate()
* Bind always(hideLoading)

Also use then() instead of done() on getTarget() so that failures
propagate to the always() handler. Previously the interface would
indefinitely be in a loading state if target fails to load.

Change-Id: I002322beaae64c0de96457eb56dbc68a5fc16369
2015-02-22 15:30:25 +00:00
Ed Sanders db8a36820d Use new attachToolbar method for attaching the toolbar
Depends on I53f032e59 in core.

Change-Id: I85cb73a0ead6c73915b25f5be09c898cb5e1ecb4
2015-02-21 22:29:05 +00:00
Timo Tijhof 5fa98dc803 ve.init.mw.ViewPageTarget: Avoid content shift due to #contentSub
While #contentSub element tends to be empty, it does take up
line-height in most skins (incl. Vector). Previously, hiding this
would cause the content to be shiften upwards one line, only to
be shiften down one line again once activated.

While there are other edge cases to be straightened out, this
makes the content a lot more stationary during activation.

Change-Id: I784436c0f60a63e1a77aba5b8afeacbbdd6932be
2015-02-21 21:18:37 +00:00
Timo Tijhof a3efd1e4f5 ve.init.mw.ViewPageTarget: Update toolbox on activated instead of active
This hides the links at the same time as other parts, right when the
module is loaded, instead of after the surface is ready.

Change-Id: Ifda6985636f354060f43b7e9ecc9425b30c513c9
2015-02-21 15:08:35 +00:00
Alex Monk c6dbdc92ea Don't try to route any events into schema.Edit if it's not actually installed
E.g. no WikimediaEvents

Bug: T88667
Change-Id: I33a13abf22da0caa1282652fa1a078ffcae11e97
2015-02-21 02:41:33 +00:00
Ori Livneh 9b582485f9 Fix ve.init.mw.trackSubscriber.js
* Use the event's timeStamp rather than the current time in the event
  subscriber.
* Instead of using ve.trackSubscribeAll() and then branching on the topic
  prefix, just use ve.trackSubscribe( prefix, ... ) to bind prefix-specific
  handlers.
* Round timing measurements after performing arithmetic, and use Math#round
  rather than Math#floor.
* Rename 'getDefaultTiming' to 'computeDuration'.

Change-Id: I27ff1622ecea9b82d414f871441f127fc2dbd2cc
2015-02-20 14:00:26 -08:00
James D. Forrester a3d2516479 Blacklist Safari versions 6 and below; whitelist 7+
Change-Id: Ie21b15c0e591c0df0793fd58b550728150ed0999
2015-02-20 09:51:05 -08:00
Ori Livneh 429d55cda8 Update ve.init.mw.trackSubscriber to emit 'wgVersion'
Depends on I6cebac796: Update Edit schema to revision 11319708.

Change-Id: I31ce78a573ef0cdab1162c6b78142fd511b9e0ec
2015-02-19 11:20:53 -08:00
jenkins-bot 7c838d839c Merge "Don't log against undefined target constructor name" 2015-02-19 00:55:38 +00:00
Roan Kattouw 3611664663 Update VE core submodule to master (7d2a68e)
New changes:
0ceafd5 Fix V8 deopt for ve.ce.BranchNode#onSplice
01d2d4b [BREAKING CHANGE] Store originalDomElements instead of htmlAttributes
96005a7 Localisation updates from https://translatewiki.net.
42e672e ve.ui.Toolbar: Don't call #updateToolState from #initialize
373562d Localisation updates from https://translatewiki.net.

Local changes:
Update for htmlAttributes going away

Change-Id: I576a1e5d5883b03d1fff6666926f80a5682a280f
2015-02-18 15:35:46 -08:00
Roan Kattouw 71a26929e4 In setupSurface, build the model tree separately
Otherwise it gets built lazily when building the view tree,
and that makes it difficult to instrument it separately.

Change-Id: Ie8c2027e87a87e59323165f0edbba49c4a66d1b3
2015-02-18 21:12:36 +00:00
Roan Kattouw 70db70bc0e Add a bunch of trace.foo.{enter|exit} events logged through ve.track()
Tracked stages are:
* activate: wraps the entire activation
* domLoad: API request for Parsoid HTML
* parseResponse: parse HTML, interpret things like link cache data
* convertModelFromDom: create linear model from Parsoid DOM
* createSurface: build DM and CE trees, create DM, CE and UI surfaces
* initializeSurface: initialize UI and CE surfaces, and CE nodes
* setupToolbar: toolbar setup and attachment
* initializeToolbar: toolbar initialization (deferred so not wrapped by activate)

Bug: T89536
Change-Id: Ife5664e872bad68dcf3c123f274f9c8a38a06031
2015-02-18 21:11:25 +00:00
Roan Kattouw 237bb053d6 Remove the sanity check
It's slow, especially on large pages, and it's triggered
very infrequently these days, and only for known bugs.

In the future we should replace this with a debugging
interface that displays the DOM diff between the original
DOM and the round-tripped DOM, as opposed to the boolean
interface we have now.

By extension, this also means the visualeditor-needcheck
tag won't be applied to new edits any more, although
its registration and messages are kept around because
edits with this tag still exist in page histories.

Bug: T87161
Change-Id: I909153492a5786b4b69fccd42ce3c1d4bdb3a059
2015-02-17 17:14:34 -08:00
Roan Kattouw 70c64e0613 mw.Target: Hopefully fix plugin garbage removal code
Follows-up 0547d8c8.

It's still very difficult to test whether this code works, but
doing $( newDoc ).remove( 'selector1' ).remove( 'selector2' )...
demonstrably doesn't work, because 1) the selector passed to remove()
filters the collection, it doesn't descend into it, and 2) remove()
returns the collection of removed items, so chaining it doesn't work.

Instead, use $( newDoc ).find( 'selector1, selector2, ...' ).remove();

Also normalise selectors.

Change-Id: I97f3b28c4d5120f08e5d7fbf4598ddc0c01d4ecf
2015-02-17 23:52:41 +00:00
Alex Monk 77b59981fa Don't log against undefined target constructor name
This targetName property is expected by the trackSubscriber code for mwtiming.

Bug: T89735
Change-Id: Ie75054a4eb3387f0be0decfe5499af40eea8c6c0
2015-02-17 20:30:52 +00:00
Timo Tijhof 7f05f8877e mw.ViewPageTarget: Remove workaround for cascading defaultUserOptions
Originally added in 5036099906.

* Account for bug T89513 for 'tempdisable' (was done for 'enable' in 9cba9910c6).

* MediaWiki core now loads user defaults in a separate module not
  subject to page caching, making our workaround obsolete.

  Keeping defaultthumbsize as that is intentionally ignoring the user's
  preferences.

Change-Id: I07a7aa8e08c728ddeba67f36a98e989c220dcb50
2015-02-14 03:20:59 +00:00
Ed Sanders 2b48c4991e Fix DOM structure on setup/teardown
* Ensure that the toolbar remains inside the target so that
  target triggers still work
* To keep the page title beneath the toolbar, move it inside
  the target on setup, and restore it on teardown
* Have teardownToolBar/DebugBar return promises so we know
  when teardown is completely finished.

Change-Id: If2a9ce9a653aed51d21c8e8dd7795f2533d54f70
2015-02-10 16:59:43 -08:00
jenkins-bot b4e20aacec Merge "mw.ViewPageTarget: Use CSS instead of JS for DOM hiding/muting" 2015-02-05 22:37:56 +00:00
jenkins-bot 3351d84bf0 Merge "[BrowserTest] Restore the indentation list screenshot scenario" 2015-02-05 09:17:55 +00:00
Timo Tijhof 62c1d64ad0 mw.ViewPageTarget: Use CSS instead of JS for DOM hiding/muting
* Use .ve-activated for elements changed in activate()
  - hideReadOnlyContent()
  - mutePageContent()
  - mutePageTitle

* Use .ve-active for elements changed in onSurfaceReady()
  - hidePageContent()

* Set 've-activated' class from activate() instead of transformPage()
  to consolidate reflows and minimise DOM interaction. It's still
  in the same (synchronous) execution path, but a few statements
  earlier now.

* Remove obsolete #toc wrapper. This <div> (with data property
  to distinguish it from potentially foreign parents in the future)
  was there to aid slideDown/slideUp animations, because those
  don't work well on table elements. See eba7d58dd1.

* Remove obsolete setTimeout in restorePageTitle().
  The removal of .ve-init-mw-viewPageTarget-pageTitle was delayed
  by one second (introduced in Ibc3fa2fb7 / 4cc88b9850). This
  was to account for a jQuery animation we no longer use.

* Remove unused '.ve-init-mw-viewPageTarget-transform-muted'
* Remove unused '.ve-init-mw-viewPageTarget-transform'
* Remove unused '.ve-init-mw-viewPageTarget-pageTitle'

The resulting stylesheet exposes that we're not consistent in
whether elements hide immediately (ve-activated) or once the
surface is ready (ve-active). This is intentionally kept as-is
within this commit.

Of the different elements that had their opacity changed, only
firstHeading was being animated. This animation was removed.

Bug: T88590
Bug: T87160
Change-Id: I87033456f715d99a88425e38e8ac5171144f4ec8
2015-02-04 19:24:29 -08:00
Alex Monk dd52503b6a Unbind watch event handler in VPT when necessary
Caught by Timo in I1df2836f

Change-Id: I0f0af71cdca26f7e8d13f9ea50d22c833b6e1683
2015-02-05 01:16:11 +00:00
jenkins-bot b43e798bb4 Merge "Make API module's LinkCache data transmission format more efficient" 2015-02-04 01:18:21 +00:00
Roan Kattouw e367ecc948 Make API module's LinkCache data transmission format more efficient
We used to send data like { title: { missing: true|false } }
With this change, we send data like { missing: [titles], existing: true|[titles] }
where 'existing' is set to true (assume all non-missing titles exist)
for current revisions and to an array of existing titles for
old revisions.

This is because we always output this data for links in the current
revision, even when loading an old revision: in that case we rely
on the client to request the omitted information, so there we can't
assume that all pages we don't have information about exist.

Bug: T88259
Change-Id: I7b58b3f669cc78fd81b60859cf76928a9087066f
2015-02-03 11:30:40 -08:00
jenkins-bot 0e926f5fcd Merge "Wait with showing edit notices until after the welcome dialog is closed" 2015-02-03 18:44:02 +00:00
Timo Tijhof 1d00894497 mw.Target: Add mw-body-content class before we attach surface
If added afterwards, this causes child elements styles with
'em'-values to get redrawn (or even animated).

Bug: T88387
Change-Id: Ic1aba14b7cfe0ff6e7191f0b6052ed9cc4585fcd
2015-02-02 20:25:02 -08:00
James D. Forrester bed038b509 build: Bump devDependencies to latest
Updates:
* grunt-contrib-csslint  0.3.1  ->  0.4.0
* grunt-contrib-jslint   0.10.0 -> 0.11.0
* grunt-jscs             0.8.1  ->  1.2.0

For jscs, leaving requireSpacesInsideArrayBrackets to avoid headaches for now.

Change-Id: I62d34444edbba65c8bd22d2fa5e50e16cabb0042
2015-02-02 14:30:39 -08:00
jenkins-bot d5f7bac940 Merge "Combine imageinfo requests" 2015-02-02 19:32:00 +00:00
Bartosz Dziewoński c0d69dd3db Wait with showing edit notices until after the welcome dialog is closed
Its white overlay is pretty good at obscuring them, and the notices popup
would close when the dialog is closed, making it very easy to miss them.

Also fixed indentation.

Bug: T86987
Change-Id: I9f93c4169de98ef77a1eb33fd31a0ec524b6d2b7
2015-02-02 17:25:02 +00:00
Alex Monk 9841d1012c Update "Watch this page" option when necessary
On load and change the user presses the button

Bug: T78694
Change-Id: I1df2836f8ba4ae647bfb142513e5de9f32ecd0fe
2015-01-31 02:43:59 +00:00
Alex Monk 7876cc957a Combine imageinfo requests
By generalising LinkCache into ApiBatchQueue to request them all centrally

Bug: T75822
Change-Id: I097311ec2487bb1ae9f5d927c2c13c274ba716f9
2015-01-30 17:20:04 -08:00
Alex Monk f6bf40a19a Update permanent link and PDF download link oldids on save
Bug: T74461
Change-Id: Ic66de6e685d23cac1c9870529f42e1aa6348ac7a
2015-01-28 13:16:12 -08:00
Amir E. Aharoni 8da4c9b3cc [BrowserTest] Restore the indentation list screenshot scenario
* Add a class to the indentation toolbar button, similarly to what was done in
  Ib0cb67151d893a5d2efccf798d6b25d197ed34d2
* Fix the definition of the indentation pull-down element acordingly.
* Restore the Indentation menu screenshot scenario, which was disabled in
  I3e892baa9cb2c8c1303fab232a2b1c64ebdd8f26

Change-Id: If2d92aab6d04aa487d6f753fa7cac94f8d8215c8
2015-01-27 13:35:39 -08:00
jenkins-bot 7dee4f18d7 Merge "Don't rely on 'user' and 'site' modules working correctly" 2015-01-26 22:31:28 +00:00
Roan Kattouw 6623ff4197 Use DOM rather than jQuery for <base> resolution
Avoiding a Sizzle context switch, see https://github.com/jquery/sizzle/issues/311

Bug: T87416
Change-Id: I40dd2cb17f9c3d14d0ee1aa5b542263775feedb7
2015-01-26 10:00:32 -08:00
Alex Monk 34e4c6a51b Check for venotify on page load, not when VPT is created
Not sure what could have broken this or when. Or if it ever worked to be honest...

Bug: T58921
Change-Id: I069b5ccb4a78a6790e5791354402503676faa7fa
2015-01-22 23:50:02 +00:00
Bartosz Dziewoński 4cce592cce Don't rely on 'user' and 'site' modules working correctly
I think somebody somewhere pointed to this as the reason why VE
wouldn't load when user's common.js has syntax errors, but I actually
can't reproduce that. Not sure if this is needed, but looks like a
good idea anyway.

(Once more, with feeling. Reverted broken attempt: aa531488.)

Change-Id: I252c5c20f75b3bbea51200560408dc4cfc7174f6
2015-01-13 19:18:54 +00:00
jenkins-bot c878a3e7e9 Merge "build: Bump copyright notices to 2015" 2015-01-13 16:21:37 +00:00
James D. Forrester 2f8b3e0d96 build: Bump copyright notices to 2015
Change-Id: Ie92dab7411116d3410195c3fb0a3513c664c0c30
2015-01-12 20:34:19 -08:00