Commit graph

322 commits

Author SHA1 Message Date
jenkins-bot 30d8bf60f1 Merge "ViewPageTarget#onSaveErrorSpamBlacklist: Use mw.language.listToText now it exists" 2014-11-19 11:06:01 +00:00
Roan Kattouw bb6e01c488 Fix back button not exiting VE
When you clicked the Back button in the browser, the URL
in the address bar would change (removing veaction=edit),
but we would not go back to read mode. This was broken
by 5c0c11753 almost a month ago but apparently no one noticed.

This is because 5c0c11753 moved the pushState() calls to
be earlier (in init init), making the replaceState() call
in the ViewPageTarget constructor (which is there
specifically for this bug) run too late in those cases.

The simplest way to fix this is to duplicate these replaceState()
calls before the pushState() calls in init init.
I feel a bit bad about copying code, but not very bad
because the code I'm copying already has a FIXME comment
about how there should be a better way :P

Change-Id: I6627a5d1d9377ae815bc58bceeb059ce9f4f19ab
2014-11-19 02:07:41 +00:00
jenkins-bot aa44c8916b Merge "Consistently use location as global, and location.href for full url" 2014-11-19 02:00:35 +00:00
Timo Tijhof c0692af5f7 Use history as global instead of via window
Just like DOM interfaces such as document and location. And JS
constructors like Object.prototype, and libs like jQuery.
No need for the window host object.

Change-Id: Ie39aaea2ca17bdec5fb3afe32a4e6c9f751bd0c6
2014-11-19 01:12:11 +00:00
Timo Tijhof 82657727f9 Consistently use location as global, and location.href for full url
The location object is a global, just like document.

Using it via 'window' needlessly adds complexity and, for example,
makes it harder to catch typos in static analysis.

Standardise on location.href in place of the many different
variants for accessing and assinging the full url:

 location =
 location.href =
 location.assign() =

And each with 'window', 'document' and without host object.

Change-Id: If88515bd88fc5b93ebacd4ec41fce02fec540f18
2014-11-19 00:20:08 +00:00
James D. Forrester 6b61addd06 ViewPageTarget#onSaveErrorSpamBlacklist: Use mw.language.listToText now it exists
Change-Id: I1289c43ea4be1cd9dc1addb7c765d7050b311d8d
2014-11-18 14:22:30 -08:00
Alex Monk ac6f6caeac On save, if there was no 'last modified' text at the bottom of the page, add it
Just hope that wgMaxCredits is 0.

Change-Id: Idf4a7cceb0650eaec4442244066d875a3ff38e06
2014-11-17 01:18:46 +00:00
Alex Monk ff3d76f488 Don't try to get newtimestamp from edit if no change was made
ApiEditPage can give us 'nochange' instead of the
'oldrevid'/'newrevid'/'newtimestamp' keys if we gave it a null edit.

Bug: 73463
Change-Id: Ic22597dfed11de3823471673404090a9bce12928
2014-11-17 01:03:00 +00:00
jenkins-bot ed7cfa1207 Merge "When saving, return the full contentSub to the client" 2014-11-13 20:45:09 +00:00
Alex Monk 581d1350e6 When saving, return the full contentSub to the client
And introduce code to make FlaggedRevs add its notices to contentSub.

Bug: 60718
Change-Id: Ibb91dc563ccf73d3b4bd1994134ccf02634fccb5
2014-11-12 17:36:59 +00:00
Alex Monk ba81c45da9 Restore selection after closing save dialog
Also simplify some weird focus code in MWSaveDialog

Bug: 72911
Change-Id: Ifb8fd9be96a199f86412247211e3920a35dd22bf
2014-11-11 23:55:39 +00:00
Roan Kattouw 9533c378ea Remove last usage of ve.bind() in VE-MW
Change-Id: Ia645e3d599da9b65b71dbe67f82b7c0fa3be1683
2014-11-10 15:45:09 -05:00
Catrope c8396eb65f Revert "Clear selection after tearing down surface to work around Firefox bug"
Superseded by I051ef92eeea9 in VE core.

This reverts commit d68eae6c8d.

Change-Id: Ie5e0a6169cfe3634e20a3b88e8aeb980b4094e10
2014-11-04 17:20:30 -08:00
Alex Monk b2af92870a Update "page was last modified on date, at time" footer line when saving
Bug: 52403
Change-Id: I11e00066000e927f0551691d05fe11fe2ae125b0
2014-10-31 01:00:04 +00:00
Alex Monk b71bb51171 Remove more references to ve.bind
Seems some of them have crept back in since I1a7fc7f2 (and we missed one somehow)

Bug: 72156
Change-Id: I5631fb7d5963d06aeb238c1daa44344b2060ef1a
2014-10-30 20:55:44 +00:00
jenkins-bot 3806a2838c Merge "Clear selection after tearing down surface to work around Firefox bug" 2014-10-29 23:21:36 +00:00
Bartosz Dziewoński 2a55baaef7 Hide page status indicators even if they aren't :visible
The container is zero-height and zero-width, so jQuery doesn't
consider it :visible, and yet it still takes up visual space.

Bug: 72693
Change-Id: I3bed5394a2a64a9f7f0a331f850aa412b5b11b7d
2014-10-29 21:52:38 +01:00
Roan Kattouw d68eae6c8d Clear selection after tearing down surface to work around Firefox bug
Bug: 71852
Change-Id: I3b4f0f755ece5c9e5444f8abadb1950a3f4ef318
2014-10-28 11:23:06 -07:00
Ed Sanders ab365ccacc Fix selection check in wikitext warning
Change-Id: I2f084eb4ee29bd166b05163cd2d6e64e0a4f136d
2014-10-27 16:21:24 +00:00
jenkins-bot 5d6ee06b84 Merge "Fix wikitext warning: Get range from selection before trying to find start" 2014-10-24 17:27:44 +00:00
Alex Monk 4639a1c044 Fix wikitext warning: Get range from selection before trying to find start
Bug: 72475
Change-Id: Ib43d9c6b9b46be461354b3b5bbdf9d5de90887a6
2014-10-24 17:18:08 +01:00
suchetag 5c0c117537 Make spinner appear immediately when clicking edit
Moved the spinner code from ViewPageTarget to ViewPageTarget.init to make it appear immediately on clicking edit.
Bonus: also fixes the URL to add the parameter vesection when clicking a section edit link.

Bug: 65453
Change-Id: Ica33de675203cc0f0594b8362731c4e98a644313
2014-10-22 03:20:40 +05:30
Bartosz Dziewoński c81ed82fa8 Add rudimentary support for page status indicators
Just hide them when opening the editor and show again afterwards. Will
need Parsoid for proper support.

Corresponding patch in core: I2389ff9a5332a2b1d033eb75f0946e5241cfaaf4.

Bug: 23796
Change-Id: I3ce5e7869be50dcd189ca24e2b3d7ebc62de4fc4
2014-09-29 13:45:10 +02:00
jenkins-bot 3d0aae0dcd Merge "Stop "Edit pages on double click" from affecting VE" 2014-09-25 22:52:19 +00:00
Alex Monk 77fc7e7d6c Stop "Edit pages on double click" from affecting VE
Relies on I0f6225b2

Bug: 53058
Change-Id: Ibd363dfb9da7d91055c541a83969d23401297603
2014-09-25 21:19:18 +01:00
Roan Kattouw 8517777b9f Update VE core submodule to master (8d5ec7a)
New changes:
8d5ec7a [BREAKING CHANGE] Rename ve.Document.getNodeFromOffset to getBranchNodeFromOffset

Local changes:
* Update calls for rename of getNodeFromOffset to getBranchNodeFromOffset

Change-Id: Ibc69f5a5deeed5698368bb19b30f14497c579e90
2014-09-24 11:34:14 -07:00
Alex Monk 65b232a35b Show pending state on action button and keep dialog open when switching to source mode
Instead of doing a blocking overlay, we're simply keeping the dialog open,
which is necessary for the pending status of the action buttons anyway.

Requires Ib2c8f336 in OOUI

Bug: 65012
Change-Id: I65b5de4a1666a81b157a71f6fec490007689eb44
2014-09-15 20:44:55 +01:00
Alex Monk 14b23d7ba4 Make sure mediawiki.notification is loaded -before- calling ViewPageTarget#checkForWikitextWarning
That function needs to return the result immediately, not wait for module loading (via mw.notify).
This was breaking us being able to keep track of what wikitextWarning object was in use (but only
the first time we used the module), and therefore fail to close the warning when the wikitext
disappeared.

Bug: 70168
Change-Id: I0f1427423a5fe82ec8e70e2f0462a3044ca7ace8
2014-08-29 21:18:24 +01:00
jenkins-bot 3286115c21 Merge "Return undefined, not null from onbeforeunload" 2014-08-28 23:11:30 +00:00
Roan Kattouw f0cadeca42 Return undefined, not null from onbeforeunload
IE doesn't accept null as a "do nothing" value, only undefined.
If you return null, it'll show a popup with the text "null".

Change-Id: I984a7ded483c4c178cbca2a9af9abd895e6ded56
2014-08-28 14:38:49 -07:00
Alex Monk 2748366a8e Pick up 'summary' parameter from URL to use as initial edit summary
To match the wikitext editor

Bug: 69501
Change-Id: I3cfc269aa344d89cc30af29699aca70eda5565e2
2014-08-28 02:56:14 +01:00
James D. Forrester a232147b11 Switch 'disallowQuotedKeysInObjects' jscs rule on and fix up
Change-Id: I75ac4b378ef485feead9d0eff34ed7877b94b5d0
2014-08-22 13:50:48 -07:00
jenkins-bot bea941d213 Merge "Followup 67f304a: use .openWindow(), not .open(), to open save dialog" 2014-08-21 19:06:16 +00:00
Roan Kattouw e33bcb02cc Followup 67f304a: use .openWindow(), not .open(), to open save dialog
Calling .open() directly doesn't work any more.

Change-Id: I986ad063f7b83992a8f96969ccb5f7e08fb9f386
2014-08-21 12:00:40 -07:00
Bartosz Dziewoński 8bb55d683b mw.ViewPageTarget: Be more careful when updating page title
If there is more than one span in #firstHeading, we only want to
update the first one.

This will still break if something inserts elements *before* the title
span, but fixing that would take more thought (we probably should
rebuild the entire heading element and fire 'wikipage.content' on it).

Bug: 69857
Change-Id: Id78b9b8275a57c9b3f3f1dbd0aaca356f94d0f03
2014-08-21 18:36:01 +02:00
Sam Smith 33ef289190 Reinstate the ve-ui-toolbar-saveButton class
The class provided a minimal coupling to the firsteditve guided tour,
which used it to attach a guider to the "Save page" button.

The class was removed in I30dc7020121f0dd6907b61ef674a7cb14eb00652.

Bug: 69784
Change-Id: I81fdc4f2fa41c86a6481cf478c154b5d6c99d41d
2014-08-20 17:39:40 +01:00
Alex Monk 1468ab8277 Don't show PostEdit message if we made a null edit
Bug: 51243
Change-Id: I63b2405c854e2953976dc8ca7a5a136308a7dcf0
2014-07-29 17:42:57 -07:00
jenkins-bot e49138a8c6 Merge "Actually clear diff viewer after closing save dialog and changing document" 2014-07-26 00:11:16 +00:00
Roan Kattouw a6d94256d8 Actually clear diff viewer after closing save dialog and changing document
The window refactor removed the 'teardown' event from windows,
but ViewPageTarget was still listening to this event on the save dialog.
Instead, use the opening promise to be notified when the save dialog
closes and call onSaveDialogClose() at that time.

Change-Id: I31a9a359eb14a56b214a1240db08632bda6bc8b9
2014-07-25 13:14:07 -07:00
Alex Monk 14753500a6 Don't overwrite #contentSub just to try to get the correct subtitle for redirects
Because this breaks other subtitles such as subpage breadcrumbs
Instead, deal with the #redirectsub (added in I780c965) directly.

Bug: 68432
Change-Id: I646868916a4480404f6d466fd89f84798d0e9df5
2014-07-25 18:57:08 +01:00
Roan Kattouw 35e611369b Followup 3dd1a996: don't try to switch to source mode when surface is torn down
If you saved a change, then clicked Edit source, you'd get a JS error.

Change-Id: I589f9edb354afcd47d5c42ef9a6c73d49218b044
2014-07-22 17:29:31 -07:00
Alex Monk de2d5bd31b Don't confirm if there's no changes when switching to edit source mode through the page options menu
Also use a simpler way to discard changes

Bug: 68229
Change-Id: I1efc40f14fca0f743df699a4f3aadd4ba3a249e2
2014-07-23 00:23:53 +00:00
James D. Forrester c2f37a0450 test: Move mw into the global list of globals for VE-MW
Silly to have 38 MW-specific files needing to declare that they're using mw.

Change-Id: I97891ed922fe0c37d8c96425a4d23bd15098438b
2014-07-19 17:42:45 +00:00
James D. Forrester cc089d6bd3 Scrap the cancel button from the toolbar
It's unnecessary, big and ugly, way too close to an actually useful button, and
adds oodles of complexity to the mire that is VPT without significant user benefit
whilst taking up an unjustifiably huge amount of the already-over-burdened space.
This means that the minimum browser width for English on default Vector to show
the toolbar correctly is now 945px, down from 1029px.

Bonuses: fix MWCancelConfirmDialog's cancel button to be destructive (it is) and
remove a now-recently-fixed comment asking for the save button to be styled using
a generic class (provided by the constructive flag).

Change-Id: I30dc7020121f0dd6907b61ef674a7cb14eb00652
2014-07-18 16:38:17 -07:00
jenkins-bot 20205b1e99 Merge "Set title of page to use if discarding changes when changing to the wikitext editor" 2014-07-17 00:08:58 +00:00
Trevor Parscal 49ffef5a0f Close the save dialog on teardown only, not on save
Closing a dialog with specific data means closing it again with
potentially different data, while the dialog is already closing, means
someone wins and someone looses. Silently failing in this case is bad,
because if the first close call was a cancel, producing no side effects,
but the second close call would have produced some side effect, the side
effect would never occur.

The problem here really was that the save dialog needs to be closed
before we can destroy the surface so we can uphold the assumption that
hold and teardown processes are operating on an attached DOM.

The solution is to automatically close the save dialog on teardown,
rather than on save. Since save triggers teardown, this has and identical
user experience.

Bug: 68048
Change-Id: I669448739f168737d4eddd6496189a819ce894b1
2014-07-16 23:51:58 +00:00
Trevor Parscal 1be1c469de Enable mwreference, mwtransclusion modules on all targets including mobile
Bug: 67701
Change-Id: Icdf2a208c9efa7abd897d48aed02bf923328d53c
2014-07-16 22:40:00 +00:00
Alex Monk c1c80f6985 Set title of page to use if discarding changes when changing to the wikitext editor
Turns out it's a bad idea to do most testing on the default page

Bug: 68121
Change-Id: Ie9729dba4e8ca690625a6553703e9ff30cb5106e
2014-07-16 23:15:26 +01:00
jenkins-bot de9491ea0e Merge "Make a message dialog for cancelling VE" 2014-07-16 20:45:28 +00:00
Alex Monk b9ad2fb406 Don't allow document save if we're already tearing down the surface
Otherwise you get "Uncaught TypeError: Cannot read property 'messages' of null"
if you press the save button late enough in the saving process. The bug refers
to a different error which I have not been able to reproduce.

Bug: 68073
Change-Id: Ia8fa325f1450329b6e0e4ee9af5302aa4857d637
2014-07-16 17:52:00 +01:00