Commit graph

588 commits

Author SHA1 Message Date
Alex Monk 237d68f6db Offer to retain changes when switching to the wikitext editor
Bug: 57462
Change-Id: I4e57f9dff4479531e7c715966bdad2cabb97ca8c
2014-06-27 22:31:07 +01:00
Timo Tijhof 19afd65a08 build: Update jscs and use new "wikimedia" preset
Our coding style has been upstreamed and first released
in node-jscs v1.5.0 (grunt-jscs-checker v0.6.0).

Change-Id: Ifc0cfc7177946b9d11407f60e38b0177883724c5
2014-06-26 17:00:15 +00:00
jenkins-bot 6c9a99756a Merge "Add missing TableCell CSS file and Vector-specific rule" 2014-06-25 18:14:07 +00:00
Ed Sanders e4e9405452 Don't try to change offset for vesection=0
Bug: 66674
Change-Id: I33db33af38b554c9bf3c13b14ce67bcac2e70573
2014-06-25 16:38:56 +01:00
Ed Sanders f2fe87f1b3 Add missing TableCell CSS file and Vector-specific rule
Bug: 65416
Change-Id: I202893322866cf42b8fbe950224b6be08c35c4d6
2014-06-25 15:08:30 +01:00
Ed Sanders 288da5b704 Compress HTML data with deflate before POSTing
Bug: 66914
Change-Id: I7b0a9cfd4d4c10986769a868884688ffca833cb6
2014-06-24 17:39:03 +01:00
Alex Monk dc6840c3a0 Update displaytitle on save (try #3)
Parse the wikitext we already have.

This is mostly a revert of commit f84b880a54.

Bug: 50341
Change-Id: I312bafb0e7d61b0abd42d6ca7ea2e4b5dcdc61be
2014-06-23 15:32:15 +00:00
jenkins-bot 9e7c60a4e4 Merge "Revert "Update displaytitle on save (try #2)"" 2014-06-19 00:36:19 +00:00
Alex Monk f84b880a54 Revert "Update displaytitle on save (try #2)"
This reverts commit b7401f838b.

Didn't break everything, but we should probably avoid this getting deployed until I can work out wtf is going wrong with it.

Change-Id: I048143239e998b30aba79fa395a0af1cb06c6a9b
2014-06-19 00:34:26 +00:00
jenkins-bot 29d5bf6e51 Merge "Update displaytitle on save (try #2)" 2014-06-18 23:41:29 +00:00
Alex Monk b7401f838b Update displaytitle on save (try #2)
This reverts commit 5565ccca54.

I have no idea what is going wrong on deployment-prep to cause
the error in bug 66792. Let's try to find out.

Bug: 50341
Change-Id: I5041de838128bb55c57baddae01cdcb263626537
2014-06-19 00:04:51 +01:00
jenkins-bot f8dbe1878c Merge "Show wikitext warnings in the reference and media caption dialogs" 2014-06-18 21:00:29 +00:00
Krenair 143c21999e Port MWSaveDialog to use ActionDialog
Relies on Id17d150d

Change-Id: I80dd89fa7ad55daa3ae7e9c01c4a78f6e54105ca
2014-06-18 20:43:45 +00:00
jenkins-bot c92285e75f Merge "Revert "Update displaytitle on save"" 2014-06-18 20:23:35 +00:00
Catrope 5565ccca54 Revert "Update displaytitle on save"
Causing HTTP 500 errors in ApiVisualEditorEdit.php (calling
getDisplayTitle() on a non-object).

This reverts commit dedc89b5ff.

Bug: 66792
Change-Id: Iaf438660f0623dc05f76294ad847b2fc5e25bed6
2014-06-18 20:21:10 +00:00
Krenair 046979ae80 Show wikitext warnings in the reference and media caption dialogs
Bug: 56213
Change-Id: I9da0ae627a990864cc8b9466d97c4419f315f65e
2014-06-18 16:12:02 +00:00
jenkins-bot dc81adeb36 Merge "Update displaytitle on save" 2014-06-18 02:23:28 +00:00
Ed Sanders c70d32c017 Use registered target, instead of ve.init.Target
Depends on I468d4eb4 in core.

Uses various hacks to trick the test runner into thinking
an MW target is in use, when in fact we still use SA targets.

Change-Id: If4611307d5d7aaee4af84f86ef82faf9078043b6
2014-06-17 20:41:01 +01:00
Roan Kattouw ee1bea701e Followup 00af434: only tear down debug bar if it exists
Bug: 66692
Change-Id: I3ec8cf9579da785327abbab5dd3618bb3f20895f
2014-06-16 15:54:12 -07:00
Ed Sanders 00af43495b Update VE core submodule to master (155f4ab)
Use new setupToolbar and setupDebugbar methods in base target.

New changes:
7ff523d Localisation updates from https://translatewiki.net.
3815224 [BREAKING CHANGE] Debug bar refactor
155f4ab Edit HTML mode in demo

Change-Id: I554ce51eae872ab0f741a913bf10394c2a8c3e52
2014-06-16 14:52:48 -07:00
Ed Sanders 71395e1fa4 Wait for onDocumentFocus to happen before setting section range
Bug: 65928
Change-Id: If76408b6b89541f0ecb065d4860e0652b6bdebb5
2014-06-15 13:07:32 +01:00
Krenair dedc89b5ff Update displaytitle on save
Also fix a couple of missing param docs

Bug: 50341
Change-Id: I1e73153dca5eb9343bbcda1fc2f9799e72f6f03c
2014-06-12 22:21:35 +01:00
Ed Sanders 0791d86b77 Update VE core submodule to master (4d919d2)
Implement new language platform functions.

Also remove unused MWLanguageSearchDialog and MWLanguageSearchWidget.

New changes:
4d919d2 [BREAKING CHANGE] Move language functions to the platform

Change-Id: I54c0a8e5816a3c81851f95f1d3062a6091a9f4a3
2014-06-12 19:42:35 +00:00
Krenair 638ad9e985 Wrap external URL protocols regex in brackets.
Bug: 65547
Change-Id: Ie69bfa2bbf3db01b89242655c8aa36c2483e7265
2014-06-12 17:05:43 +01:00
Trevor Parscal 06f00d73ae [BREAKING CHANGE] Update VE core submodule to master (43a48cb) for window process cleanup
* Update size of save dialog earlier on, and swap back to save panel in
  save dialog on setup instead of ready to avoid scaling and sizing
  simultaneously
* Update use of closing/closed/opening/open events to use
  setup/ready/teardown events instead

New changes:
43a48cb [BREAKING CHANGE] Update OOjs UI to v0.1.0-pre (9f4f250f88) for window process cleanup

Bug: 65705
Bug: 65343
Bug: 60843
Change-Id: Idf6f85ae12f6ca80fde57a400cb5b11270938c1a
2014-06-12 00:42:13 +00:00
Roan Kattouw 310601ef47 Update VE core submodule to master (e1b0e33)
Remove ProtectedNode mixins for new FocusableNode.

New changes:
e1b0e33 [BREAKING CHANGE] Merge ProtectedNode into FocusableNode

Change-Id: Ie515704163c24317739fd34d35094b9ada6bfa66
2014-06-10 16:52:49 -07:00
Roan Kattouw 1455c72a35 Update VE core submodule to master (ba8872e)
Replace instances of target.$document, which was removed
in VE core.

New changes:
8083623 [BREAKING CHANGE] Remove $document cache from target
9256158 Cleanup target properties
cc0d71f Multi-surface fixes
ba8872e Localisation updates from https://translatewiki.net.

Change-Id: Ibff83cae770c056ed64bcf438ed74b44d929cdc0
2014-06-10 13:52:34 -07:00
Alex Monk 07ac5df5f6 Add redirect=no to new URL when creating a new page as a redirect
Bug: 65621
Change-Id: I8a59958c51f537976843a564c49aed0328d044fb
2014-06-10 17:50:17 +00:00
Krenair c18fb662aa mw.ViewPageTarget: When saving a page as a redirect, update contentSub text
Or vice versa. Per my comment on bug 65621.

Change-Id: Ic51745103446dda8ea8ff901c4f211c30c39e45c
2014-06-10 17:34:52 +00:00
Krenair bf42b1a742 Send language when making API requests
The API moans about it in a warning, but it works.

Along with edit page checkboxes, this also fixes edit notices.

Bug: 65455
Change-Id: I7c319d43fd06ab04ab4e4cc099ae49b11c31fabd
2014-06-09 20:49:28 +01:00
jenkins-bot a733ea2aa3 Merge "Use promises for confirmation dialog instead of done event" 2014-06-05 00:16:21 +00:00
jenkins-bot 05b377193b Merge "On category pages, only replace category description when saving" 2014-06-02 19:22:40 +00:00
jrobson fef33d30ec Add use existing reference to toolbar on mobile
Note currently a blank icon appears to the left of this.
This will need to be removed later.

Change-Id: Ia8be1f0e83a2154a48de3c3a47bd8feb0c9a2a2c
2014-06-02 12:12:32 -07:00
Krenair e59b1e7f60 Use promises for confirmation dialog instead of done event
Should be merged at the same time as I70af4f4f
Unbreaks the confirm dialogs (I5f971852)

Change-Id: I7e7a5fcef4e749a3196f675e9f1f8e8bc5c11ca0
2014-05-31 16:25:27 +01:00
Trevor Parscal f65c3c6ef1 [BREAKING CHANGE] Update VE core submodule to master (88fe25f)
Switch to processes for windows (dialogs/inspectors)

This conversion also required the splitting of MWLinkInspector into
MWLinkNodeInspector and MWLinkAnnotationInspector.

New changes:
88fe25f [BREAKING CHANGE] Update OOjs UI to v0.1.0-pre (dd888aba5c)

Change-Id: I662d8985463c9fc881775f70aef87ebeb454a73f
2014-05-30 22:03:45 -07:00
Roan Kattouw d7ca1604d6 Clean up interaction with confirmation dialog
It now only sends a single 'done' event, which we can use .once on

Relies on I4f485d4f in OOjs UI.

New changes:
418cd67 Update OOjs UI to v0.1.0-pre (0f101c6f5d)

Bug: 65571
Change-Id: I19aa65612bf02bed056de292f212d2f5732a8fec
2014-05-30 16:39:07 -07:00
Ed Sanders 2122ccb654 Cleanup createSurface methods
No need to set in mw.Target as it now exists in core Target.

Add config param to MobileViewTarget override.

Depends on I555935d2 in core.

Change-Id: I72be9098bd9d59272ca3d7a9a64dca4271ef3ee5
2014-05-30 20:36:26 +00:00
Alex Monk b10d30084b On category pages, only replace category description when saving
Instead of overwriting everything else on the page (e.g. 'Pages in category ...')

See also bug 65349 / Ib6c49286 for file pages with a similar issue

Bug: 64239
Change-Id: I59ff9de5d0463f0f1ae8a18d54ebea5844fb1af5
2014-05-30 14:07:37 +01:00
Alex Monk 837eea324e Fix beta warning appearing for some users that it shouldn't.
Check that the user is anonymous before looking at their cookie to decide whether
to show beta warning dialog.
With the existing code, we would see that the preference is false and then check
that they have no cookie. But being logged in should make the cookie existence
be disregarded.

Fixes Ica9e5a92

Bug: 65821
Change-Id: I84e31323930c404222388bb74e4b4ca8d303e05c
2014-05-29 17:54:51 +01:00
jenkins-bot 1f4a1c9cf2 Merge "Add a hook so GuidedTour, etc. can know when save button is clickable" 2014-05-29 00:09:20 +00:00
jenkins-bot a7bf8b6a7f Merge "Convert toolbar structure group from bar to list" 2014-05-28 23:06:36 +00:00
kaldari d7bf3fabbe Adding header to top of citation pop-up list in mobile view
Per https://trello.com/c/xCo6uLAZ/9-5-references-dropdown-from-toolbar-styling

Also adding down-arrow indicator next to icon in handler (per Kaity)

Change-Id: I637891232f40ad217b4d3bd62bbecc502bf4cefb
Dependency: Id54100c55b05bdae5858ca72e4fd4418ceff0454
2014-05-27 23:16:25 +00:00
James D. Forrester e2fab2f1eb Dump raster support (unuseful) and assert SVG works before loading
Depends on Idb26804576 in core.

Change-Id: I17481b2d52ab2c33c26ff935b0fd58deb4aa207b
2014-05-27 15:22:26 -07:00
Matthew Flaschen d62c12ce7b Add a hook so GuidedTour, etc. can know when save button is clickable
Change-Id: I9b8ef8a193810c5e7275a61ba1a874d378c8b030
2014-05-25 15:13:51 -04:00
James D. Forrester 0d4aaf5b4c Move Safari 5.x to greylist because dialogs aren't working well
Bug: 65656
Change-Id: Idb1236d199e323381bcd69a50b34d8ba05ecc145
2014-05-23 20:05:01 -07:00
James D. Forrester 47e19a9873 Convert toolbar structure group from bar to list
Aligns with I84a4d948ae in stand-alone.

Change-Id: I533355a20bb329b91d6550bde4afa18180b38f59
2014-05-22 17:47:29 -07:00
Moriel Schottlender 963e133851 Remove media item styling moved to MW-core in I400336c12d.
Change-Id: I348e55ddea94f3b67f647c66ba53f7384d683584
2014-05-22 12:34:00 -07:00
Roan Kattouw 293609e5d8 Unbind confirm dialog handlers after either of the events fires once
We weren't unbinding these handlers at all, and so the 'ok' or 'cancel'
handlers could run multiple times for one button click, and even worse,
you could get in a situation where clicking 'ok' in one confirm dialog
would also run the 'ok' handler for the other one. This happens because
the ConfirmDialog instance is recycled by the WindowSet.

The way the unbinding is done is ugly; we should either consolidate the
'ok' and 'cancel' events so we can use .once(), or come up with some other
way to automatically unbind the handlers.

Bug: 65557
Change-Id: Iabf0c0d0229add09cc775358fc5a4e5ae783db04
2014-05-20 19:11:45 -07:00
jenkins-bot 8c95826338 Merge "Set flags for confirm dialog buttons for switching to source mode" 2014-05-19 21:56:38 +00:00
jenkins-bot 1d0e42a6ce Merge "Set flags for confirm dialog buttons" 2014-05-19 21:14:31 +00:00
jenkins-bot cd3264889c Merge "Use OOUI confirmation dialog rather than native confirm() for switching to source editing" 2014-05-19 20:50:31 +00:00
Roan Kattouw 96809998f2 Set flags for confirm dialog buttons for switching to source mode
"Yes, switch" isn't constructive; make it primary instead.
"No, cancel" isn't destructive; make it neutral (no flags) instead.

Change-Id: I841cbed4a81eaed679a8c7da89942c6b030a1217
2014-05-19 13:49:52 -07:00
Roan Kattouw 5b93980b68 Set flags for confirm dialog buttons
"Discard edits" isn't constructive, and "Continue editing" isn't destructive.
Instead, mark "Discard edits" as destructive, and make the continue
button neutral (no flags).

Change-Id: I7648555ad47be698e75b5019d7738b0afb8611aa
2014-05-19 13:46:36 -07:00
jenkins-bot fefd3a5d72 Merge "Whitelist Opera 15+" 2014-05-19 19:42:59 +00:00
jenkins-bot a8910ca542 Merge "Remove edit tab from the DOM if it's hidden" 2014-05-19 17:51:12 +00:00
Krenair a5dd438725 Use OOUI confirmation dialog rather than native confirm() for switching to source editing
Per TTO on bug 51655, the implementation of confirm() in most browsers is crappy and we
shouldn't use it.

Change-Id: I755085a253c05958e4b50af57b19dab90f2f0fb6
2014-05-17 18:24:04 +01:00
Krenair eb7b727a53 On file pages, only replace the (local) image description when saving
Instead of overwriting everything else on the page (including the thumbnail!)

Bug: 65349
Change-Id: Ib6c4928646d6d278e29fbe31ae1902b0dc3b146a
2014-05-17 17:53:15 +01:00
Krenair e7787db92d Remove edit tab from the DOM if it's hidden
Fixed bug 64142, works around bug 65292

Bug: 64142
Bug: 65292
Change-Id: I31d8f7b149d657a678ed6ebc56b92305934f34bc
2014-05-17 00:56:38 +01:00
Krenair 411f0a7729 Set up edit notices for things like unknown browsers on each activation
The list is cleared on cancel

Bug: 65236
Change-Id: I96a1d95535ec0569e3e25adaa64625fc3a0c4b97
2014-05-15 21:01:30 +01:00
Timo Tijhof 2ef5468471 mw.ViewPageTarget.init: Remove redundant hasOwn check
Follows-up e3be4a6. Object properties default to undefined, no
need to check existance first. Looks like like an "isset()" in
PHP for preventing E_NOTICE.

Change-Id: I594b23e6caf1e17d6d5d37e6a5fd81152e78b3a6
2014-05-15 16:58:03 +00:00
Timo Tijhof 25d00cc777 build: Update jscs and jshint
jshint:
* Update to grunt-contrib-jshint v0.10.0 (jshint v2.5.0).
* Remove coding style options covered by jscs.
* Enable new option "freeze" (prohibits changing native prototypes).
  http://www.jshint.com/blog/new-in-jshint-oct-2013/#option-freeze
* Re-order to match http://www.jshint.com/docs/options/

jscs:
* Update to grunt-jscs-checker v0.4.4 (jscs v1.4.5).
* Format .jscsrc file in a more spacious way and order the
  properties less arbitrarily (using the jscs's readme order).
* Enforce more details of our coding style
* Get rid of the unsable "sticky" operator rules which have been
  deprecated in favour of using other rules instead that are able
  to enforce this more accurately.
  - disallowLeftStickedOperators: Remove deprecated rule.
    * Ternary covered by requireSpacesInConditionalExpression.
    * Rest covered by requireSpace{Before,After}BinaryOperators.

  - requireLeftStickedOperators: Remove deprecated rule.
     * Comma covered by disallowSpaceBeforeBinaryOperators.

  - requireRightStickedOperators: Remove deprecated rule.
    * Logical not (!) covered by disallowSpaceAfterPrefixUnaryOperators.

See also If46b94ce1, Ib731f11b1 and I0b0cadbc5 in oojs/core.

Also:
* Update grunt-contrib-watch to latest upstream version.
  Change log at https://github.com/gruntjs/grunt-contrib-watch/blob/v0.6.1/CHANGELOG#L1-L17

Change-Id: I6c5a34afea8b05a3dca617897c192594df06ca90
2014-05-15 16:52:34 +00:00
jenkins-bot f0d19359a6 Merge "Fire hook when VE activates/deactivates" 2014-05-14 23:29:34 +00:00
Krenair 28fb8c8d4c Fire hook when VE activates/deactivates
Bug: 65320
Change-Id: I3658d6cbe6dd81d8d143fce9659f2c8c4e25ba07
2014-05-15 00:26:36 +01:00
jenkins-bot fb4b6f0b0d Merge "Move shortcut keys help from "Page options" dropdown to "Help" popup" 2014-05-14 23:16:48 +00:00
jenkins-bot 0680c02aa7 Merge "Hide PageTriage curation toolbar while VE is open" 2014-05-14 23:04:03 +00:00
Krenair 204554a567 Swap from using native confirm() to using an OOUI dialog when cancelling
Relies on:
* I292fb34d in OOjs UI to add the confirmation dialog
** I67329820 in MediaWiki core to use the messages added in OOjs UI
** I38f5bb63 in VisualEditor core to register the confirmation dialog

Bug: 50955
Change-Id: I98f9a03d780556b360b57c018c05a27cc1b3862e
2014-05-14 23:00:35 +00:00
Krenair ddd43b8227 Hide PageTriage curation toolbar while VE is open
Bug: 56731
Change-Id: Iee842d4444ead00587dbfb21f93b65bdec728405
2014-05-14 23:19:39 +01:00
Krenair 81801edb50 Only send useful oldid while switching to wikitext editor if it's specifically requested
Usually we can just send 0. Sending anything else makes PostEdit think we're restoring an old revision.

Bug: 65269
Change-Id: I60454a7a4ea3f6c7cef4c707da3016dd0ec29b88
2014-05-14 22:24:47 +01:00
kaldari e2f29231cb Changing formatting of Cite drop-down for mobile/tablet interface
These changes are to accomodate the design for the mobile/tablet
version of VisualEditor which uses an icon rather than a label
for the drop-down button.

Change-Id: I1086ed4a84ae4061fcc79cc7f587657232c5d5df
2014-05-13 16:49:22 -07:00
Bartosz Dziewoński 885bf01b7e Whitelist Opera 15+
It's using the Blink engine like Chrome.

Change-Id: Ia1c145ebdac0fb099051d32785a7929c19f5d7d0
2014-05-13 20:57:23 +02:00
Bartosz Dziewoński d8de718a5d Move shortcut keys help from "Page options" dropdown to "Help" popup
Obviously it doesn't belong there. I think I'm getting the hang of this. :D

Change-Id: I5933e32bb8a803d004c2e33d55d7900d1b18a44e
2014-05-12 15:28:30 +00:00
jenkins-bot b84bceda7a Merge "Follow-up Id401d973: mw.Target: Make the "Cite" label in the toolbar translatable" 2014-05-11 07:18:10 +00:00
Bartosz Dziewoński 5e253306d1 Follow-up Id401d973: mw.Target: Make the "Cite" label in the toolbar translatable
Also, re-alpha-sort the ve-mw i18n files.

Change-Id: Id3fc7894b3774042c5eda877c9edf55ef4941ebf
2014-05-11 09:09:09 +02:00
James D. Forrester 80fc16a57e Follow-up Ica9e5a9284: Actually make visualeditor-hidebetawelcome work
Three 'minor' points:

* You have to declare even hidden preferences. Whoops.
* There's no such thing as an "optionsToken", use "editToken".
* You need to POST action=options API calls.

Ahem.

Change-Id: I9c4358107af7bcfca157bd014de49882914e990c
2014-05-10 20:02:40 +00:00
James D. Forrester fab7aacc12 mw.ViewPageTarget: Hide the welcome dialog via a preference if possible
For logged-in users, we can a preference instead of a cookie. This way it is
also preserved between browsers and when cookies are cleared.

Keep using cookies for logged-out users, except if the beta welcome dialog
has been suppressed using the one-off GET parameter 'vehidebetadialog'.

Bug: 55551
Change-Id: Ica9e5a92841fec003ce4a21d740a9bc6ff3da9c7
2014-05-10 09:46:45 +02:00
Timo Tijhof 7dae6496b3 mw.ViewPageTarget: Get rid of FOUC on edit section brackets
We don't have a FOUC on the appearing of the 'edit' link. That
one is handled quite intelligently:
* Via the stylesheet that is also loaded in noscript mode, its
  (hidden) appearance is already predetermined. So as soon as
  those elements are seen by the browser they style correctly
  for users without JavaScript (display: none).
* This same stylesheet also hides it for users with JavaScript
  but where VE is not available (e.g. due to browser support).
  While ve-not-available is added very early on (before
  document ready), it could in theory cause a short FOUC, but
  that's okay. We simply don't know that VE isn't supported
  until then. We optimise for the common case (JavaScript
  enabled, VE available), while still ensuring that it is
  always hidden in noscript, and is hidden as soon as possible
  when VE turns out not to be available.

For some reason, one small detail (the little bit of whitespace
added inside the brackets), was left out of this and was
implemented by adding the class 'mw-editsection-expanded' to them
from a document ready handler.

* First step, get rid of the script that adds this class and
  use ve-available instead. That means they're styled
  correctly much earlier (we add the class to <html> before
  document ready). This can still cause a brief FOUC, though
  in most cases they're correct from the start.

* Step two, make brackets expand by default for script users,
  and let ve-not-available reset it. This way, like with edit tabs,
  a FOUC will never happen for ve-available. And even for
  ve-not-available, a FOUC is rare since we add it before
  document ready via <html> look-ahead styling.

There was still a brief reflow jump because of negative margins
between two paint events. One was undoing the other at a later
time. These negative margins are a remnant of when we were doing
animations (follows-up I4b9c47fd65a70). They were added to reduce
reflows and content shift, but were now actually causing them.

Removed "padding-right" from mw-editsection, and negative margin
from the brackets.

Also:

* Don't add inline 'style="direction: ltr;"' on every single
  editsection throughout the DOM. This was the only operation we
  were doing unconditionally. While I doubt the need of it in
  general, we can at least allow MediaWiki to do it right, and
  only add the override if needed. This saves quite a few DOM
  operations.

Change-Id: I7a729edc2cd4a66ebc0ad6935ffd02cb9b948bff
2014-05-09 12:20:24 +02:00
Timo Tijhof ad2fdfb66b ve.init.mw.ViewPageTarget: Actually animate the toolbar during setup
There was a slideDown() call, but this didn't do anything since
toolbars are visible and in the DOM by default.

As a temporary hack, hide it synchronously after creation and
then do the slideDown still.

This could ever so briefly cause a flash, though that didn't
happen in my testing.

This makes the experience smoother when we initialise the surface.
In particular the moment where we swap #bodyContent for our Surface
(which should look visually almost identical), before this change
it was still a bit of a flash since the Surface version has a
toolbar on top, and thus instead of swapping smoothly, we hide
content and show a similar piece of content that has an incompatible
offset from the top.

Bug: 64751
Change-Id: Id94974ba71fd887ce494d7b2b16ec62d43b18575
2014-05-06 02:43:37 +00:00
Juliusz Gonera 72fdab7a0d Enable references on mobile
Further styling and UI improvements in upcoming patches.

Change-Id: I8f93f2a2a6a6eb0c3a9953c7c479f92872d5b621
2014-05-02 14:49:19 -07:00
jenkins-bot 9f3f95d095 Merge "ve.init.mw.ViewPageTarget: Hide #contentSub in addition to #toc when muted" 2014-05-02 18:03:37 +00:00
Timo Tijhof 0b96e0dc3a ve.init.mw.ViewPageTarget: Hide #contentSub in addition to #toc when muted
Yet a another visual shift eliminated. Getting closer..

Bug: 64751
Change-Id: I9ae7afc439648e62712f6dedb7cecc07a653675a
2014-05-02 18:52:02 +02:00
Krenair 12109027a9 Switch to use MediaWiki's built-in messages for post-edit notifications
Bug: 52871
Change-Id: Ibb56fc298c2116c071bf4ed910d175282dcdb741
2014-05-01 21:51:32 +01:00
jenkins-bot 48d025aead Merge "Support QuestyCaptcha and (kind of) MathCaptcha" 2014-04-30 21:34:04 +00:00
Timo Tijhof b272845791 mw.ViewPageTarget: Move .mw-body-content down to .ve-ce-surface
Update VE core submodule to master (109a3cf):

* 109a3cf ve.ce.Surface: Remove font-size: 1em;

Follows-up I5818dce6265.

* When applied to ve-ui-surface, it applies to both of its children,
  namely ve-ce-surface and ve-ui-surface-overlay. The latter
  (containing things like context menu and inspectors) should not
  inherit styles intended for rendering of wikipage content by
  the skin.

* Move mw-content-{ltr,rtl} from an outer parent to a slightly
  deeper parent of the actual content. It's now on documentNode.
  Still high enough to apply to all content. This was to ensure
  it remains a child of mw-body-content, like in MediaWiki core.

* Updated padding/margin hack again. Since now the font-size
  applies on the surface, this once again means that now 1em
  on the surface != 1em on the documentNode, so we need the
  calculation again. Brought it back and this time documented
  what it is based on.

Bug: 64599
Change-Id: I9ee4582a6a0ec9e128f5c36a6dbf2adbd0b216a1
2014-04-30 21:09:54 +00:00
jenkins-bot c4b1d3cff9 Merge "Add class name to protected pages, to allow for specific CSS styling of edit area" 2014-04-30 21:01:39 +00:00
Krenair f8d609a8c7 Add class name to protected pages, to allow for specific CSS styling of edit area
Also get rid of checking for NS_MEDIAWIKI explictly and use
MWNamespace::getRestrictionLevels instead

Bug: 50783
Change-Id: I5986ddb9b6f17e4a2aca12dbb551cce4a6cfd663
2014-04-30 13:59:30 -07:00
Timo Tijhof 4a5bede30e mw.ViewPageTarget: Simplify tab transform/restore logic
Follows-up I4b6e5c898a8af2b40415.

Change-Id: I5fc0f554d1770d3c8e5b961e74bdfb5741324910
2014-04-30 21:05:33 +02:00
jenkins-bot 43c0341ad3 Merge "Fix tab selection on monobook" 2014-04-30 18:10:53 +00:00
jenkins-bot da577b21d5 Merge "mw.ViewPageTarget: Use .mw-body-content for content styling" 2014-04-29 22:25:53 +00:00
Trevor Parscal e0e08388ce mw.ViewPageTarget: Use .mw-body-content for content styling
* font-size and line-height differed between read mode and
  edit mode. This makes them match by using the same css class
  as MediaWiki core uses for the body content.
  Depends on I66c56c57 in MediaWiki core.

* Document padding / margin hack on surface, and sync the values.
  In edit mode, the text was being nudged to the right by a few
  pixels.

* Bump the wfUseMw call as this is a symptom of how VisualEditor
  now depends on MediaWiki 1.23.

Bug: 64599
Change-Id: I5818dce626545c4cbc8bd84fd551dc08baedbe32
2014-04-29 21:04:05 +00:00
jenkins-bot 27d3286362 Merge "Don't change section edit links on foreign file description pages" 2014-04-28 18:53:06 +00:00
Krenair e815d586cc Don't change section edit links on foreign file description pages
We have no proper way to check whether VE is enabled on the remote wiki.

Bug: 54259
Change-Id: I4b0edc00ee9736b282820d4a504f1702ab0590fc
2014-04-28 11:49:14 -07:00
Krenair 032d9d53ec Fix tab selection on monobook
Don't unselect article tab when loading VE, do unselect when restoring normal view mode.

Bug: 49407
Change-Id: I4b6e5c898a8af2b404151bba46359dc4bfbd739e
2014-04-28 16:42:01 +01:00
Krenair 94b5c8dfa5 Support QuestyCaptcha and (kind of) MathCaptcha
MathCaptcha just extends SimpleCaptcha, so its output is fine to show as
text. Doing that because I'm not sure how to render TeX and this is a
reasonable fallback

Also tidy up the order of some message entries in my last commit.

Bug: 64328
Change-Id: I98312f61471667e7c4dcf715295f85642c31a688
2014-04-24 21:45:20 +01:00
jenkins-bot 2a675d0ce8 Merge "Add support for SimpleCaptcha" 2014-04-24 01:09:29 +00:00
jenkins-bot d2e5874ece Merge "Hide some tools when VE is open" 2014-04-23 23:06:52 +00:00
Krenair 62e07f8008 Add support for SimpleCaptcha
Bug: 64328
Change-Id: I04dd82e72184dcef6a660c0886b16a1086ed0b26
2014-04-23 23:30:52 +01:00
Roan Kattouw 54d06b2a3d Unbreak badtoken recovery on mobile
When recovering from a badtoken error, mw.Target called saveDocument(),
but that method only exists in ViewPageTarget. Instead, call .save()
again.

Also pass the HTMLDocument and the save options around to the success
and error handlers, because we need them in order to be able to
call .save().

Bug: 64267
Change-Id: I4743f855dc77f4a9ac427d67d15fb96b7ad770f2
2014-04-23 12:30:48 -07:00
Krenair df38c8b55e Hide some tools when VE is open
Bug: 57940
Change-Id: I2f586e8c73affe1b7f14c40ba892774e784f09c8
2014-04-22 23:47:54 +01:00
Roan Kattouw ba455643fc [BREAKING CHANGE] Update VE core to master (cb2e61b)
Update dialogs and inspectors for breaking change in VE core

New changes:
a553012 [BREAKING CHANGE] Merge dialog and inspector actions into window actions
f9a0419 Localisation updates from https://translatewiki.net.
cbe81a0 Fix path to spinner in ve.ui.SpecialCharacterInspector.css

Change-Id: Icf90ace6442364283b66b234e3c78fc65212f070
2014-04-21 15:32:59 -07:00
jenkins-bot a1c4df7980 Merge "Update wgRevisionId when we change wgCurRevisionId" 2014-04-21 19:06:44 +00:00
Krenair 167a2f341e Update wgRevisionId when we change wgCurRevisionId
Bug: 56532
Change-Id: Ibb5a92d66a7a60ef516d3ef385b4473919a6ac63
2014-04-19 17:59:28 +01:00
Krenair b6f1793bf8 Use new OOUI pending feature rather than loading bar thing on save dialog
See I5c45cc6 for the oojs-ui change and I2fa71a1d for a similar commit

Change-Id: I77e3274a196bc13ae19a9520197f4a8b624fd528
2014-04-18 21:57:14 +01:00
jenkins-bot 987b10da94 Merge "Check useeditwarning preference before showing warning when browsing away from editor" 2014-04-18 19:24:23 +00:00
jenkins-bot caecb84b9b Merge "Remove Function.prototype.bind from compatibility check" 2014-04-18 04:16:49 +00:00
Alex Monk ca547a7f7c Check useeditwarning preference before showing warning when browsing away from editor
Bug: 51057
Change-Id: Ic4b02372e6e08d3a0d36457457a2e2bbfbaa797d
2014-04-17 15:57:10 +01:00
James D. Forrester df31082085 Remove Function.prototype.bind from compatibility check
We aren't using it anyway, and it blocks some browsers unnecessarily
(PhantomJS in particular).

Change-Id: I90b1124704bfaf571212fdf9e187a450104176dc
2014-04-17 03:49:03 +00:00
jenkins-bot a1fd95e522 Merge "Don't change tabs on Education Program pages" 2014-04-17 03:38:50 +00:00
Krenair e3be4a6588 Don't change tabs on Education Program pages
Unfortunately the best way I've come up with to do this so far is
checking the namespace.

Bug: 53477
Change-Id: Ib2dbe91aff516f2d2408e07ff3f73ea861bfcbe2
2014-04-16 20:33:24 -07:00
Roan Kattouw 5b0d4b5286 Use the correct classname in MobileViewTarget
Change-Id: I7e0a5aa56116dd7f44cbac29e0b6bc5d760e157e
2014-04-16 17:41:18 -07:00
Roan Kattouw 2262073c9c Update VE core submodule to master (4366f20)
Use new dm.Surface method for checking undo history state
(hasPastState -> hasBeenModified).

New changes:
38776df [BREAKING CHANGE] Refactor history state methods to better suit uses
3412b41 Localisation updates from https://translatewiki.net.
0c5238c Add system to dm.Surface for staging changes
8f0077c Only hide popups on selection change
4575f82 Fix initial selection when focusing in Firefox
debfd4e Document focus/blur cleanup

Change-Id: Ic66c96a4f64ad82a01a84535ca8cd19332065b37
2014-04-16 15:57:28 -07:00
jenkins-bot 266bc709f6 Merge "Always replace state with VE tag when loading" 2014-04-16 18:50:09 +00:00
Krenair e9153fdccf Always replace state with VE tag when loading
Instead of just when venotify is used. To stop the back button breaking.

Bug: 63739
Change-Id: I637818f34a9015076c85c6daccb337503ad2499d
2014-04-16 18:02:10 +01:00
Ed Sanders b019036a2c Hide inspectors using new method when saving
Previous hack caused unwanted blur events and subsequent range changes.

Depends on I8388318311 in core.

Change-Id: I9163f4d9928887a5eec09f0651ec0a66cc221cd4
2014-04-14 17:17:42 -07:00
Ed Sanders 3bba5e4d3b Pass required params to open for save dialog
Change-Id: Ib2e8f6255544894d54d9a89a579241b40c58ef90
2014-04-14 16:18:22 -07:00
jenkins-bot d20ff82e5c Merge "Use updated tab labels on description pages for files in foreign repos" 2014-04-11 19:11:10 +00:00
jenkins-bot d8453acff5 Merge "Remove remaining uses of surfaceModel#getSelection in dialogs" 2014-04-11 18:43:14 +00:00
Ed Sanders 340a939c97 Remove remaining uses of surfaceModel#getSelection in dialogs
These were being used indirectly in the MW*Model's. Use surface
fragments instead.

Fixes I0fae3e5ff2bd.

Change-Id: I1d6aa5e00a9315cf7088f87f9e9d828833feec64
2014-04-11 11:14:43 -07:00
Roan Kattouw 989fd6214c Fix JS error when opening VE on redirect page
Change-Id: I95dd2dc2c52ffa3d420a579592e84001bd2b10e8
2014-04-11 10:13:51 -07:00
Trevor Parscal afb182c23c Limit the number of citation tools to 5
Don't let too much toothpaste get out of that tube aye!?

Change-Id: I5cd92b7826d55ddde505f1bb883c6f8ed3223ec0
2014-04-10 11:47:34 -07:00
Ed Sanders 0e51180709 Update VE core submodule to master (55a5cdc): use new ve.ui.Dialogs and ve.ui.Inspectors
Move various bits of code from initialize to setup as required.

MWDialog is now useless so use ve.ui.Dialog directly.

New changes:
0b2d03f [BREAKING CHANGE] Pass fragments, not surfaces, to windows (reprise)
0101ac4 Update OOjs UI to v0.1.0-pre (ac6848398c)

Change-Id: I0fae3e5ff2bd0da5b74c244af226b07b1f5883bd
2014-04-09 20:28:30 -07:00
Ed Sanders 164cf27299 Use new model directionality in MW
Depends on I2065e17020dc89 in core.

Change-Id: I6e99db601af58a9c4200f885887de451f9f70daa
2014-04-09 18:21:25 +00:00
Krenair 99640bf1a7 Use updated tab labels on description pages for files in foreign repos
See I4a43b759

Bug: 63666
Change-Id: Ie4aeddde4909f455472dc5239156c23200033ee8
2014-04-09 00:26:29 +01:00
jenkins-bot b71e58c0f7 Merge "Give the edit tab <li> closest to the collapsed tabs menu class=collapsible" 2014-04-04 19:32:21 +00:00
jenkins-bot aeb4fabd2d Merge "Fix order of start and base timestamps when switching to the wikitext editor" 2014-04-04 19:31:58 +00:00
Krenair 9dac9f2c04 Fix order of start and base timestamps when switching to the wikitext editor
These were backwards which was triggering edit conflict detection for all users.

Fortunately for logged in users, if Revision::userWasLastToEdit was given a bad
timestamp (e.g. when we submitted here), it would just return true, suppressing
the conflict. It always showed a conflict for anonymous users however.

Bug: 56835
Change-Id: Ib07f965238ca96e17bf59b34da8a8e789954da61
2014-04-03 23:06:41 +01:00
Krenair e3b7827c44 Give the edit tab <li> closest to the collapsed tabs menu class=collapsible
Bug: 50225
Change-Id: Ib2e6237483338c8072d5f7919c6459bf7418946a
2014-04-03 02:16:13 +01:00
Ed Sanders 391e247c90 Show the debug bar in MW if ve.debug is set
Depends on Ide1487250e in core.

Change-Id: Ia31e498b565c4db79026e0e40f515a2b65bbbde2
2014-04-02 17:33:29 -07:00
Roan Kattouw 03c5822b6b Update VE core submodule to master (c5f4f78)
Also update tools for changes in VE core.

New changes:
e4de14b Make tools use commands
e029817 Make getToolsForNode place primary commands first

Change-Id: I66575ee6d49e6b2f5a5f789978da98bb55e6dc5e
2014-04-02 16:30:12 -07:00
Roan Kattouw c06a86587c Deal with Parsoid's protocol-relative <base> tags in a DOMParser world
Protocol-relative <base> tags are fine when the iframe trick is used
because the iframe inherits a default base URL from the parent document,
so if the <base> is relative it can be resolved against that. However,
a document created with DOMParser (or document.implementation, oops!)
won't inherit anything, so anything other than a fully absolute <base>
will just break.

To make Parsoid's relative <base> work anyway, resolve it in the
context of the main document, then write the resolved version
back into the <base> tag.

Change-Id: I7261bd5dbe9ec1f4077a4e5a00bd2a03ac237ca0
2014-03-26 21:56:23 -07:00
jenkins-bot 50f9f2b983 Merge "Fix copyright year range for fourteen files not updated to 2011-2014" 2014-03-26 22:55:08 +00:00
jenkins-bot cf56fbd0c4 Merge "Make generateCitationFeatures() not explode when citation code isn't loaded" 2014-03-25 18:46:22 +00:00
Roan Kattouw 9d7551ae75 Make generateCitationFeatures() not explode when citation code isn't loaded
Bug: 63074
Change-Id: Ic3973d06707e89993bb551daba0fe13bd3cffc71
2014-03-25 11:26:14 -07:00
James D. Forrester 95dee3ceee Fix copyright year range for fourteen files not updated to 2011-2014
Change-Id: Ibef2bf965dbd970b235a57058bcb3922a8777aa2
2014-03-24 18:36:51 -07:00
jenkins-bot 70ff498a5f Merge "Move cite to be after link, instead of after structure" 2014-03-25 00:16:44 +00:00
Trevor Parscal 1363d15c53 Move cite to be after link, instead of after structure
Change-Id: I69170b68997b8df595cc12e10b3467444e3ae952
2014-03-24 17:13:59 -07:00
jenkins-bot 6465a3f8d6 Merge "Add new 'vehidebetadialog' GET parameter to not show the beta dialog" 2014-03-24 23:26:39 +00:00
Trevor Parscal be199c0bf2 Ultra-mega-hyper-citation editing on crack
Objectives:
* Allow users on-wiki to create tools and dialogs for citation templates
of their choosing
* Allow editing of citation templates directly, without having to go
through the reference dialog
* Provide citation template tools within reference editing that use the
same titles and icons as the citation tools do, but don't wrap the
inserted content in a ref tag

Changes:

* Reference list was cloning the DOM element it was inserting into its
view before the generated content node could finish rendering, so it
never ended up showing the finished rendering in the reference list
* Documenting hack about use of reference list node's destroy method,
and how we are depending on destroy not canceling generated content
rendering
* Introduced reference model
* Added saving/updating method to transclusion model
* Added getPartsList method to dm transclusion node, which caches the
result and invalidates the cache on update
* Added citation dialog, which extends transclusion dialog
* Added cite group to toolbars, cite-template in reference dialog toolbar
* Factored out getting the node to edit and saving changes procedures in
transclusion dialog so they could be extended in citation dialog
* Updated uses of autoAdd as per changes in oojs-ui (Ic353f91)
* Renamed MWDialogTool file since there was only one tool in it
* Expanded TransclusionDialogTool file out since there is now more logic
to it
* Switched to using ve.dm.MWReferenceModel instead of plain objects in
reference search widget

Configuration:

If you add to MediaWiki:Visualeditor-cite-tool-definition.json the
following code you will magically be presented with a delightful array
of citation options:

[
    { "name": "web", "icon": "ref-cite-web", "template": "Cite web" },
    { "name": "book", "icon": "ref-cite-book", "template": "Cite book" },
    { "name": "news", "icon": "ref-cite-news", "template": "Cite news" },
    { "name": "journal", "icon": "ref-cite-journal", "template": "Cite journal" }
]

...or...

[
    {
         "name": "any-name",
         "icon": "any-ooui-icon",
         "template": "Any template",
         "title": "Any title text"
     }
]

The title text is derived either from the title property or from the name
property by pre-pending the string 'visualeditor-cite-tool-name-' to
generate a message key. Titles for 'web', 'book', 'news' and 'journal' are
provided. The icon is a normal oo-ui-icon name, and more icons can be
added, as usual, by adding a class called .oo-ui-icon-{icon name} to
MediaWiki:Common.css. 'ref-cite-web', 'ref-cite-book', 'ref-cite-news'
and 'ref-cite-journal' are provided. The template name is simply the name
of the template without its namespace prefix.

Depends on Ic353f91 in oojs-ui

Bug: 50110
Bug: 50768
Change-Id: Id401d973b8d5fe2faec481cc777c17a24fd19dd4
2014-03-24 19:24:38 +00:00
Trevor Parscal 90f458ebf4 Fix a typo that causes crashes when using the wrong symbol for mwTocWidget
Bug: 62934
Change-Id: Id2713a9aab1ec372ce987c24d8703aa91e1abe98
2014-03-21 20:33:17 +00:00
James D. Forrester 4bc8205a91 Add new 'vehidebetadialog' GET parameter to not show the beta dialog
Mostly for the benefit of the browser tests. Also, clean up this code a bit.

Change-Id: I9c85171ee175dabc232740c5c48ec363db10e98c
2014-03-20 11:48:59 -07:00
jenkins-bot 24c0082093 Merge "Display links to nonexistent pages as red" 2014-03-20 02:44:22 +00:00
Roan Kattouw 78a52f1f80 Display links to nonexistent pages as red
* Add ve.init.mw.LinkCache to track page existence and
  transparently query it
* Populate it with initial data from the parser cache
  if available, obtained in the VE API module
* Use linkCache data in link annotation rendering

This doesn't yet integrate the LinkCache with other
components like the link inspector. That should be
done so we can deduplicate the existence checks.

Additionally, we should generalize LinkCache and use
it for the category existence/status checks as well.

Bug: 37901
Change-Id: I9fd43e8c3864dd375cf6dadfdeedd05e4fe9cf3b
2014-03-20 02:42:33 +00:00
jenkins-bot 6c85a29a85 Merge "Properly teardown TOC widget" 2014-03-19 23:27:18 +00:00
Rob Moen e02460131f Properly teardown TOC widget
Change-Id: Ib115024b4e50ac379e5b8689ae796fce3586d386
2014-03-19 15:51:23 -07:00
James D. Forrester 903c19ef06 Disable VisualEditor on Page Translation output pages
Also, we warn the user that Here Be Dragons™ when they're editing a Page
Translation /source/ page.

Bug: 50284
Change-Id: I841ccb8461d31358640a16301a6a78750a660d36
2014-03-19 15:25:24 -07:00
Andrew Garrett 7e52a1ab2a Fail gracefully if there is no edit tab
For example, LiquidThreads pages, pages which are using DynamicTabs, etc.

Change-Id: I6b059dd76c150ee7fefb087aefe7fcccf41a3a43
2014-03-18 16:25:24 +11:00
James D. Forrester b68c8d3819 Re-sync toolbarGroups for MWMediaEdit and MWReference dialogs
Change-Id: Ic42a57e0e7a1639242092dbe41e13c1b8586f841
2014-03-14 17:01:44 -07:00
jenkins-bot fbdc55dc78 Merge "Table of contents widget" 2014-03-14 22:31:10 +00:00
Rob Moen eba7d58dd1 Table of contents widget
TOC Widget is created in the mw target view class.
Adding and removing a heading rebuilds the TOC Widget based
on the the order of the page heading nodes.

TOC Widget considers TOC page settings and displays in the default manor
unless forced or disabled.

TOC Widget still needs to be finalized by being placed in the surface.
This could be a problem until we have a CE node for it to live in or
have some DM work added.  Roan and I have discussed how to go forward.

To enable the widget you must add the following to LocalSettings.php:
$wgVisualEditorEnableTocWidget = true;

Change-Id: I488cfbbdb060e50d81f51e0f757e67d0114b8936
2014-03-14 15:20:19 -07:00
Trevor Parscal 42ba981e27 Update VE core submodule to master (520299e)
New changes:
dd15f23 Split ve.ui.Surface into DesktopSurface and MobileSurface
16283f4 Add OOjs UI's sco.json i18n file
ef94038 Split ve.ui.Context into DesktopContext and MobileContext

Minor adjustments to point to desktop and mobile Surface or Context.

Change-Id: I7cf6f99a5a1216a28a7146afcd4deb68c7eac38e
2014-03-14 13:13:02 -07:00
jenkins-bot 3316a0ac62 Merge "Add createSurface() to Target" 2014-03-13 00:57:58 +00:00
jenkins-bot 5825389447 Merge "Fix JS error trying to access this.saveDialog from switch to source mode code path" 2014-03-13 00:56:09 +00:00
jenkins-bot 3a378ccc6c Merge "More gracefully handle situations where Parsoid returns a timeout failure code (HTTP 504)" 2014-03-13 00:54:29 +00:00
Krenair e04099b63d More gracefully handle situations where Parsoid returns a timeout failure code (HTTP 504)
Bug: 50475
Change-Id: I36d0dc2c44a509d4e40ecadcfb5e3df81e01bca9
2014-03-13 00:44:39 +00:00
Timo Tijhof 5f64ed64d8 mw.Target: Add class "mw-ve-editNotice" to edit notices
Follows-up I260059802379 which removed got rid of
the "ve-init-mw-viewPageTarget-toolbar-editNotices-notice" class
from notices and didn't add something generic in its place.

(There is "ve-ui-mwNoticesPopupTool-item" but that's more an
internal class we don't want gadgets and wiki stylesheets to
rely on.)

Bug: 43013
Change-Id: I8e1e383c2cb3199fe78f45f4feaa24a44126cf0b
2014-03-12 23:07:39 +01:00
Timo Tijhof c3f6a2f561 mw.ViewPageTarget: Tag our state changes and reject foreign states
Store a bit of data with the states we push or replace in the
history so that when the user navigates back to them, we know
for sure this is a state we pushed in the history.

This allows us to filter out popstate events triggered by the
user browsing to states create by other software, as well as
states triggered by the browser that have no state data at all
(Chrome is known to, in contrast with other browsers, trigger a
blank popstate event on load, which we were mistaking for a user
event where the user navigates back to veaction=edit).

Bug: 57901
Change-Id: I142777d0d2ae96d3afee224782f0d2d1522da1eb
2014-03-12 22:26:52 +01:00
Roan Kattouw 7cdaa2a290 Fix JS error trying to access this.saveDialog from switch to source mode code path
The switch to source mode code path was causing onSerializeComplete to
be called, which accesses this.saveDialog because it assumes it's being
called from onSaveDialogReview.

In fact, onSaveDialogReview was calling it twice, once as the callback
it passes to serialize() and once in response to the serializeComplete
event. Cleaned this up by renaming the function and removing the
event binding, so it's now only called once and only for reviewing
changes to new pages, not in the switch to source mode code path.

Bug: 62544
Change-Id: I86eea57806a20408c8dc89a234c39cae1d969bca
2014-03-12 12:05:02 -07:00
jenkins-bot 9eea7240b7 Merge "Rename 'wasve' parameter to 'veswitched'" 2014-03-12 18:14:12 +00:00
Krenair 6b2d30c259 Rename 'wasve' parameter to 'veswitched'
Per Krinkle's comment on I1426d300

Change-Id: Ic99efe9488c98a7f6703142d6061bd2cdbac833b
2014-03-12 18:10:17 +00:00
Roan Kattouw 66a94861e6 Followup 4bd80b62: fix JS error on page save
Remove stray access to removed this.timings property.

Bug: 62508
Change-Id: I9a6fb802302bbc25ff3e9a657b983d98a0de7fd2
2014-03-10 22:12:07 +00:00
Juliusz Gonera ec6c76d619 Add createSurface() to Target
This can be overriden in subclasses (such as MobileViewTarget) so that
we can customize the way the surface is created.

Change-Id: Id17695c8c75c7ae6c549f915625667389aad5f2f
2014-03-10 14:52:06 -07:00
jenkins-bot fb483849e6 Merge "Abstract tracking and specify which target it came from" 2014-03-08 01:01:08 +00:00
jenkins-bot d86b6a0f02 Merge "Re-enable VisualEditor's toolbar icons on mobile." 2014-03-07 21:55:23 +00:00
jrobson 2ea1eec10c Re-enable VisualEditor's toolbar icons on mobile.
The experience should be consistent between mobile and desktop.
We should explore re-styling these buttons to look like
Ib3c94d19231b018a509b78269001223ad0568795 in desktop as well
at a later date.

Change-Id: Ic9e4c5d12c3c75fcb195432c9155ec0a7eecac04
2014-03-07 10:59:09 -08:00
Rob Moen 4bd80b625e Abstract tracking and specify which target it came from
Split tracking out of the base target and from viewPageTarget

Primary reasons for this change:
 * Makes it possible to resolve an issue with tracking in mobile
 * Lets us reuse the viewPage save workflow tracking
 * Support existing and new targets with tracking
 * Simplification of target classes

Change-Id: I036e4f2129d929db0a3b9a4baa87c946a4b194a9
2014-03-06 09:50:11 -08:00
Timo Tijhof 8735ea2ef9 mw.ViewPageTarget: Check elementsThatHadOurAccessKey before accessing
Follows-up I31d6b9ea065b3be85ed0.

Bug: 62329
Change-Id: I83a6f20cafd6193d64142914f72c1496d03294a5
2014-03-06 18:12:13 +01:00
Moriel Schottlender 89aecd54ba Deal with 'none'/'border' and default size in media edit
There are several conditions to defaultSize behavior of thumbnails and
frameless images and other images when it comes to default size. In the
same principle is 'border' which is not quite a type despite the fact
it 'behaves' as such in wikitext (and has a unique identifier that comes
instead of the other types.

This commit aims to organize this behavior for the user in an
understandable manner.

* Add 'basic' image type for images that have no specified type ('none')
* Handle the difference in 'default' size behavior between basic images
  and thumbnails/frameless. The thumb/frameless images have the default
  wiki size. Other images' default size is their original dimensions.
* Force wiki-configured default size for thumbnails and frameless images
  in the DM. This is done because at the moment Parsoid's output is of
  Wikipedia's default size rather than the local wiki's. The size is
  adapted if needed, directly in the DM.
* Added 'border' as a pseudo-type checkbox flag that sets css class
  'mw-image-border' is for parsoid rendering on save.
* Add 'make full size' to the size widget select and treat it as a faux
  default button for basic and frame images.

Bug: 62013
Bug: 62024
Bug: 61155
Bug: 61059
Bug: 61282
Change-Id: I6778705306f0dd6bb96afeb91383089a4ddab7ed
2014-03-05 03:53:46 +00:00
James D. Forrester 3efa7490d6 Add tooltip to page options menu widget in the toolbar
Currently "Page options" but better suggestions are welcome.

Bug: 61892
Change-Id: I5cf7a4cabaaf7a5d5d0bd1b806f8d95ea4d88033
2014-02-28 11:26:47 -08:00
jenkins-bot 66df1ec1b5 Merge "Track edits where user switched into wikitext editor from VE" 2014-02-27 01:35:56 +00:00
Krenair 952a239866 Track edits where user switched into wikitext editor from VE
By adding a tag called 'visualeditor-switched'.

Bug: 56465
Change-Id: I1426d300499b59ca55c9b97fc1560f4adbfa9295
2014-02-27 01:33:40 +00:00
James D. Forrester 0f45399082 Split up ext.visualEditor.mwcore into smaller parts
Core retains core functionality, including text styling and architectural
items like dialogs.

The new modules are:
* mwformatting
* mwimage
* mwlink
* mwmeta
* mwreference
* mwtransclusion

The new modules are loaded in ViewPageTarget (for desktop), except for
mwlinks which is included from MWTarget (for desktop and mobile), per the
needs of the Mobile team.

Also, mwgallery was moved to desktop-only loading status.

Some styles which were loaded in mwcore but only used in modules is now
loaded in said modules.

This does not split up ext.visualEditor.core yet, which is left as an
exercise for the fool-hardy.

Bug: 61075
Change-Id: I6374854eaa13af824c11078d2f7004dc8a211a30
2014-02-26 16:31:15 -08:00
Timo Tijhof 58c647e3ac Ensure we use our references to certain native or upstream methods
Checked:
 ve.cloneObject       (oo|OO).cloneObject
 ve.getObjectValues   (oo|OO).getObjectValues
 ve.getObjectKeys     Object.keys
 ve.compare           (oo|OO).compare
 ve.copy              (oo|OO).copy
 ve.isPlainObject     ($|jQuery).isPlainObject
 ve.isEmptyObject     ($|jQuery).isEmptyObject
 ve.isArray           Array.isArray
 ve.bind              ($|jQuery).proxy
 ve.indexOf           ($|jQuery).inArray
 ve.extendObject      ($|jQuery).extend

Fixed:
* ve.dm.MWBlockImageNode.js (added in Iebb2081de)
* ve.dm.MWInlineImageNode.js (aded in I62ec12a6b)
* ve.dm.MWConverter.test.js (added in I90273786a)
* ve.ui.MWMediaInsertDialog.js (added in Ia5ad9a8c0)
* ve.dm.MWTemplateSpecModel.js (added in Ic3eb66538)
* ve.init.mw.MobileViewTarget.js
* ve.init.mw.ViewPageTarget.js
* ve.init.mw.Target.js

Skipped:
* ve.init.mw.ViewPageTarget.init.js
  - Feature test (which is for the very references from ve.js
    being ensured in this commit).
  - Misc code using $.inArray (can't use ve.js yet since that
    isn't loaded yet there).

Change-Id: I73ae005d3692e871fdcaea938641558c0b98ec69
2014-02-20 22:30:29 +01:00
James D. Forrester 0b97870d8c Simplify new INDEX/NOINDEX language, order and panel order
Just say "Default" rather than "Like other pages in this namespace" (let's
put that in the help string/tooltip at some point); order the "default"
value between "yes" and "no" (like for TOC); make sure the panel for the
advanced settings is in the same position in the page menu as the meta-
data dialog.

Follow-up to I30d483b5b6c3df7e

Change-Id: I902eb4f8504866b2dcde32333cf365a59716c2ce
2014-02-20 02:44:08 +00:00
jenkins-bot 78bdbb4c43 Merge "Let users set __NOINDEX__ & __INDEX__ status" 2014-02-20 01:50:29 +00:00
James D. Forrester 051c3498ae Let users set __NOINDEX__ & __INDEX__ status
Add a trinary option to the page settings pane of the meta dialog that
lets users set the page to have __INDEX__, __NOINDEX__ or neither (and so
have the default behaviour).

Bug: 57167
Change-Id: I30d483b5b6c3df7ee56a52c744bbdc610a01873d
2014-02-19 17:48:03 -08:00
Roan Kattouw a7d5751c80 Move some non-skin-specific styles back into ve.ce.Node.css
Rules like "right-aligned images get float: right;" should
be in the generic image CSS, they're not skin-specific.

I haven't exactly teased apart what is and it's skin-specific,
this is just a first stab.

Change-Id: Ie374685d2c66e2275f7a98a590e563bf36da7f87
2014-02-20 00:12:48 +00:00
jenkins-bot 0d2ea63596 Merge "Use accesskey=s on the save buttons" 2014-02-19 21:42:13 +00:00
kaldari 9f1179938c Move some skin styling from ve.ce.Node.css to a shared skin css file
The styling of the image thumbnails should be controlled at the
skin level, not by the generic VE styles. Moving the thumb/figure
styles from ve.ce.Node.css to ViewPageTarget-shared.css. Otherwise
no changes to the styles themselves.

Also adding minerva (the mobile skin) to the list of supported skins.

Bug: 60542
Change-Id: I67ab6d5b91cee7e587f61df26e7dae74c1068788
2014-02-19 13:30:30 -08:00
Krenair ec8234f183 Use accesskey=s on the save buttons
Bug: 50897
Change-Id: I31d6b9ea065b3be85ed07fba7437bed71010512b
2014-02-19 19:34:13 +00:00
jenkins-bot 4944dff419 Merge "Let users set #REDIRECT and __STATICREDIRECT__ status" 2014-02-14 03:46:12 +00:00
Juliusz Gonera ae2f5134b2 Make MobileViewTarget scroll to desired section
Implements
https://wikimedia.mingle.thoughtworks.com/projects/mobile/cards/1626

Also, rename $el to $container so that it matches the docs.

Change-Id: I9f41ec6fb88f6f21e698553216ccf2c3231589c1
2014-02-13 00:22:53 +00:00
Juliusz Gonera a6b149decc Move restoreEditSection() to mw.Target
It can be reused in mw.ViewPageTarget and mw.MobileViewTarget.

Also, check if this.section is undefined instead of not null and update
docs. restoreEditSection() does not accept any arguments.

Change-Id: Ibbcf4cb936a89d3ae77bb61ee97b8ad00a8d8a53
2014-02-13 00:22:33 +00:00
James D. Forrester 5af9f61520 Let users set #REDIRECT and __STATICREDIRECT__ status
Adds setting and unsetting the #REDIRECT status of the page from the page
settings pane of the meta dialog, and toggle whether this is a static
redirect (i.e., it is not automatically changed when its target is moved).

If the page has a redirect set, the meta dialog will be shown on opening
the page so that users can adjust the redirect more swiftly.

Bug: 47328
Bug: 50878
Bug: 57173
Change-Id: Ibd89cf04486799f292b9fd045dae5bc23fcf6fd4
2014-02-12 15:24:12 -08:00
jenkins-bot 4ac1b42690 Merge "Add tooltips to the drop-down menus explaining what they do" 2014-02-12 22:10:32 +00:00
jenkins-bot 2f9c71edd3 Merge "(Stand back again) Even moar label manias! (label refactoring) + VE core update" 2014-02-12 22:08:27 +00:00
James D. Forrester e4f983356b Add tooltips to the drop-down menus explaining what they do
Needs Ic967b88d55daf48d365487e17f76488b3f02c60f to work properly.

Bug: 59719
Change-Id: I449be926e830de241a870d96bf30c835f60ca77d
2014-02-12 22:07:24 +00:00
Trevor Parscal eca0a08ad9 (Stand back again) Even moar label manias! (label refactoring) + VE core update
Update VE core submodule to master (84ced37) and update calling code
for changes in OOUI.

Depends on Ic967b88d55daf48d365487e17f76488b3f02c60f and Ib599b9bd5028e2df084fcc3da657aeb7f1569d2a

New changes:
94f03c3 Undefined variables first in selectNodes
62b5648 Localisation updates from https://translatewiki.net.
10c5a18 Don't descend into handlesOwnChildren nodes in selectNodes
4ed2432 Update jquery.client to MW's master (45192156d7)
d7e24b8 Localisation updates from https://translatewiki.net.
babb9da Localisation updates from https://translatewiki.net.
4639d18 Localisation updates from https://translatewiki.net.
a561537 Localisation updates from https://translatewiki.net.
8f7053a Localisation updates from https://translatewiki.net.
7112cc2 Update OOjs UI to v0.1.0-pre (a290673bbd)

Change-Id: Ie7d58472619509782f23a7dedc1ec27c3dcc7543
2014-02-12 14:05:23 -08:00
jenkins-bot b9aa9d2f27 Merge "Include edit status in the ve.deactivationComplete event" 2014-02-12 22:02:20 +00:00
Sam Smith 5ebacd389d Include edit status in the ve.deactivationComplete event
Rather than setting the wgPostEdit configuration variable when the
user uses VisualEditor, i.e. communicating via mutable global
state, include whether or not the user edited the page in the
ve.deactivationComplete event.

Bug: 52955
Change-Id: I0f5067550921008f74221d6c92882adfe404b3a5
2014-02-12 13:59:04 -08:00
jenkins-bot 25276e2a5a Merge "Fix margins after they were broken in 9d988924" 2014-02-12 21:12:02 +00:00
Ed Sanders c95e404a30 Give the document focus on save dialog open to resolve inspectors
Bug: 60837
Change-Id: I624a76f5d09db270e651ac004813acfba249f5f6
2014-02-12 14:14:23 +00:00
Trevor Parscal 79082ebf82 Fix margins after they were broken in 9d988924
Changes in MediaWiki core to the padding of div#content in Vector
(see 9d988924a0350228745375e074420a0e1214f7e3 ) made the toolbar in
VisualEditor's ViewPageTarget integration for Vector render incorrectly.

This adjusts the toolbar margins to match the changes in content padding.

Bug: 61224
Change-Id: Ie6b47f5d1929533669118ba51202c1fccda4a0d6
2014-02-11 23:08:58 +00:00
jenkins-bot 604d52244d Merge "Make this.loading abortable" 2014-02-08 00:25:40 +00:00
jenkins-bot c5157ac79a Merge "Fixes for 239bae7512 (mobile toolbar)" 2014-02-08 00:18:26 +00:00
Roan Kattouw 2cf871415b Make this.loading abortable
.then() removes the .abort() method from the promise, even though
we had return jqxhr; in the then() callback. So store xhr in
a variable and put the abort method back.

This fixes a JS error upon calling this.loading.abort();

Change-Id: I50460782e58399198bacc02d028984682ddbed56
2014-02-07 15:56:55 -08:00
jenkins-bot 814513113a Merge "Hide wikitext warning notification when the user removes the markup" 2014-02-07 22:54:56 +00:00
Roan Kattouw bb465b22a5 Fixes for 239bae7512 (mobile toolbar)
* Use correct class name for setUpToolbar() in MobileViewTarget
* Move shared setUpToolbar() code into ve.init.mw.Target
* Fix iconModuleStyles documentation, remove leading space

Change-Id: Icf5ed36fd817837c0434db8202bef8a78e6cb898
2014-02-07 14:15:17 -08:00
jrobson 684c9887cd Fix toolbar placement
The selector is too weak and results in the toolbar being placed
in positions it shouldn't be! Whoopsy!

Change-Id: I63540130e4de01f9326fe110d606985fea70b644
2014-02-07 11:09:10 -08:00
jenkins-bot c93f54e1b8 Merge "Fix crashes in onLoadError()" 2014-02-07 18:34:31 +00:00
jrobson 239bae7512 Allow better toolbar customisation for VisualEditor
The toolbar in very desktop vector skin specific
In mobile we want to have more control over the toolbar,
and its placement.
* Thus make setUpToolbar abstract
And move the function to ViewPageTarget

* Introduce ve.init.mw.Target.static.iconModuleStyles to
allow the use of different icons
* Update the mobile toolbar to only have B and I tools

Change-Id: I4c72b4b9128b3a74de8b8b5bce7664fbb315216b
2014-02-06 15:45:08 -08:00
Ed Sanders cf62801694 Move paste rules to Target
Because ViewPageTarget isn't always loaded.

Bug: 60912
Change-Id: I16bd6a329120b3dd7dcb0de3e76e69e84c18553f
2014-02-06 22:41:51 +00:00