Commit graph

981 commits

Author SHA1 Message Date
Ed Sanders f95cebd8b1 Divide surface margins by 0.8
Change-Id: Ic9a0b3f4d8e82127649bb5ac100e3cbf42001489
2015-05-01 23:17:35 +01:00
Bartosz Dziewoński 335a702ac3 ve.init.mw.ViewPageTarget: Set custom font-size for original .mw-body-content too
Bug: T97690
Change-Id: I6ac49030cdb40798ae50fadf8179dd3a58e0e4b3
2015-04-30 21:25:49 +00:00
jenkins-bot 79b202de19 Merge "Fix toolbar & debug bar negative margins" 2015-04-30 21:18:03 +00:00
jenkins-bot f195a705c0 Merge "Remove unless, and almost-useless closures in response cache" 2015-04-30 17:30:50 +00:00
Ed Sanders ffd904022b Remove unless, and almost-useless closures in response cache
Change-Id: Ie02caefe3d8c43b6b1e6b523fb07042f5ae6db37
2015-04-30 17:26:05 +00:00
jenkins-bot 0824d064ec Merge "Make static methods static in linkCache" 2015-04-30 16:13:21 +00:00
Ed Sanders c32cccd90b Make static methods static in linkCache
Also switch out logic duplicated in MWLinkTargetInputWidget with
LinkCache#processpage.

Change-Id: Ie6f3599d4ea5cc9057cf4403f003da00f18cdebe
2015-04-30 17:00:45 +01:00
Ed Sanders 1a2a08cbf6 Fix toolbar & debug bar negative margins
Now 0.8em is set on the target wrapper, divide all these
margins by 0.8.

Change-Id: If373eac4d2abb9f58da816163b27e4110c39a213
2015-04-30 14:01:37 +01:00
jenkins-bot 6cb513b29c Merge "Update for changes in OOjs UI (Ib40e3477)" 2015-04-30 02:19:18 +00:00
jenkins-bot 3e2f7f0728 Merge "Show different icons for different result types" 2015-04-29 17:01:33 +00:00
James D. Forrester 65112a7e10 Show different icons for different result types
* Disambiguation
* Redirect
* Not found
* Page exists

Bug: T93694
Change-Id: Ic4a60c95e37de372e8d0c12878dece67a2662343
2015-04-29 17:51:34 +01:00
jenkins-bot 1feb544afc Merge "Revert "Pre-fetch RESTBase DNS and negotiate TLS"" 2015-04-29 16:26:00 +00:00
Ed Sanders df6a570f82 Only pull description from wikibase
Filters out 'alias' and other terms not being used yet.

Change-Id: I5d155c76b85de1e5d1d5fb234f565fd6f1658766
2015-04-29 11:17:24 +01:00
GWicke a44fbbf924 Revert "Pre-fetch RESTBase DNS and negotiate TLS"
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
2015-04-29 01:14:42 +00:00
jenkins-bot 76aa7c8ad6 Merge "Port ve.init.mw.Target to ve.fixBase()" 2015-04-28 20:21:12 +00:00
jenkins-bot d8c0f9e8b3 Merge "Link inspector images and descriptions" 2015-04-27 23:51:38 +00:00
suchetag 3963b1daf2 Link inspector images and descriptions
Fetches images from PageImages extension and descriptions
from Wikibase.

Bug: T93693
Bug: T93694 (partial)
Change-Id: I1bea6b7b57ab951e79468cfa00e9eecddc113d18
2015-04-28 00:23:40 +01:00
Roan Kattouw a332ea210a Port ve.init.mw.Target to ve.fixBase()
The old code in ve.init.mw.Target.static.fixBase was mostly
moved to ve.fixBase(), and the new ve.init.mw.Target.static.fixBase
contains MW-specific logic on top of that. This allows us to get
rid of the base fixing logic in onLoad().

Depends on I607fa579733 in VE core.

Change-Id: I42dfd4b90e86eb67d0111fffafc18e1152249610
2015-04-24 14:41:22 -07:00
jenkins-bot b16a24e04f Merge "Don't give up immediately for revid mismatches on second load" 2015-04-23 20:57:12 +00:00
Roan Kattouw 7a29cf3dbf Don't give up immediately for revid mismatches on second load
If a load failed due to a revid mismatch, and a new attempt then
succeeded, we would keep remembering that it initially failed.
Then when we loaded the editor a second time, encountering
a revid mismatch would cause us to give up immediately.

To fix this, forget about any previous failures once
a load succeeds.

Bug: T97069
Change-Id: Ie10a7532759095cbb5fb8d23af602aa7b9611a06
2015-04-23 13:48:00 -07:00
Bartosz Dziewoński 89b79bb373 Update for changes in OOjs UI (Ib40e3477)
Depends on I175fe468 in VisualEditor core.

Bug: T91152
Change-Id: I08c80cec84242eabd3da5bd3c829022df3e21636
2015-04-23 13:52:12 +02:00
Bartosz Dziewoński 2e96c8c1f3 Allow special characters with tooltip or that encapsulate text
Depends on Idd5e163090c9cf1c103d8b40e8ba19d332671cde and
Ifba178d8099b797a0ca33ca990540c8cb9cd3637 in VE core.

Bug: T65227
Bug: T70425
Bug: T95819
Change-Id: I6f08e3c1c3e4134520dac1e2d32d828cdefea23f
2015-04-22 17:46:00 -07:00
jenkins-bot 3b592bf4bc Merge "Strip language annotations on external import" 2015-04-22 00:33:17 +00:00
Ed Sanders e229e73fc6 Strip language annotations on external import
These are likely to have been generated by a parent language setting,
rather than an a specific inline annotation.

This won't affect ve-to-ve copy paste.

Bug: T95708
Change-Id: Ic8fe417ab6ffa74e85ab170f413b13b83589293d
2015-04-21 16:55:01 +00:00
Ed Sanders b78c725dbf Manually set starting progress to 0 incase stylsheets are slow to apply
Bug: T93964
Change-Id: I7d2bc7ca9f9d7db62a4524446a8e0ba8a3012c2a
2015-04-21 11:32:29 +01:00
jenkins-bot 5cf9798adb Merge "Update VE core submodule to master (952a9bb)" 2015-04-20 00:09:37 +00:00
jenkins-bot f8574e8073 Merge "Fix debug bar margins in monobook" 2015-04-19 23:59:05 +00:00
jenkins-bot 70e50ca38f Merge "Fix debug bar selector in vector stylesheet" 2015-04-19 23:59:03 +00:00
Ed Sanders c9061384d2 Update VE core submodule to master (952a9bb)
New changes:
72b9ed6 [BREAKING CHANGE] Simplify getModelFromDom signature
5a6505c ve.ui.SpecialCharacterDialog: Specify 'transition' only for 'border-color', not 'all'
30a2107 ve.ui.SpecialCharacterPage: Use less jQuery for better performance
e5692fd Localisation updates from https://translatewiki.net.
1ff0a0c Only auto-close windows which are not the one we are trying to open
48964b5 Localisation updates from https://translatewiki.net.
1f928ae Fix rendering of search results when scrolling
046dc5e demo: Add device switcher between desktop and mobile

Local changes:
*  Use simplified getModelFromDom API from 72b9ed6 in core.

Change-Id: Ib220c4e5c3fc520e10b950c02475783cd710d0df
2015-04-19 16:58:31 -07:00
James D. Forrester 0fdfab6c71 Blacklist <script> tags from BitDefender 2015
Bug: T96533
Change-Id: Ic6d030d46543ce01bffdd839f72d84c9fd537835
2015-04-19 15:02:26 -07:00
Ed Sanders 077b09efa2 Fix debug bar margins in monobook
Change-Id: I1654db5d2408471cb420f3422e70dc28d239cdfd
2015-04-19 19:50:08 +01:00
Ed Sanders 94e3386b51 Fix debug bar selector in vector stylesheet
Change-Id: I322cedf4902418b8821f72e34db03abd59016d76
2015-04-19 19:50:08 +01:00
Ed Sanders 4328045501 Update VE core submodule to master (5b0e269)
New changes:
de79de2 [BREAKING CHANGE] Fix font sizes and padding in Surface and SurfaceWidget
aa4a481 Localisation updates from https://translatewiki.net.
c2ff1cb Initialize toolbar tools disabled until surface is initialized
f457c83 Split visualEditor.css into apex & mediawiki versions
aff993c Don't drop <html> attributes when parsing HTML on Opera 12

Local changes:
Fix SurfaceWidget and DebugBar hacks

Change-Id: I93cb8ec787e53c07b5051c0296eb6f59b6048e91
2015-04-17 15:18:08 -07:00
Roan Kattouw c8ac904fa6 Also load mwformatting in mobile
We need it for the strip-if-empty logic in MWHeading,
and for consistency with desktop in general.

Bug: T96395
Change-Id: I9e70df896417811df087f58f3107919ba704f7c4
2015-04-17 10:55:25 -07:00
James D. Forrester 85381a6b75 Update VE core submodule to master (2714bfc)
New changes:
8dc8b26 Trim leading and trailing whitespace from annotations
306feb4 Add get(Col|Row)Count to TableSelection and use in isFull*
1c06d21 Cursor holders for native cursoring to ce=false nodes
b08384d Provide file extension fallback for FileTransferHandlers
28844ed [BREAKING CHANGE] Move all icons to OOjs UI's icon packs
9d37355 demo: Set 'lang' attribute of target
8945420 Follow-up 8dc8b266: account for annotations that return []
c2bbc97 Localisation updates from https://translatewiki.net.

Local changes:
* Switch to using OOjs UI icons for VisualEditor core features
* Update test for whitespace trimming

Change-Id: I12b22a411600b6e8e61858e7ed600fb53eedd95d
2015-04-16 14:02:59 -07:00
jenkins-bot c4901404cc Merge "Don't self-instantiate platform" 2015-04-16 02:37:04 +00:00
Ed Sanders 1ae9178773 Don't self-instantiate platform
Depends on I961dade19 in core.

Change-Id: I39b99617a9362a57a721c8467a1b43bdb9d754dd
2015-04-15 18:46:34 -07:00
Ori Livneh 07001001be Defer loading easy-deflate
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
2015-04-15 18:43:28 +01:00
Roan Kattouw 86b82b537d Make activation timings sent to EventLogging not lie
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
2015-04-14 21:57:11 +00:00
jenkins-bot 54afadf9d1 Merge "Replace abstract functions that just throw with null" 2015-04-14 16:57:10 +00:00
jenkins-bot 8c29e52202 Merge "mw.ViewPageTarget: Use new simplified ve.ui.Surface#getDom" 2015-04-13 19:06:13 +00:00
Ed Sanders 502272a1bc mw.ViewPageTarget: Use new simplified ve.ui.Surface#getDom
Depends on I6355cf484b8 in core.

Change-Id: I3dcce40af346b1c5ab75c0da81aee8ae02937f44
2015-04-13 18:38:56 +00:00
Ed Sanders 91923e815b Remove useless ve.init.Platform overrides
The parent methods (ve.init.Platform) are now identical.

Change-Id: Idbf18d64b723ce2465e7c0c994c88b4b63c87445
2015-04-13 18:30:57 +00:00
Ori Livneh 30772ee3f5 Update RESTBase pre-connect URL to hit /_preconnect
/_preconnect is a special end-point that is handled by Varnish with an HTTP
204, sparing the RESTBase backend. See I95a716592.

Change-Id: I0c0430014768d7a1c6673d078569d0cf4062d338
2015-04-09 17:43:53 -07:00
James D. Forrester 916eba05a5 Replace abstract functions that just throw with null
Per Timo, this avoids us having pointless code that is never
executed, and the replacement notification to the user (that
ve.blah.UnicornAnnotation.foo is null and not a method) is
sufficiently clear that the issue lies in the lack of existence
of the ve.blah.UnicornAnnotation#foo method.

Only ones in this repo appear to be in ve.init.mw.ApiResponseCache.

Bug: T54482
Change-Id: If44b8d63b8e7b2a5c289fe7278ad54e722b185fa
2015-04-09 23:20:07 +00:00
Moriel Schottlender 7c0b307d8a Allow for citation tools to work under the reference dialog
Set up the surface widget as inside the reference dialog, and let
the citation action notify the template dialog the name of the
dialog it is in. If the tool was executed from within the reference
dialog, skip over creating a reference and instead insert the
citation as a template.

* Depends on ve-core fix I709eeb0de475 *

Bug: T94621
Change-Id: I4871f8c0afe190117cc90e88227b37f292a71e20
2015-04-09 12:18:54 -07:00
Ori Livneh c741db5378 Pre-fetch RESTBase DNS and negotiate TLS
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
2015-04-09 11:54:27 -07:00
jenkins-bot 65fe5399a3 Merge "Set targetName for apiLoad and restbaseLoad metrics to the correct values again" 2015-04-09 17:25:49 +00:00
Alex Monk 19dc7d31fe Set targetName for apiLoad and restbaseLoad metrics to the correct values again
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
2015-04-09 13:57:25 +01:00
Ed Sanders 4379275062 Update VE core submodule to master (7058807)
New changes:
4c1a5ea [BREAKING CHANGE] Give the converter a 'fromClipboard' mode
d855043 Add core tests for annotation merging
fae083e Localisation updates from https://translatewiki.net.
11710e9 Encode and decode HTML entities in comment nodes

Local changes:
* Update getModelFromDom signature

Change-Id: Ida1b9b33d5e25e7d467ef16dd2240442270b9d32
2015-04-07 18:13:06 -07:00
Alex Monk 23e734b93a Only try to load 'site' and 'user' modules on desktop
These simply won't work with MobileFrontend, per jdlrobson

Bug: T95044
Change-Id: I3b899f55b31d4ed40e65e8d1b2f65b75d9ec339f
2015-04-03 21:41:33 +01:00
Timo Tijhof 8475d40b77 mw.ViewPageTarget: Disable pointer events on dimmed elements
Reduces event overhead and prevents accidental interaction with
content while loading, and with content sub while editing.

Change-Id: Ief997cd4d5cf444fb2ee0d28c709301d26e814f9
2015-04-01 01:46:22 +00:00
Roan Kattouw 37bb76e13b Fake <base href> if missing or invalid
If the Parsoid document has an invalid base URI or none at all,
construct one based on wgArticlePath so link href resolution
still works properly. This is needed especially when creating
a new page, because the "Parsoid HTML" is an empty document
in that case.

Bug: T94315
Change-Id: I5d9709725ef471c7ce1987ce887708ac5ee4259a
2015-03-30 21:30:58 -07:00
jenkins-bot 026c015696 Merge "Correct font sizes of everything on MonoBook" 2015-03-30 21:25:33 +00:00
jenkins-bot 2a8c61b57f Merge "Support an "other" page for special characters" 2015-03-30 20:51:23 +00:00
jenkins-bot 2dbe12bc66 Merge "Handle a further 70 WikiEditor special characters" 2015-03-30 20:50:19 +00:00
Timo Tijhof eca25738df mw.Target: Defer parsing of edit notices to MWNoticesPopupTool
Also use an array instead of an object. The keys were already
meaningless (index numbers). A "wikimedia/*" Git search did not
show any usage outside MWNoticesPopupTool. However, the array is
backward-compatible with any code using it as an object for keys
or looping (just in case).

This should also make the order more reliable.

Bug: T87412
Change-Id: I683cc902bda5ba768e962af6725e657871b79b9a
2015-03-30 20:47:25 +01:00
Timo Tijhof 97d7da6643 mw.Target: Remove visible text filter for edit notices
This removes the hack for bug 43013, since T91715 has been fixed.

Bug: T87412
Change-Id: I7f477d0815a8b9a7ca2f4405e4c2d6e914868c56
2015-03-30 20:43:25 +01:00
jenkins-bot c9084affd9 Merge "Try not to die when RESTbase returns a 404" 2015-03-30 17:40:11 +00:00
Ed Sanders 8c0122a2d5 Update border width transition hack
Upstream was reduced from 4px to 2px so reflect that here.

Change-Id: Id8990d15b9fbd4207648c5c93492fb37e5fdab5e
2015-03-30 14:40:17 +01:00
Alex Monk c68b58eedf Try not to die when RESTbase returns a 404
Just assume content = '' like we did with Parsoid

Change-Id: I1b076f4e37a8c54733da0e4535adb7a50ae2a7e5
2015-03-30 08:44:31 +01:00
Alex Monk 5af4564097 Support an "other" page for special characters
Change-Id: I9a1404dff1a970fbbc7bdf822398dbb7057159bf
2015-03-30 03:02:10 +01:00
Alex Monk 14d5b4e930 Handle a further 70 WikiEditor special characters
VE core changes would be needed for the remaining 9. (To deal with 3 titles in
the UI, and 6 encapsulating the selected text with one character before and one
after).

Change-Id: Id7c0fa06b1c873ab286cffb7a83016a2d37ab744
2015-03-30 02:26:11 +01:00
jenkins-bot 4b2ee8f310 Merge "Load all of WikiEditor's special characters" 2015-03-28 03:00:06 +00:00
jenkins-bot 08afdfadbd Merge "Use parseInt(), not Number.parseInt()" 2015-03-27 23:23:22 +00:00
Roan Kattouw b858332667 Use parseInt(), not Number.parseInt()
For whatever reason, Number.parseInt doesn't exist in IE11.

Change-Id: I62366ee027283a8f70d3fff2e29c4f333ad5f697
2015-03-27 16:14:13 -07:00
Alex Monk e084df2df6 Load all of WikiEditor's special characters
Relies on If9c5cdbe and I8fafd734

Bug: T91608
Change-Id: I3fafc561ceae969e4ecc12881154cd8a3568bebb
2015-03-27 22:13:38 +00:00
jenkins-bot 4fbb11e40a Merge "Verify welcome dialog exists before trying to close it" 2015-03-27 18:48:39 +00:00
Moriel Schottlender db9e565a09 Verify welcome dialog exists before trying to close it
When deactivating, verify first that the welcome dialog was
initialized before calling 'close' on it.

Change-Id: Ife98b396f3d8641e2bd313c549fe867bcd84db9b
2015-03-27 11:45:26 -07:00
Bartosz Dziewoński 4bfc19349a Correct font sizes of everything on MonoBook
This is not pretty and probably isn't optimal, but it works well
enough. The bug about getting rid of this all is T91152.

Bug: T94071
Change-Id: If926286f1d0c7835489914ed653a0d65ed24f53a
2015-03-27 19:42:33 +01:00
ecotg 175e60edaf Strip X-Parsoid Performance Headers from Visual Editor
Stripped out X-Parsoid Performance Headers, previously used to gather and
forward Parsoid's performance information, from ApiVisualEditor.php,
ve.init.mw.Target.js and ve.init.mw.TargetLoader.js. Change I936ada7b1 strips
out the corresponding X-Parsoid Performance Headers from Parsoid. Parsoid's
current performance instrumentation is achieved using Graphite and txstatsd.

Change-Id: I57d6f866a7d8287a5115e6236b0fb25bc4d0eabd
2015-03-27 12:03:15 -06:00
Roan Kattouw 6bd5142f2a When content and metadata have different revids, explicitly retry the higher one
It's much less likely we'll get another conflict if we retry
with ?oldid=12345 than if we retry omitting the oldid again.

Change-Id: I10e40f714fd44d7f0ac16c9d0dc6239a95c0ec51
2015-03-26 16:07:43 -07:00
Roan Kattouw b19104ed04 Send requests to RESTbase directly when so configured
Also introduces paction=metadata in ApiVisualEditor which
doesn't hit Parsoid but gets all the other information we need.

Bug: T90374
Change-Id: I71edbc0f8dc15a6f8d3672c10ca3c641cc172be7
2015-03-26 16:00:54 -07:00
jenkins-bot 25aedfd0fb Merge "Show beta welcome dialog before surface is ready" 2015-03-26 19:40:54 +00:00
Moriel Schottlender 74c3b758e2 Show beta welcome dialog before surface is ready
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
2015-03-26 12:36:40 -07:00
Alex Monk 024823e560 Fix revId check on new pages
Makes it possible to edit new pages again.

Follows up Ifbf44b7772

Change-Id: If170a367dc2f531d11f09569c7ab45ebd414dff6
2015-03-26 17:39:45 +00:00
Alex Monk 9019f02130 Check for the two revision IDs returned by the server being different
With RESTbase we'll be able to retry the older one, but right now we have to do
both with the same request.

This commit retries loading once, then starts emitting errors.

Bug: T92993
Change-Id: Ifbf44b777279dafbe31ab438838d70acd44de726
2015-03-25 20:46:27 +00:00
jenkins-bot 5f3e0b033b Merge "Emit activation entry/exit traces at the appropriate times" 2015-03-25 03:15:56 +00:00
Amir E. Aharoni 1d1ffac74e [BrowserTest] Capture the whole formatting button in the screenshot
This makes the screenshot nicer and more complete.

Change-Id: I0dd9efd2978ff5468ab6101b11b7e6fdd3b0da30
2015-03-24 12:34:42 +02:00
Ori Livneh 13292744b1 Emit activation entry/exit traces at the appropriate times
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
2015-03-23 23:19:12 +00:00
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
James D. Forrester 6ce2210222 Toolbar: Make save button progressive, not constructive
Bug: T86507
Change-Id: I082d1b4ba09abf74e4c6438ef8b93fcc7de7a41b
2015-01-12 17:50:45 -08:00
Jforrester c17e3f89c6 Revert "Don't rely on 'user' and 'site' modules working correctly"
This reverts commit aa53148852.

Bug: T86550
Change-Id: Id97dec739939312caaa10d36197f105a595c1365
2015-01-12 18:49:39 +00:00
Bartosz Dziewoński aa53148852 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.

Change-Id: I3abecacf083c1c9dfb2ea30207a9911eeea54b50
2015-01-11 19:01:56 +01:00
jenkins-bot d4aa0aef7f Merge "Add classes to toolbar UI elements" 2015-01-06 20:02:45 +00:00
Alex Monk 9600d28ebc Don't break "Edit source" link after VE has closed
Bug: T85552
Change-Id: I6db6fcff24110e749e3a0c1aa7c0528527b53d44
2014-12-30 21:07:04 +00:00
Amir E. Aharoni cd4bd7a73c Add classes to toolbar UI elements
This cleans up the selectors for the elements on the toolbar
so that they can be tested.

Class names in the form of ve-test-* are added to elements
that have words for labels: 'Paragraph', 'Cite', 'Insert'.
There is no other way to look up these elements in the DOM
except using the UI text, but it is different in different languages,
so this is unusable for the language_screenshots job,
which is multilingual by its nature.

Bug: T76143
Change-Id: Ib0cb67151d893a5d2efccf798d6b25d197ed34d2
2014-12-30 12:16:44 +00:00
Ed Sanders f49bbf783a Update setupToolbar signature in mobile target
This method now takes arguments to make sure they are passed.

Bug: T78710
Change-Id: Ifba696c2a1b60690bdccd1b58d347c254dec5432
2014-12-18 11:25:34 +00:00
Alex Monk c5d927552a Fix Ia6bf604c: Update another caller to ve.init.mw.Target
MobileViewTarget.

Due to this being missed, pageName was getting set to a jQuery object,
which eventually got passed as a data value in a $.ajax call, causing
jQuery to emit a TypeError: Illegal invocation.

I guess this needs a MobileFrontend commit as well. Don't think it fixes
all the issues with loading VE mobile though.

Bug: T78710
Change-Id: I431a902563f608a7a33028cd60112f39c57000a4
2014-12-18 00:59:04 +00:00
jenkins-bot f1103d2bf0 Merge "VE-MW fix commit for I4efbae614e" 2014-12-17 20:03:46 +00:00
Roan Kattouw 08bebc9b2b VE-MW fix commit for I4efbae614e
Local changes:
* Call bindHandlers()/unbindHandlers() in activate/deactivate
* Extend onDocumentKeyDown rather than overwriting it

Change-Id: I0739e71781c5140c54512ab421bdcb6d1df5fbbe
2014-12-16 15:42:27 -08:00
Timo Tijhof 2b7ae8c175 Remove use of bind() for inline functions
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
2014-12-16 23:27:53 +00:00
Alex Monk f9339d070b Edit/view source tab: Do not hijack middle click to display confirmation, only left click
Middle click is supposed to open the link in a new tab.

Bug: T78546
Change-Id: I594f1dff072d54c0a8d7112a1eaa0c1c84d0ffc1
2014-12-15 20:24:11 +00:00
jenkins-bot e6997350ba Merge "Check for stopped propagation before showing close dialog" 2014-12-13 00:52:57 +00:00
Ed Sanders 9459e4e240 Check for stopped propagation before showing close dialog
Various VE elements use escape to perform tasks. Particularly
difficult are OOUI dialogs which listen to the document and thus
fire after this target's listener, so defer and check if the
event was previously stopped.

Bug: T78201
Change-Id: Ie335f199766923833588202626c3af8e4cbcb9b5
2014-12-12 22:38:40 +00:00
jenkins-bot 87143d4c36 Merge "Mark primary buttons as progressive as well" 2014-12-11 22:59:04 +00:00
James D. Forrester 57a68d082b Mark primary buttons as progressive as well
Also make save button primary.

In anticipation of Iee91d2c6 in OOjs UI

Change-Id: I123044bfaba631866ad32a35643f23686a17a16f
2014-12-11 22:55:16 +00:00
Ed Sanders 45518019eb Update VE core submodule to master (9ac8136)
New changes:
9929b6d [BREAKING CHANGE] Make ve.init.target an OO.ui.Element

Local changes:
* Fix target constructors now they generate this.$element

Change-Id: Ia6bf604c67305834a3f73863a10336cfbb83fa77
2014-12-11 14:00:28 -08:00
Ed Sanders d6067d5718 Update VE core submodule to master (cf1e167)
New changes:
776e801 Delimit text nodes in debug observations
72643bc Remove debug bar hiding now it is handled by the surface
cf1e167 [BREAKING CHANGE] Multiple surface support and demo

Local changes:
Account for detachable toolbars in core being setup in a different order.

Change-Id: I29156948711d55ba5f6dd4f6c35ca0e4cca32373
2014-12-11 12:49:29 -08:00
jenkins-bot eacb364ed1 Merge "Add timing data for the first transaction" 2014-12-11 03:06:14 +00:00
Roan Kattouw 49b26f886e Add timing data for the first transaction
This doesn't quite tell us about the user's first interaction with
VE (if they open a dialog, for instance, it could be minutes before
that results in a transaction), but it's a good start.

Bug: T76524
Change-Id: I6bac987332802d7363ed65a471b2b1ece67086d8
2014-12-11 03:02:11 +00:00