Commit graph

122 commits

Author SHA1 Message Date
Alex Monk d24fd1e389 Don't show unsaved-changes warning if user has already saved in wikitext dialog
Add an extra surface check - makes sure it's attached.

Change-Id: I1720ba18b5966549fefb839013776ac9dfe0468a
2016-08-17 21:12:00 -07:00
Ed Sanders c452e134cc Wikitext surface alpha feature
Edit wikitext with the VE interace.

Bug: T104479
Bug: T142138
Change-Id: Ic95b47e0dd378578555c4a2342ca9c87064ed1d5
2016-08-12 18:37:29 +00:00
David Lynch 87ea771ae6 Centralize some checks for unmodified left clicks
Change-Id: I59cee4da9bbca4c8a29eaf9d52cb00ab6e70b670
Depends-On: I4f164f7cf1d755c3662571b2a1a8371d9fe756f9
2016-08-11 13:33:26 -07:00
jenkins-bot cf4c2d41b3 Merge "Rewrite TOCWidget based on Linker::generateTOC" 2016-08-05 22:18:22 +00:00
Ed Sanders bb7b38575f Rewrite TOCWidget based on Linker::generateTOC
Use the new node cache to find headings.

Change-Id: I5eb75c5db5ca466fd6f16a57c693c2a4458cff7c
2016-08-05 14:11:15 -07:00
Roan Kattouw 5483b25657 Reduce mayhem caused by ?oldid=currentRevId
If you viewed a page with an ?oldid= query parameter set to the ID
of the current revision, some parts of VE would believe we were
in oldid mode (because there's an oldid present), but others
wouldn't (because the revid we're editing equals the newest revid).
This caused bugs when opening the editor a second time after saving
(which is normally impossible to do after an oldid-mode edit, because
we navigate to a new page after an oldid save, but we don't do that
in this case).

Ensure that:
* The internal state of DesktopArticleTarget is updated correctly
  after saving in this case
* The ?oldid= parameter is removed from the URL after saving
* DesktopArticleTarget.init doesn't preload the article HTML
  on a second/subsequent editor load: this causes issues because
  it caches the oldid, and generally speaking the Target's internal
  state is not considered

Bug: T141330
Change-Id: I74034328797c59f7249f1f6f4f53a92ee1c26334
2016-07-25 20:04:47 -07:00
David Lynch e9b99d8181 MWSaveDialog: Give checkboxes a class based on their origin's name
Bug: T138631
Change-Id: I2c31becd57c7988c4dd26c09ee01b4f7820c7aaa
2016-07-19 11:21:36 -05:00
Ed Sanders e50aa6fa34 Pass ve.dm.Document to addSurface as documented
Change-Id: Ic4ef3763e20d0f954e21dd651309b0e9eee65fd2
2016-07-18 11:13:54 +01:00
jenkins-bot dc59190e64 Merge "Set an automatic summary of empty string when switching from VE into WTE" 2016-06-29 16:16:57 +00:00
jenkins-bot 0d45972cb3 Merge "Fix our display of redirects during and after editing" 2016-06-29 16:15:43 +00:00
Alex Monk 984823a77d Replace section edit click handlers in DAT instead of doing it badly in init
If you deactivate without saving (e.g. using the back button), the page
contents aren't replaced and so adding the page click handlers is pointless
and harmful because they will run twice.

This was my fault in Iad1713e1

Bug: T135387
Change-Id: I3c83009bfc0f42125cdcde7f7a51de9bc2f72abf
2016-06-29 03:58:57 +01:00
Alex Monk 4382e18385 Fix our display of redirects during and after editing
Change-Id: Ib559eb8fb8a2643af25ad8df858212f3e9d14b13
2016-06-15 20:25:59 +01:00
Alex Monk 3bda9a75aa Set an automatic summary of empty string when switching from VE into WTE
So if the user supplies a summary in VE, WTE with the "Prompt me when entering
a blank edit summary" preference won't moan.

Bug: T135979
Change-Id: I0e2d2b6f8fb03bb56d600f1118daf82fb3715b66
2016-06-15 18:37:56 +01:00
Alex Monk 9900d42816 On serialization failure, reset document opacity.
In case we were switching to source.
Normally MWWikitextSwitchConfirmDialog#getActionProcess would do this for us,
but this closeWindow call doesn't trigger that, we can't get it by overriding
MWWikitextSwitchConfirmDialog#close either.

Bug: T134333
Change-Id: I66a12ff6d13601250b9d470e1be54fe38a1ef06c
2016-06-13 23:45:43 +01:00
jenkins-bot 6a6d3b9368 Merge "Fix loading bar opacity" 2016-06-07 14:07:48 +00:00
jenkins-bot 6e6d2bf66b Merge "Move $editableContent computation into overridable method" 2016-06-01 17:40:15 +00:00
Ed Sanders 538959dc49 Move $editableContent computation into overridable method
Change-Id: Ibb0b877a01f8982fb895616c4c0d3e897bf37c85
2016-06-01 09:58:17 -07:00
Ed Sanders 0a0ca68d62 Simplify teardown of toolbar save button
Bug: T136421
Change-Id: I6829ad75b93c6aa6c6db51b5c9cd84915c75cdb8
2016-06-01 17:52:58 +01:00
Ed Sanders b33cd5d8f1 Fix loading bar opacity
* Ensure ve-loading isn't removed early
* Quickly detach then reattach the loading bar during
  activation so it doesn't get moved and marked as original content

Change-Id: I263c9627348953a11966f8bcc435d0d89b0b6084
2016-06-01 14:52:57 +01:00
jenkins-bot 337109fef1 Merge "Un-blacklist Firefox versions 12,13,14" 2016-05-31 16:55:38 +00:00
Ed Sanders 20fa650a6b Un-blacklist Firefox versions 12,13,14
T52720 (link corruption in FF13/14) appears to be fixed.
T52780 (editor not loading in FF11/12) appears to be fixed.

FF11 has a new issue where templates are normalised even
when not touched (T136607)

Change-Id: I34358e3d90b8186e6b89c04c038ab79c908fc81b
2016-05-31 09:46:50 -07:00
Ed Sanders 4d466f16b5 Add fallback selectors if image page has no existing local content
Change-Id: I1fac3b35b5d498115c96b07c29cf409be72a1389
2016-05-31 16:42:21 +01:00
Ed Sanders d6a770bb4d Remove unused namespace class
Introduced recently but then abandoned.

Change-Id: Ifa999f0e60fe1b6d68c63813025c9fd48b79ad5f
2016-05-28 20:54:24 +01:00
Alex Monk afd5944bde Followup I9280fe4d: Merge main case with default, they are identical
Change-Id: I280f0eba1c99f5e96ffe5466e8398115fbc5f4f8
2016-05-26 18:15:27 +01:00
James D. Forrester 1b9427c5dd Follow-up 1dc933be: Don't fatal when editing non-NS0/6/14 pages
Change-Id: I9280fe4d771cf7ce1ee3874a34d7a14b672b222c
2016-05-26 09:07:07 -07:00
Ed Sanders 1c5c1fc6b9 Append surface & toolbar components in the correct places
Use setSurface and setupToolbar to position the surface and the
toolbar save button in the DOM.

Change-Id: Ide634848f4e78501724c358bcb1fdab8abd491b9
2016-05-26 08:50:21 -07:00
Ed Sanders 1dc933bead Genericise target initialisation across namespaces
Define $editableContent on target construction, and mark
all non-ancestor nodes between that at the target container
as uneditable (50% opacity, no pointer events).

Bug: T58289
Change-Id: I7fe51104bd5aa1bd53ffc604e5f02752c7553578
2016-05-25 12:50:36 +01:00
Alex Monk 8c3dc0887d Don't show tab preference dialog again if it's already been shown
Bug: T135534
Change-Id: Ifecac607acccc0e18e61b07e8456566d4671aa1b
2016-05-20 02:36:25 +01:00
Alex Monk 1ba035e053 Fix deactivating VE after user explicitly decideas to discard changes
Bug: T134794
Change-Id: Idf1941793317a6aff9fe57082b85e3ebff0c72b4
2016-05-10 23:39:57 +01:00
Alex Monk 3c55bfbb80 Add a hidden link with accesskey=v in SET prefer-wt mode and remember-last wikitext
Try to tidy up a bit of code in DAT.init.js as well

Bug: T116406
Change-Id: Iad1713e14ea1f982886ba06e0b722c554ab2b892
2016-05-01 21:01:57 +01:00
jenkins-bot 80636c235e Merge "Add a popup after switching into VE from WTE" 2016-04-25 22:42:55 +00:00
Ed Sanders 6efd583ff7 Add method that runs after activation, for overriding
Change-Id: I046583e61f328baddb0c09eaff122e991c85f992
2016-04-22 17:17:56 +01:00
Ed Sanders 7a007e2874 Create MW targets using a factory
Move the existing static property 'name' to 'trackingName'
to make way for a real registry index.

Change-Id: Iab0d5be611ece7038234551c4847b07517b4348d
2016-04-21 21:06:39 +01:00
Alex Monk 0bbe2e38ee Add a popup after switching into VE from WTE
Bug: T131066
Change-Id: I2294da7d09dfbacb9187aba5e6e703511cec3c9f
2016-04-20 18:46:00 -07:00
Ed Sanders a6aa6daa28 Defer before restoring scroll position, and allow 0
Bug: T131791
Change-Id: Id48b913effe5313c193ce62b19faf5655278ff6d
2016-04-19 21:42:09 +01:00
jenkins-bot d4f9a85f27 Merge "Set mw.libs.ve.EditingTabDialog.static.message instead of passing it to setup data" 2016-04-17 17:49:28 +00:00
jenkins-bot 227de9cfef Merge "Close VE SET dialog when we deactivate" 2016-04-17 17:43:01 +00:00
jenkins-bot 299027e528 Merge "Don't select edit tab when VE is opened while user has prefer-wt pref" 2016-04-17 17:39:56 +00:00
Alex Monk 4ccc1ad5af Don't select edit tab when VE is opened while user has prefer-wt pref
You can still open VE with prefer-wt mode by going to veaction=edit, and
T116406 proposes making it accessible with a keyboard shortcut as well.

Change-Id: Ifc25b5147a96a200ac3a7de465d5cdf67e2e255b
2016-04-15 02:37:46 +01:00
Ed Sanders 011ff4e133 Replace transitionend event with setTimeout
transitionend events seem like a neater solution, but we should
migrate all of our code at once, and provide a polyfill for
browsers which don't support it (IE9).

Change-Id: If6ae030856f8e69cc8bb26f21bfed30d5d22775c
2016-04-14 16:21:41 +01:00
Alex Monk f3c5e2f410 Set mw.libs.ve.EditingTabDialog.static.message instead of passing it to setup data
Change-Id: I2bfb79e258253e00c9f856bbbb3c4efae55a128c
2016-04-13 22:46:14 +01:00
Alex Monk 47cfc03d72 Close VE SET dialog when we deactivate
You can trigger deactivation by browsing back.

Bug: T132494
Change-Id: I8f66e22a745d84a3ca4b144c389c3ae654974789
2016-04-13 22:41:27 +01:00
jenkins-bot 5dc1257507 Merge "More minor/watch checkbox state computation server-side" 2016-04-11 14:18:56 +00:00
Ed Sanders f342dc01c3 Adjust DOM and CSS so UI surface runs from top to bottom of page
Place things like the page title and redirect link inside a new
container $originalContent, which is appended to the surface
when ready. Replace margins with padding in various places.

This will allow us to surface-height-matching sidebar for dialogs.

Change-Id: I60d80fb303bdaf93e9d121f62d534ee3a3056e59
2016-04-11 13:18:36 +01:00
Roan Kattouw 12eb41acff More minor/watch checkbox state computation server-side
Following through on my threat from 72b0d2a19c (November 2013).

Change-Id: I0daeef2a0373bbdb06627053e9d726d6fc20a3f6
2016-04-08 18:02:01 -07:00
Alex Monk 7788aece55 After saving and setting HTML, set single-editor edit section handlers again
Change-Id: I6e0962271e7e1460abbe82864b47fddc5bd7f235
2016-04-02 09:53:25 +03:00
Alex Monk 4210c4bee0 Use veaction=edit in URL instead of action=edit when we're using multiple tabs
TODO: What about prefer-wt users switching from WTE?

Bug: T131064
Change-Id: I9aa701cbda3964decb8b1ee853c0a281567a0ccb
2016-03-30 02:54:01 +01:00
Alex Monk b1aebf0b48 Don't strip namespace from text that we replace firstHeading with
wgTitle is basically just $title->getText()
wgPageName is $title->getPrefixedDBkey()

So we need to take wgPageName and run getPrefixedText (difference is underscores
get replaced by spaces)

Change-Id: Ib99f0d20f1ba99338f80bbbf39cffd544887c3fa
2016-03-25 04:45:09 +00:00
Alex Monk 2063025237 Don't change focus to VE surface if we're opening the SET dialog
Bug: T130552
Change-Id: Idc4639bb3f51690a827bdbdb0419e9303dd39a1b
2016-03-23 01:08:32 +00:00
jenkins-bot 4e4684e7d0 Merge "Show redirect target inside target" 2016-03-17 22:54:39 +00:00