This is no longer needed, as VisualEditor now loads the content
from the /api/rest_v1/ entry point at the main project domain.
This reverts commit c741db5378.
Bug: T97500
Change-Id: I9b0dba58484884cdf3c7917c633b9815de4c9f92
We need it for the strip-if-empty logic in MWHeading,
and for consistency with desktop in general.
Bug: T96395
Change-Id: I9e70df896417811df087f58f3107919ba704f7c4
Easy-Deflate.js and its dependency, Base64, are not needed for editor
activation. Defer loading these modules until the editor has been activated.
Also promisify prepareCacheKey.
Task: T94616
Change-Id: I2e754fc835a5608b27d81117e1fbc9ea97d5744b
The activation timing was always a bit of a lie even pre-TargetLoader,
because the timer only started when the first RL request for VE
modules had loaded. But at least the process it covered was consistent,
which is no longer true with TargetLoader. Now that we start the
request for the HTML together with the RL request, the activation
time might include some, all or none of the HTML request depending
on how fast the RL request was.
This change makes the activation timings more useful by measuring
from the moment the user clicks "edit" to the moment the editor
is done loading, which is what actually matters.
* Moved start of activation timing to VPT init
** For mobile this falls back to when mw.Target#load is called;
we'll have to fix that in MobileFrontend later
* Moved end of activation timing out of TargetEvents#onSurfaceReady
into individual onSurfaceReady handlers
** This is necessary because VPT's onSurfaceReady does quite a lot,
and we want to include the time that takes in our measurements
Change-Id: Ie44f0b839b39a2b3b22dcd86e20f0d1170cb6069
/_preconnect is a special end-point that is handled by Varnish with an HTTP
204, sparing the RESTBase backend. See I95a716592.
Change-Id: I0c0430014768d7a1c6673d078569d0cf4062d338
Keep VisualEditor load times snappy by eagerly establishing a connection with
RESTBase via a beacon request, which is deferred until after window.onload /
setTimeout to ensure it does not slow down the loading of the page.
Task: T94784
Change-Id: I19fd2ef6beffe1c4c4f05c2716da079b49e88b95
If70ff601 didn't really fix anything. The only reason you'd want this data is
to distinguish between mobile and desktop data, but it just set the value to
the desktop version always...
Bug: T95432
Change-Id: I76722e3ad8b7dbe644374b24093bec696f27f48c
When deactivating, verify first that the welcome dialog was
initialized before calling 'close' on it.
Change-Id: Ife98b396f3d8641e2bd313c549fe867bcd84db9b
Split up beta and meta dialog show methods so that beta dialog
is displayed as soon as possible, regardless of the surface being
ready. Also make sure that we destroy the temporary window
manager on destroy.
Bug: T90454
Change-Id: Ib8f94518af431487ce940a74a8c268dbdbe403d2
Due to changes in the way VisualEditor is loaded, the trace.activate.{enter,exit}
events no longer enclose the entire VisualEditor initialization process. This
change ensures that trace.activate.enter is emitted as soon as the user clicks
on an edit link / tab and that the trace.activate.exit is not emitted until the
toolbar has been fully activated.
Change-Id: Ief798faa95a58898b9ae4dcbbbd30506c5dbd9a7
On short pages which don't extend below the fold, the progress
bar should center within the #content element.
Change-Id: I0b99e42f5bab8177d3b4ca6dd372d6403ae9b136
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
* 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