Commit graph

827 commits

Author SHA1 Message Date
James D. Forrester 302aeefd85 DesktopArticleTarget.init#getLastEditor: Check values for validity
Change-Id: I23e0884a97b3689dd42c3df11a6311cd0601c348
2016-03-07 11:27:23 -08:00
Alex Monk dde45949a3 Try to fix handling of empty document on WTE->VE switch
Bug: T128635
Change-Id: Iff83e1d71e7186b8da875aa507f9e19e8d9c23ce
2016-03-04 02:05:41 +00:00
Alex Monk 21334a0fa8 Keep summary and checkbox selections when swtiching WTE->VE
Bug: T128529
Change-Id: I8a7deac1c4d9390c1db7d78c3e0a11d927ef127b
2016-03-02 11:55:50 +00:00
Alex Monk d46c5e9f91 Fix WTE->VE switching in prefer-wt SET mode
Bug: T128402
Change-Id: I56af672f2334214f048a4bbfe2f9fab891832792
2016-02-29 23:46:11 +00:00
jenkins-bot e39d8a744b Merge "Show welcome dialog on mobile too" 2016-02-29 03:02:03 +00:00
James D. Forrester ab4d3e956b Update VE core submodule to master (0371bbe)
New changes:
0371bbe [BREAKING CHANGE] Refine VisualEditorSupportCheck call and document pattern

Local changes: Use new VisualEditorSupportCheck pattern

Change-Id: I7dc0c360b54a93397180b18d88d72532e439da5c
2016-02-26 12:26:56 -08:00
Alex Monk ced27f348f Show welcome dialog on mobile too
Bug: T112599
Change-Id: Ie04aab468c80dabc84e1386e7529138e1101450e
2016-02-25 22:03:00 +00:00
wctaiwan 5da37932a2 Warn for empty summary when edit section used
Warn the user about an empty edit summary when the "edit section"
link is used to trigger VE.

Re-does Ic7b456ca a different way.

Bug: T114857
Change-Id: I319c9c5bed47140a81eb409d490c9f82b89a49fe
2016-02-23 00:34:12 +00:00
Ed Sanders 15a47665c8 Meta dialog: Use window action to open windows
Because abstraction.

Change-Id: I9811db4380c6cf37a73a76b97c8439f94723c5a6
2016-02-19 17:37:42 +00:00
James D. Forrester cebaacb546 Update VE core submodule to master (cdfd84e)
New changes:
c02ea46 Clarify documentation of directionality methods
43c9b6f Move initialisation browser support checking from downstream
c89be66 Localisation updates from https://translatewiki.net.
5fb7907 Follow-up c89be66: Fix build for added language 'nan'
fc74fab dm.ElementLinearData.compareElements: Add a few missed test cases

Local changes:
Use initialisation browser support checking from upstream

Depends-On: I27a8e7b4376647f01cee648de987dc3ca6a060d5
Change-Id: I3fc79422ee5e487cf5fae3929fe492f21cd2840a
2016-02-17 20:04:16 -08:00
Alex Monk 83d8a7d9bb Don't remove .ve-activated after successfully activating
hideLoading always gets called after activating, not just failing

Follows-up: I13058ae1

Bug: T127184
Change-Id: I47d1892feacbfcf832aa32f689f173601b76c4ba
2016-02-17 15:36:18 +00:00
Alex Monk 9a1c0762cb Try to switch into the wikitext editor automatically if there is an error loading VE on action=edit
Bug: T125998
Change-Id: I2982f6e5f26086a1175b9fc8c3039a2143a44659
2016-02-13 02:56:01 +00:00
Alex Monk 1c1d018bc7 Unbreak VE
Follow-up to I13058ae1

Change-Id: Icb30f87746bea3911379fca9766877a36e8b5975
2016-02-13 00:58:42 +00:00
jenkins-bot bcae181cec Merge "Try to make MW->VE switching failures break less things" 2016-02-12 17:29:29 +00:00
Alex Monk 4a288a5866 Try to make MW->VE switching failures break less things
* Try to hide loading bar on failure
* Don't set wgAction back to 'view' if we're dropping the user back to the
  wikitext editor

Bug: T125580
Change-Id: I13058ae131a1dda3b172e78d9b143d70831c47f1
2016-02-11 02:39:06 +00:00
jenkins-bot 4a751524c4 Merge "Edit mode switch: Show popup next to VE switch button" 2016-02-10 01:51:57 +00:00
Ed Sanders 80124c88a6 Edit mode switch: Show popup next to VE switch button
Only show if the user came from VE.

Change-Id: Ic362ba534d135fca5516c8ba401f6b2a22886ff1
2016-02-10 01:36:32 +00:00
Alex Monk 863a2c2974 Don't try to tell the server to set preferences to their current values
It's rather pointless.

Change-Id: I8065af1d61108ce843c0afd2eaa0f1f9b85b6998
2016-02-10 01:04:47 +00:00
James D. Forrester e6e492efc6 build: Bump various devDeps to latest and make pass
* grunt-contrib-jshint: 0.11.3 -> 0.12.0
  This version of the linter cleans up a number of options. 'es5' is now assumed to be
  true by default, and replaced as 'esversion'; 'latedef' is extended to also cover
  functions' defintions, disabled for us for now; 'futurehostile' is introduced to aid
  future-incompatible names for ES6+ support.

  I adjusted ve.init.mw.DesktopArticleTarget.init.js based on this, as this file is
  meant to be loaded by all JS-capable clients to determine if it is (amongst other
  things) capable of ES5, so now we assert ES3 compatibility via jshint.

* grunt-jscs: 2.5.0 -> 2.7.0
  Minor version bump that doesn't affect us.

* grunt-jsonlint: 1.0.6 -> 1.0.7
  Trivial version bump that doesn't affect us.

Change-Id: Ieb7b6748b0cecf275cfc284fc66617189372461f
2016-02-07 19:41:21 -08:00
Alex Monk 138fafbbb9 DesktopArticleTarget#editSource: Use actionFactory to create a window with the surface
So the normal logic is used to close other windows etc.

Bug: T125479
Change-Id: Iee9ef7484de745f3adced28cdbcc87a0c2b597f5
2016-02-06 02:02:39 +00:00
James D. Forrester 1e0486a679 Remove all Extension:Cite code, now moved there
Depends-on: I39936ed83d5a60471a0a75da753f498e80aef234
Depends-on: Ifd853bf9f901065798bd0063aeaa786a3761aa71
Depends-on: I32c93c5118eafe5f071252290c58d3de8dacc81a
Change-Id: Iba0f25b3ebe4e5e63377da57afb760d6980f9907
2016-02-05 21:36:56 +00:00
Alex Monk 8cc034b9af Run VE->WTE modification checks regardless of how the user got into VE
I think this fixes a bug similar to the one described in the bug below.

Bug: T124708
Change-Id: I61558227315bec36b71dac281b8da311a3d6bb1a
2016-01-30 03:06:46 +00:00
jenkins-bot f78dd8ad72 Merge "MWWelcomeDialog: Let the user switch editors" 2016-01-27 00:20:10 +00:00
James D. Forrester d8769edd01 MWWelcomeDialog: Let the user switch editors
Change-Id: If88942d866278f3012dae7972d464a3d2a6a4f82
2016-01-27 00:14:07 +00:00
jenkins-bot 75b0a8de63 Merge "Don't try to load VE over the top of the wikitext editor we just switched to" 2016-01-26 17:01:24 +00:00
Alex Monk 589437a772 Don't try to load VE over the top of the wikitext editor we just switched to
(if we discarded changes)

Bug: T124316
Change-Id: Ic5e6ee8f4b6e75c3ae877021bcb29733b881e6d2
2016-01-26 16:49:50 +00:00
Alex Monk d7183d7e64 Check user permissions for viewsource before loading VE on-load on action=edit/submit etc.
Clicking 'View source' should probably not cause VE to load

Bug: T124650
Change-Id: I236de38b0f90f1aaa5d04b57cb7759e5951baf2b
2016-01-26 16:47:26 +00:00
Alex Monk bfa15c44a5 Check user preferences before loading VE on-load on action=edit/submit etc.
Bug: T124743
Change-Id: I2e8a19014464a2b7fb76de08676e7cb808e06956
2016-01-26 02:48:27 +00:00
jenkins-bot d29524c8b3 Merge "When loading VE from action=edit/submit, replace the title shown" 2016-01-22 20:43:02 +00:00
Alex Monk 38180b5d4d When loading VE from action=edit/submit, replace the title shown
Bug: T117643
Change-Id: Ice21389d02ea10adc668c5b0a64ba2b0b9cf5744
2016-01-22 20:27:01 +00:00
jenkins-bot ee70cc5c44 Merge "Single Edit Tab: simplify logic; make 'prefer-wt' just disabled" 2016-01-18 21:28:26 +00:00
James D. Forrester aa08d34318 Single Edit Tab: simplify logic; make 'prefer-wt' just disabled
Change-Id: I090375933656f29636c355c4d2ce358dd7f7f074
2016-01-18 11:23:59 -08:00
James D. Forrester 68ea08cd5e Drop support for adding prefix/appendix labels to edit tabs/links
Depends-On: I264599a1c4f60b37a46d49c808cf271ba0a8f882
Change-Id: Icebc378f5c00aac57ad361f8ba85da93b8178650
2016-01-18 03:06:33 +00:00
James D. Forrester ada58df361 build: Bump file copyright notices for 2016
Change-Id: I3c618c196e504a80ca297a4132a17f1977a24fb7
2016-01-03 14:57:25 -08:00
James D. Forrester 4a781a3a16 EditingTabDialog: Shorten the copy to make snappier, drop 'Edit' tab name
Change-Id: Idd5f373d9fef364318efddcc98ea2de5e91860a8
2016-01-03 13:44:54 -08:00
Alex Monk 85bb085418 DesktopArticleTarget: Preserve oldid when switching from WTE into VE
Change-Id: I8682a2a2b90ae2e42f1a8e01e16d0f9f3d66a2d5
2016-01-03 10:59:21 -08:00
jenkins-bot 26e3c0ad1d Merge "Preserve oldid when switching from VE into WTE" 2016-01-03 06:35:58 +00:00
jenkins-bot 3231220774 Merge "SET: Don't try to do any client-side section link magic if we're not supposed to." 2015-12-23 23:18:57 +00:00
Alex Monk 76cb69ecec SET: Don't try to do any client-side section link magic if we're not supposed to.
Ugh.

Bug: T121599
Change-Id: I47a93d5dbedc5ae989a2973fb793ac99edfb139a
2015-12-23 22:10:20 +00:00
Ed Sanders 2afd7c903d DesktopArticleTarget: Improve teardown sequence
* Ensure activating classes are removed by rejecting activatedDeferred
  as soon as teardown starts.
* Try to teardown surfaces is surfaces exist, not just if the target is active.
* Remove noop teardownDebugBar. The debugbar lives inside the surface now.
* Ensure progress bar is always reset, even if target setup is aborted.

Bug: T99139
Change-Id: I16a071c0d4bc8bbc6af2e03e63ee0ffc18d55c75
2015-12-23 12:13:50 +00:00
Alex Monk c10236cc58 Preserve oldid when switching from VE into WTE
Bug: T120898
Change-Id: I51774fd7ca5be7373d8aec55cb420a874bc7d531
2015-12-18 00:47:03 +00:00
Alex Monk c99a5b627e DesktopArticleTarget: Change tab text on server side when possible
Usually. Unless you load VE, because then you might be loading on
`action=edit` in remember-last mode and therefore the tab text needs to
be updated from "Edit source" to "Edit". Or "Create source" to "Create".
Or the equivalent with 'local description' in the case of pages from
foreign file repos, etc.

Bug: T120970
Change-Id: I8f07be6c8e415b40ad134ee82d0bda1d63cc4f96
2015-12-15 10:49:45 -08:00
Alex Monk 76a12f2f9b Try to actually resolve visualeditor-editor preference setting when switching editors
Seems we need to make sure this returns before navigating to the target page.
This reverts commit 40807a0743.

Bug: T121122
Change-Id: I4edf03bc0d57b03897d9f1802eabd8f0dd9962b9
2015-12-15 17:35:22 +00:00
jenkins-bot b08c8bd682 Merge "Fix up "Simplify some SET logic"" 2015-12-15 02:56:45 +00:00
Alex Monk 39af893c75 Fix up "Simplify some SET logic"
By 'simplifying', I broke stuff.

This reverts commit b7227f96fe.

Change-Id: I46fdcf336f556680fa72df0893447b6850cc4b1d
2015-12-15 02:50:15 +00:00
jenkins-bot d3d851f394 Merge "Simplify some SET logic" 2015-12-14 21:17:15 +00:00
Alex Monk b7227f96fe Simplify some SET logic
Change-Id: Ie89260607f0253dd7d749af7426702985a0340f4
2015-12-14 21:11:15 +00:00
jenkins-bot 33cbf199f1 Merge "Revert "DesktopArticleTarget: Don't abort in SET mode if veswitched is set"" 2015-12-14 20:53:28 +00:00
Jforrester 40807a0743 Revert "DesktopArticleTarget: Don't abort in SET mode if veswitched is set"
This reverts commit 5b083a7272.

Change-Id: Ieac905b80ea219075b4de498d645f22c3e86c5ca
2015-12-14 20:46:08 +00:00
jenkins-bot d750417545 Merge "Take pageCanLoadVE into account when figuring out whether VE will load in-page or not" 2015-12-14 17:14:41 +00:00
jenkins-bot 04d8089db6 Merge "Fix setEditorPreference call" 2015-12-14 17:08:42 +00:00
Alex Monk 774034b553 Take pageCanLoadVE into account when figuring out whether VE will load in-page or not
Bug: T121342
Change-Id: I84ade6e2ab062597fbfd859a90a864c7607547da
2015-12-14 16:58:26 +00:00
Alex Monk a3148a1559 Fix setEditorPreference call
Added brokenly in I82e39752

Bug: T121343
Change-Id: Ie7b228e94458b17d6ec7c23be264144dec9563be
2015-12-14 16:49:28 +00:00
James D. Forrester 5b083a7272 DesktopArticleTarget: Don't abort in SET mode if veswitched is set
Bug: T121122
Change-Id: I6dca85361be0c1c1c0d39b12b167af813706ae0b
2015-12-11 18:15:25 -08:00
James D. Forrester 2368171fb7 DesktopArticleTarget: Consolidate editor preference setting code
Change-Id: I82e3975233eee0473b513d0931a2d6770fc0f86d
2015-12-11 17:12:28 -08:00
Alex Monk 0774bdf924 Try to clean up the WT->VE prompt opened -> closing -> closed data callbacks
To use
	.then( function ( opened ) { return opened; } )
	.then( function ( closing ) { return closing; } )
	.then( function ( data ) {
etc. instead of nesting them in .done functions

Change-Id: Ic8cee9639b90cb378ce0b7e58dc04eab0ff4cbc7
2015-12-11 23:43:13 +00:00
Alex Monk 155d0240a4 Remember switching into VE from WT when discarding changes
Bug: T120966
Change-Id: I9a7b87cb2561416b72f53afa5140e9d2a4330cfe
2015-12-11 23:35:59 +00:00
Alex Monk 9e5a01aa6b Check that we really want VE before loading it for section edits
Bug: T121189
Change-Id: I34371bf78d34e9d362e9cf5c64bdd108478969b9
2015-12-11 23:19:07 +00:00
jenkins-bot e24e2ed7cf Merge "[BREAKING CHANGE] Create ve.init.mw.Target base class" 2015-12-11 18:16:22 +00:00
Ed Sanders fbb05fb8ed Use upstreamed actionGroups functionality
Depends on I272175dff3 in ve core.

Change-Id: I94cef0f3d8c1b903780890934c2c4963cbe05989
2015-12-11 16:43:48 +00:00
Ed Sanders 21d5856000 [BREAKING CHANGE] Create ve.init.mw.Target base class
Move over logic which isn't specific to the article
implementation of VE (e.g. nothing related to loading/saving).

Refactors setupSurface to use an abstract tracking method (which
does nothing by default), and moves surface CSS classes to #createSurface.

Breaking change:
* Rename onSurfaceReady to surfaceReady. We shouldn't need to listen
  to our own events.
* Rename onReady to documentReady. onReady is not a listener.

Bug: T97166
Change-Id: I7242b1bb5501b7755a18a13d13e166c30cac9cdd
2015-12-11 16:41:47 +00:00
Alex Monk 98a456b189 Single edit tab: Fall back to the wikitext editor when certain parameters show up
We can't handle these yet. There's also 'preview' but I think we probably
qualify as supporting that.

Bug: T121126
Change-Id: I4602992a77f460b9bfcbad0eac1bdd79d67df04d
2015-12-10 23:13:25 +00:00
Ed Sanders 29f33a57d5 Rename mw.Target to mw.ArticleTarget
This makes way for a base mw.Target class which is
not specific to articles (e.g. Flow boards).

Bug: T97166
Change-Id: If72650bdf87aa9f195b004da0a4d815f1a8063a3
2015-12-10 16:26:20 +00:00
Alex Monk 128901866a Don't check editor preferences etc. if user wants veaction=edit
Bug: T120978
Change-Id: I39e28c80440260959b7f1c25b82a057c21de43be
2015-12-09 23:04:02 +00:00
jenkins-bot 212300af1f Merge "Avoid useless jQuery.click shortcut" 2015-12-09 22:18:12 +00:00
Ed Sanders e7ccc77000 Edit mode switching: Tell VE if the wikitext was modified
Currently we assume that any document state from WE is modified
but that is not necessarily the case.

Change-Id: I085825152528ae5a5e973e8b44f68cb07ee92416
2015-12-09 17:44:43 +00:00
Ed Sanders e9250d87fd Avoid useless jQuery.click shortcut
Why have one event API when you can have ten...

Change-Id: I645cbeb4e486aba9e734ba47d2e7c3958a694f19
2015-12-09 17:34:00 +00:00
jenkins-bot a9894809f6 Merge "DesktopArticleTarget: Handle section edit link clicks in single edit tab mode" 2015-12-09 17:16:12 +00:00
Alex Monk b877e16723 DesktopArticleTarget: Handle section edit link clicks in single edit tab mode
Bug: T58337
Change-Id: Ic4c19cdfc3cfcf33604d0c4e7780b45967cdf57d
2015-12-09 09:08:46 -08:00
Ed Sanders ae26eefb05 Fix typos
Add some common ones to typos.json

Change-Id: I3830be4949ab6a5fd998d6937ed83e9f18091c2b
2015-12-09 16:47:13 +00:00
Alex Monk 748db015b0 Single edit tab and section links
In addition to the couple of TODOs inline, we should do the following in
follow-up commits:
* Prevent FOUC due to changing things only on the client
* Make section link behaviour sensible

Bug: T58337
Change-Id: I65d966270491ffe017cb11a0daa915628fadf65c
2015-12-08 17:47:16 +00:00
jenkins-bot 5649256ceb Merge "Re-fix in-page loading" 2015-11-23 17:00:13 +00:00
jenkins-bot 4616696e0d Merge "Prevent switching from unedited section directly into VE" 2015-11-23 17:00:08 +00:00
Alex Monk a0462d69d4 Re-fix in-page loading
Probably broken by Ie808bcaa
Partially reverts Icad04dac, hopefully without any regressions

Change-Id: I4589bde7eac58b54027a6b9dbe6ecddf79780599
2015-11-20 01:57:24 +00:00
Alex Monk 67a51aee9b Prevent switching from unedited section directly into VE
Bug: T117713
Change-Id: Iee9ae2bbe4757cb07e9aa2bd5f41a46c0ebb391a
2015-11-20 00:10:38 +00:00
Ed Sanders 19034b0416 Edit mode switching: Auto-close jQuery.UI dialogs before switching
Bug: T118282
Change-Id: I7960e4f71dd8b710f2ec2430f2946679af07012b
2015-11-17 17:26:01 -08:00
Alex Monk 889358f24c Ensure we always catch the wikiEditor-toolbar-doneInitialSections event
Don't wait for module loading. Before, this was only actually working half the
time.

Change-Id: I7fb284a800927672642c59231a322982b613f16b
2015-11-17 02:23:25 +00:00
Ed Sanders cfe3d9b561 Edit mode switching: Only show WE toolbar button once module is loaded
No point showing the icon if we don't have the functionality to
make it do anything. Also this reduces the number of RL requests
made as we never fetch OOUI separately.

Change-Id: Iac9aa6f34c485223e73981b3377c7d0cfd31dae9
2015-11-10 10:43:33 -08:00
Alex Monk 6213c23db1 Fix updating of display title upon save
Bug: T117643
Change-Id: Ibd3d4f056a2d175e52b60b6e3a4c0ece04f26f50
2015-11-10 13:50:00 +00:00
Bartosz Dziewoński 7d69e86265 ve.init.mw.DesktopArticleTarget.init: Make switching to VE for new pages work
Work around RESTBase problem that causes errors if we try to switch to
VE when the wikitext is empty. This would prevent non-power-users from
opening VE entirely.

This only solves the issue for new empty pages, and not when the user
intentionally empties the edit box. In that case, though, they get a
dialog where they can choose to "keep" or "discard" changes, and
discarding lets you open the editor.

Bug: T118152
Change-Id: Ie808bcaa9826deacac392dd6cbc90a9446602b79
2015-11-09 18:55:21 +01:00
Alex Monk 1e4889bbc7 Unset 'action' query parameter from veEditUri, which should always point to VE
Bug: T117780
Change-Id: I1377145bbbe05611ee75ae27922cf7a2cc5895e7
2015-11-08 20:32:28 +00:00
Alex Monk 3e23d3b96d Only load switching module (depending on OOUI etc.) on edit pages
This wasn't as bad as T112401 (that was blocking render), but we
still shouldn't be loading the module on page views.

Bug: T118088
Change-Id: If86701ed7ff4e8d6defb1c682aa9a38c211be0fa
2015-11-07 19:08:29 +00:00
Alex Monk 6247a2f430 WikiEditor integration: Fix dependencies for switch button
Change-Id: Ic8fb607e8c467e89c0b9af0a9baab84e59b19ba8
2015-11-07 04:15:14 +00:00
Alex Monk 87931fb3f2 WikiEditor integration: Only add VE switch button if VE is available
Bug: T117968
Change-Id: Ibfe73b7170083bc9ee0a0322768999c8650da4e7
2015-11-06 18:23:44 +00:00
jenkins-bot 4dacc683f5 Merge "Target init: Add edit mode switch icons to VE and WE toolbars" 2015-11-04 14:14:49 +00:00
Ed Sanders b05d9fcb0e Target init: Add edit mode switch icons to VE and WE toolbars
VE already has a a switch icon in the options menu, so bring that
up to the main toolbar.

Append an OOUI button to the WikiEditor toolbar if present, and bind
to the same functon as the edit tab.

Bug: T49779
Change-Id: Ic1e83ea7b13c4fef68024bf05ffc244060666103
2015-11-04 14:07:41 +00:00
Alex Monk bc6fe7dc77 Set wgAction when messing with the action URL parameter
Also get rid of an unused variable.

Bug: T117596
Change-Id: I8479fa930397cff48c3a103f3a2c99e89190dc4a
2015-11-04 01:41:46 +00:00
Alex Monk eb63b57d32 Fix check for loading from modified action=edit
Bug: T117596
Change-Id: Icad04dac7dc94927cff9b93b175d4a6c4dddee5a
2015-11-03 16:19:26 -08:00
Alex Monk b550323b53 Use mw.loader.using instead of weird hacks to load OOjs UI on action=edit
Change-Id: If03dab6130aed7662b04000b809884a514bb2762
2015-11-03 23:55:17 +00:00
Alex Monk 07c6c17e5c Unbreak loading of VE in the read page
Change-Id: Ic3e4e65296fa63b3a7d5114366f2859f4ce3f21d
2015-11-03 18:16:47 +00:00
Alex Monk f71a5a5bca Dialog for switching between wikitext and visual editing
Change-Id: I7046ffbe318d046b4baee11f4148ab77fc2af7fd
2015-11-03 01:36:29 +00:00
Alex Monk 85b745666f Allow switching from wikitext to VE
Just by pressing the VE tab for now

Requires a relatively new version of restbase

Bug: T49779
Change-Id: I2a5294345f5e0f469c1dd1bdd29dbce211571a4e
2015-11-02 20:55:19 +00:00
jenkins-bot 81a89952ef Merge "Educational popups and highlights for links+citations" 2015-10-14 21:52:50 +00:00
Alex Monk 9d6fbc894e Educational popups and highlights for links+citations
Bug: T108620
Change-Id: I42b0e06f50aca5cb783d88f79a080461e745ceee
2015-10-06 14:33:57 +01:00
Alex Monk a46b7a819e Hack to stop logging edit events for non-desktop targets
Mobile target, for example, has events logged in the MobileFrontend extension instead
(which covers both the wikitext editor there and the VE integration)

Bug: T110272
Bug: T109525
Change-Id: I521f1825dc9c0a135db54cd005cda723908f14bc
2015-10-01 23:48:10 +00:00
jenkins-bot ce8107ec0b Merge "Autodisable preference" 2015-09-28 23:46:59 +00:00
Alex Monk 97e70ba3cc Autodisable preference
We want to flip the default of visualeditor-enable to true, but don't
necessarily want to turn it on for users who already have contributions but who
haven't already enabled it. Therefore we're considering adding such users to
this autodisable preference which they can self-remove (by explicitly enabling
VE) or we can target later, separate from betatempdisable users.

Bug: T112352
Change-Id: I1ce5e6c92055e30fdc82bc912a767e913b190ef6
2015-09-29 00:30:27 +01:00
jenkins-bot 2e4a70e082 Merge "Add scroll padding equal to the document height for iOS" 2015-09-26 16:39:26 +00:00
Ed Sanders 6769860adb Add scroll padding equal to the document height for iOS
Allows users to edit the end of the document in iOS without
the keyboard obscuring the content.

Change-Id: I72f1de97e61a0c0d8acac2e58b36b3ece58fca89
2015-09-26 17:06:37 +01:00
Alex Monk 3386f66770 Save dialog: Make review/resolve actions work in mobile
Depends on Ic92378b7

Bug: T111894
Change-Id: I5ca5f803642dd12db4e9fb213dc6478701661528
2015-09-26 00:08:31 +01:00
Ed Sanders 8c66e5df75 Load mwgallery on mobile as well
It's just as usable as the alien extension inspector which
is currently shown, and has better messages.

Change-Id: Ifbce9df4aff77cf76a8445158987be716ba45302
2015-09-19 18:14:52 +01:00
James D. Forrester e5e1810f02 MWWelcomeDialog: Alter to be welcoming, use a nice image
Drop beta-ness as users don't care and it confuses them. Leaving the preference
alone for now.

Bug: T99963
Bug: T112354
Change-Id: I0e039dec54d528fce24226e76b931b593dd13a9e
2015-09-14 18:29:07 -07:00
Alex Monk 23691dc861 If init fails once, don't completely break when the user retries
The loading progress would not be reset upon failure, causing issues
when you tried to start loading again.

Bug: T96437
Change-Id: I7ec4be82304c101fa1bd634f60bc6b0047e2d53d
2015-09-14 21:13:45 +01:00
jenkins-bot 3b82179c06 Merge "Initialize actions toolbars" 2015-09-07 19:35:17 +00:00
Roan Kattouw 36dc5147bb Initialize actions toolbars
Right now .initialize() doesn't do anything other than enable
the window resize handler for toggling the "narrow" styling,
but as a matter of principle we should call .initialize()
on toolbars after attaching them.

Change-Id: I419c943d1d20af2105b84b8f5fbccc7070af601b
2015-09-07 11:30:30 -07:00
James D. Forrester 486bc7e6e3 mw.trackSubscriber: Log platform as phone vs. desktop
Change-Id: I71c25f28098c72ed779117da9c243dc3a87e611d
2015-09-05 21:29:03 +00:00
Alex Monk 6d94d060ac Bump Schema:Edit to revision 13457736
* Remove page.length
* Add action.abort.type = switchnochange

Needs to be deployed at the same time as Ib99700ac

Bug: T111420
Change-Id: I7ee245157d4de6c220d7cdf54cd1dd69ff836f15
2015-09-04 00:51:05 +00:00
Timo Tijhof 4e3d3acf65 mw.DesktopArticleTarget.init: Don't make non-VE edit tab collapsible
Collapsible relates to the Vector menu behaviour where an item
is moved into the dropdown menu if the window is narrow.

This should only apply to the secondary tab when there are two tabs.

If there is only one tab (non-VE, e.g. in a non-VE namespace) then
this tab should not be collapsible.

Server-side code handled this correctly, but client-side was
adding the class unconditionally.

Change-Id: Iecd195e92f43fe9f11b3938a1a24caed7b331e5f
2015-08-25 05:50:24 +02:00
James D. Forrester 85f91f394e build: Enable jscs jsDoc rule 'requireNewlineAfterDescription' and make pass
Change-Id: I7c0fabc93834d19198caea8f5dd1834e9e473d0a
2015-08-19 11:21:01 -07:00
James D. Forrester 19df1d4c8a build: Enable jscs rule 'requireVarDeclFirst' and make pass
Change-Id: Ia2f765d12bde001c329c2ff4c080a36b71de9803
2015-08-19 11:05:01 -07:00
James D. Forrester f5c6f61163 build: Enable jscs rule 'requireSpacesInsideBrackets' and make pass
Change-Id: I846d36c15e1b1f810d2ef7fd422f8412790bcb0f
2015-08-19 10:33:02 -07:00
Ed Sanders c0d2546617 Add down indicator to advanced menu in mobile
It is a dropdown list so give it the down indicator we use elsewhere.

Change-Id: I8976f2bc5edd1e221ca155da02660703318480ac
2015-08-19 13:05:14 +01:00
Ed Sanders 87daf4773d Fix typos in function names
Change-Id: Id8a9bcd1b4409bc8132ac6007b75274074f5f477
2015-08-18 13:54:51 +01:00
jenkins-bot 14dde31998 Merge "Convert save checkboxes to OOUI widgets" 2015-08-17 17:53:16 +00:00
Ed Sanders 960ecf8103 Convert save checkboxes to OOUI widgets
Anything with type=checkbox is coverted, and its label is found,
either by for=id or by finding a wrapping label.

All other inputs are stored in $otherFields for form building.

Bug: T86617
Bug: T70572
Change-Id: I94376fef18d02d2058bb548c11ae17f3dec7268c
2015-08-17 18:37:06 +01:00
Ed Sanders 7114463cc5 MobileArticleTarget: Restructure the toolbar
* Rename the actions toolbar the 'pageToolbar', and place the save button in
  its actions section.
* Inject the title amongst the pageToolbar tools, so we can have tools either
  side of it.
* Don't use the hamburger icon, as this has a (different) expected behaviour
  in MF. Replace it with a back button, and move the edit switch action over
  to the right in an 'advanced' group.

The toolbar is back to being laid out like the source editing toolbar in MF.

Change-Id: I4e00a8cdf603968ee32872323c88e587c1e1a487
2015-08-15 14:33:10 -07:00
Alex Monk 45a2beeaff Don't reset edit summary every time we open the save dialog
We were setting the edit summary box to the contents of the 'summary' parameter
every time the save dialog opened, but actually we only want to pay attention
to that the first time the save dialog opens.

Bug: T108329
Change-Id: Ic7b456ca8d7dd7cef8bc27629e3655ce9b97e755
2015-08-11 20:39:31 +01:00
Ed Sanders 92fc30db48 Update VE core submodule to master (da9d929)
New changes:
2464397 Move toolbar floating code up to the target
11bdc21 Separate SA target into Mobile and Desktop
7ab3389 AlignableContextItem: Fix styling in mobile
758619f CONTRIBUTING.md: Update file paths and build instructions

Local changes to mw.Target to handle toolbar floating.

Change-Id: I0751817e3a6668b120134bfcb6c611b121a46501
2015-08-10 12:33:14 -07:00
Ed Sanders f9fbd52962 MobileArticleTarget: Add webkit touch scrolling to panels
Also use named classes for hiding toolbars, and move the
MobileFrontend overlay z-index hack out to that repo.

Depends on Ia46e6b4d7a in MobileFrontend.

Change-Id: I0e1f527446fd10fde5dd3107e6467fd2c8f621b2
2015-08-10 15:45:26 +00:00
Ed Sanders 37c651001e Switch to using surface model focus/blur events
Depends on Ibcda9a79 in core.

Change-Id: Ieb2f99d7d1d24c24a0f00cf7c33e23b8206bf753
2015-08-07 10:52:24 -07:00
Ed Sanders 0d8914c48d MobileArticleTarget: Use platform's iOS detection, not MobileFrontend's
Change-Id: Ic206d54aee712e6309e34a0414d28c27363dfbc3
2015-08-07 15:37:05 +00:00
Ed Sanders ac9f1a0919 MobileArticleTarget: Give toolbar split focused/unfocused modes
Split the toolbar into two modes depending on if the surface is focused:
* When unfocused, show a hamburger containing back and source switch
* When focused, show editing tools, and a check button to unfocus

For the editing toolbar, space the tools out using table-cell layout
and hide labels below 480px.

Depends on I06813e3ff in core (surface blur method).

Bug: T93325
Change-Id: Ibf09cb29019d7a71e1e144b326710b1f6506cd0c
2015-08-06 15:43:36 -07:00
jenkins-bot 0c49c03c10 Merge "[BREAKING CHANGE] Use save dialog in mobile" 2015-08-06 21:57:56 +00:00
Ed Sanders 707628cfb1 [BREAKING CHANGE] Use save dialog in mobile
Bug: T96186
Change-Id: I4319e23da2d1bfd0cbba9719dbc9642a233bdf67
2015-08-06 21:52:14 +00:00
jenkins-bot c61661c20a Merge "DesktopArticleTarget.init: Don't overwrite mw.libs.ve" 2015-08-05 21:58:07 +00:00
Roan Kattouw ef2d23c36a DesktopArticleTarget.init: Don't overwrite mw.libs.ve
Extend it instead, if it already exists.

Bug: T107979
Change-Id: I70bce7c82dce8199cfe36f810629c5d22b583f0a
2015-08-05 14:48:38 -07:00
Frédéric Bolduc 0ce3baf66d mw.Target: Add jsconfigvars and modules to the save mechanism
* On save, VE will now fetch and append modules and jsconfigvars to the save
  event, which respectively contains necessary JS config module data and the
  list of required modules to be added on the page.
* The jsconfigvars are now properly added to mw.config on edit save.
* If any new modules are now required by the page after an edit, they will be
  loaded by ResourceLoader through mw.loader.load.

Change-Id: Ib3990078a22ad9e46debf3ce174e7cf27b86d944
2015-08-04 19:00:09 -07:00
Ed Sanders 2c24efae29 [BREAKING CHANGE] Target*: Replace target events with methods
When you bind to your own events you're probably using the wrong
design pattern.

The events are kept (without arguments) for the purpose of tracking.

Change-Id: I6983319f9e0ca179e609afb00c821e3eab2161c9
2015-08-04 11:49:54 -07:00
Ed Sanders 529248f831 Target*: Remove 'on' from methods which aren't event handlers
Allows us to rename onSaveEvent back to onSave.

Before this change,
* ve.init.mw.Target.prototype.save ->
* ve.init.mw.Target.prototype.onSave, emit save event ->
* ve.init.mw.DesktopArticleTarget.prototype.onSaveEvent (or MF equivalent)

With this change,
* ve.init.mw.Target.prototype.save ->
* ve.init.mw.Target.prototype.saveSuccess, emit save event ->
* ve.init.mw.DesktopArticleTarget.prototype.onSave (or MF equivalent)

Change-Id: I016262b38a941c93c0978391491baa6d5a32fe28
2015-08-04 17:47:05 +00:00
James D. Forrester 86212df814 Follow-up fd2ef3e: Keep passing data.isRedirect in #onSave
Also fix ve.init.mw.DesktopArticleTarget#onSave to #onSaveEvent to avoid clash.

Change-Id: I5efb1884f9626e5da72b226cc8ca596bb6db4a40
2015-08-03 18:41:58 -07:00
Ed Sanders 92cc1d1b53 Use super constructors in ArticleTargets
Change-Id: I58041de7421232dabe4541d438dd7cc66e3c8d92
2015-08-03 00:35:01 +00:00
jenkins-bot a15c54f4db Merge "MWSaveDialog: Make a FragmentDialog now that's available" 2015-08-01 22:44:18 +00:00
jenkins-bot b46bd69c49 Merge "Move toolbarSaveButton init to base class" 2015-08-01 22:43:25 +00:00
Ed Sanders dc71b4849b MWSaveDialog: Make a FragmentDialog now that's available
* Make save a FragmentDialog and open with WindowActions so
  the selection is restored automatically.
* Pass in some information in setup data.

Change-Id: I254b71f252adce064b9c2d2bf2cb6c8d0018e31f
2015-08-01 22:41:17 +00:00
Ed Sanders fd2ef3e4cd MW target: Make 'static' methods either static or be instance methods
MW target has 'static' methods, some of which aren't attached
to the static property, the rest of which should be instance methods.

Rename success/fail functions to remove 'on' as that is reserved for
actual event listeners.

Change-Id: I63e68dbe1923906208b180abfc4a9a280b4d098e
2015-08-01 22:38:49 +00:00
Ed Sanders e9b7f4c029 Move toolbarSaveButton init to base class
Change-Id: I145c4029f9e1a6e46591134a7756dada1251551b
2015-07-31 12:03:14 +01:00
Ed Sanders d2c15e9eb5 Bring in code from MobileFrontend
* Use local edit source tool, and emit event to MF
* Bring in toolbar styles, bonus: remove old desktop style hacks

Bug: T96186
Change-Id: I89351e409aa4e9d626edd7151ae05bdcd58f1cee
2015-07-30 17:13:00 +00:00
Ed Sanders cf191f5fa8 Update VE core submodule to master (8feab4e)
New changes:
11953f7 Localisation updates from https://translatewiki.net.
0dbafb0 Update OOjs UI to v0.12.2
cbd0982 Replace placeholder color with opacity
087365c Support other types of 'empty' document placeholders
7692890 Make scrollIntoView a VE utility function
5a1a159 Localisation updates from https://translatewiki.net.
8edf71e [BREAKING CHANGE] Kill ve.indexOf and thus @until
bb02b02 build: Bump various devDependencies to latest
cb5b2cd Fix scrollIntoView util binding
8feab4e [BREAKING CHANGE] Use config object for Target constructors

Local changes:
* Use config object for Target constructors

Bonus:
* Add CSS classes to MW targets
* Use 'super' calls

Change-Id: Ieb4e4eb3663aab2706c0f3ecc8b82e00555df1d5
2015-07-30 08:28:48 -07:00
Ed Sanders 08a9551c84 MobileArticleTarget: Collapse text style buttons
B/I doesn't fit with link & cite on a iPhone 6

Change-Id: Ib23b2f8540425ee5d8265f369aea250e900a0c5f
2015-07-30 00:25:52 +00:00
Ed Sanders 3593184f42 [BREAKING CHANGE] Bring in some code from MobileFrontend
* Bring in back button & save button from MobileFrontend
  so they are properly styled OOUI widgets
* Accordingly, move toolbar save button code up into base
  MW target.

Bug: T96186
Change-Id: Ic89dd4efb831fc3b09980da16524276f6568619d
2015-07-29 16:16:39 -07:00
Ed Sanders bb57348a9e DesktopArticleTarget#activate: Rename pageTarget to target
Change-Id: Iae71a050058afb2c1111a99ede5b969afbf5aca6
2015-07-29 17:58:33 +00:00
Ed Sanders fecdc29a38 Replace ve-init-mw-desktopArticleTarget-* with ve-init-mw-target-*
Except in cases where it is only applied to desktop articles.

Change-Id: I40a9dabcd8454138f94affde809afee9c93732a4
2015-07-29 18:26:36 +01:00
Ed Sanders b5de6fa575 [BREAKING CHANGE] Rename (View|Mobile)PageTarget to (Desktop|Mobile)ArticleTarget
Change-Id: I6a8fa76dc4d70cc04722e30e3fea6a6112d56b40
2015-07-29 18:26:36 +01:00
Alex Monk f76b57f1e6 Close the wikitext switch confirmation dialog if serialisation errors
Bug: T103632
Change-Id: Id9aede04ff4f8919770e578fac24ad4a1178b9a6
2015-07-25 14:32:17 +01:00
Alex Monk 82fb5f609a Parse SpamBlacklist error on the server-side
The client won't be able to deal with templates etc.

Bug: T99830
Change-Id: I78611a3f061b1afd73de052aa9ddff48dc368f2d
2015-07-23 18:49:42 +00:00
James D. Forrester 57f8fc5368 build: Drop last jscs over-ride and make pass
Change-Id: I4ff60af79cfc6e09e284d51f9b7ac2afa900f0f5
2015-07-22 15:13:09 -07:00
Ed Sanders 8e0394da5c Support command whitelist feature
Depends on I87d8aa3 in core.

Bug: T106061
Change-Id: I694e4e5a83f281da92380a895b72611141838f42
2015-07-18 18:20:49 -05:00
Kunal Mehta 0653804151 Don't set browser-prefixed transition CSS classes
jQuery will take care of this automatically: <https://api.jquery.com/css/#css2>.

Follows up bf56f56f3e.

Change-Id: I4db46fc70a5446a9ffc9f6d4375fae3b53609ee0
2015-07-17 16:31:56 -05:00
jenkins-bot c39bd98597 Merge "Revert "Make toolbar save button frameless"" 2015-07-08 15:38:55 +00:00
Bartosz Dziewoński 652da4afab Revert "Make toolbar save button frameless"
This reverts commit cb11cbd2f5.

Actually not needed after 3d36cac7fc4808f708f03b66f5c099de440e4569
in OOjs UI, and would change the UI in unexpected way.

Bug: T103403
Change-Id: Ia30b168ea29d03aa76ad81d1f9894a67604fdc08
2015-07-07 14:21:04 +00:00
Alex Monk c912f4e6dc Save dialog: Show reload link next to FancyCaptchas
Bug: T103227
Change-Id: Ib0548aa8ce3e2322dedc9980323e6e1f1cd705a0
2015-07-02 20:12:34 +01:00
Ed Sanders cb11cbd2f5 Make toolbar save button frameless
Depends on I26b540dd2 in oojs-ui for styling.

Bug: T101165
Change-Id: I075b8cecf9df2026fb1da17e2ebdf0d848a3d250
2015-07-01 12:12:50 +01:00
Timo Tijhof e1ce49509c mw.ViewPageTarget: Ensure canonial view url is restored
When loading VE by clicking Edit on a view url, this naturally
works (we temporarily append our query, and remove it when ready).

When loading VE from a permalink (e.g. Open in new tab) or any
other source linked from HTML pages, then we're not in control
over adding the query (it's already there); we're only in control
over restoring the view url afterwards.

Bug: T102363
Change-Id: I4912ff1c6b28ac987517760ffed481a4cd3bd1ca
2015-06-15 13:28:35 +01:00
jenkins-bot da3a5dbfc4 Merge "Improve progress bar" 2015-05-12 12:27:28 +00:00
Bartosz Dziewoński e459c14442 ve.init.mw.ViewPageTarget: Simplify toolbar save button and inner toolbar code
All this is no longer needed since 121216184718e7ebe22d6ecc8f5af5fe4e202465 in
OOjs UI and started causing issues after bb9c9c4f6a2fca6aed0e671e904e469d57da5f34.

Bug: T98795
Change-Id: I6493d6b52b313aac521aee2b0cff1571ea63bbe5
2015-05-12 13:50:40 +02:00
Ed Sanders bf56f56f3e Improve progress bar
* Add a 3rd stage will triggers on API load
* Allow stages to complete in different order (as happens
  on second load)
* Use CSS transitions
* Start slow and speed up using ease-in and progressively
  shorter transitions

Bug: T95137
Change-Id: Ib9090e6c80b7a186bf353c40921d40456d90211a
2015-05-11 13:26:32 +01:00
Roan Kattouw e644d33a8d Follow-up 5c38995bd9: don't destroy toolbar twice
The toolbar.destroy() call that was added in 5c38995bd9 was
needed to destroy the dummy toolbar when tearing down VE
before a surface had been intialized. But when tearing down
VE after the surface had been initialized (e.g. exiting using
the Read tab), we would do:

* setTimeout in tearDownToolbar()
** Set toolbar height to 0 and wait for transitionend
*** toolbar.destroy() once transition complete
* toolbar.destroy() in cancel()

This meant that we'd listen for a transitionend event
on an unattached element (because once the setTimeout runs,
the toolbar has already been destroyed by the second call),
which of course never fires, so we'd never resolve the
tearDownToolbar deferred and never finish tearing down VE.

Bug: T98388
Change-Id: I504f0cb0bf13643773fc98cb18b7b380cccb2f88
2015-05-06 16:18:45 -07:00
Ed Sanders 5c38995bd9 Fix page restoration when Parsoid load fails
Change-Id: I42cd7801af73c97d8fa07a4537c6e1c104e52ac4
2015-05-03 11:51:48 +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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
jenkins-bot 9249b4a70f Merge "ve.init.mw.ViewPageTarget: Recalculate toolbar sizes when adding "Save" button" 2015-03-10 21:48:06 +00: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
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
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
Timo Tijhof c1accbb61d mw.ViewPageTarget: Cache '#mw-imagepage-content' query
Follows-up eb7b727a53.

Change-Id: If8bed5626ccba9e69d30b770bb2eeed3c6264c7d
2015-03-10 02:53:05 +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
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 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
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
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
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
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
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