Commit graph

1394 commits

Author SHA1 Message Date
Bartosz Dziewoński 600e369347 iOS browser menu bar tap stealing hack for bottom contexts
Change-Id: I7607bef4253fde894e307bcecaac6bd342864c0c
2019-06-14 23:49:38 +02:00
Ed Sanders df8feb6faf Move mobile context to bottom of page
Hidden behind ve.newMobileContext feature flag.

Bug: T204733
Depends-On: Id276686a0e82c12c457c81eaec9939722c65c7ec
Depends-On: Id5f7ead769dc30c0fbd2a8b8f6f6c4d68dcfabac
Change-Id: Ibd4b699dfe4bb9bcaec6898b6b82357eb287d128
2019-06-14 20:57:22 +00:00
Bartosz Dziewoński a68cc38b22 Avoid setting '&section' (with no equals or value) when switching to OWE
mw.Uri requires undefined rather than null to unset a parameter;
null instead generates a parameter with no value (and no equals sign).
Our own code in ve.init.mw.DesktopArticleTarget.init.js parseSection()
can't parse that and causes an exception.

Change-Id: I783ea6b91c115b79bbd9deac6669bea0661139af
2019-06-14 20:20:26 +02:00
jenkins-bot ed6d540289 Merge "MobileArticleTarget: Update loading interface for new design" 2019-06-13 20:00:34 +00:00
jenkins-bot 9114e5403b Merge "Reorder calls so that window is scrollable when trying to scroll to section" 2019-06-11 22:18:13 +00:00
Bartosz Dziewoński baa8bcb476 Reorder calls so that window is scrollable when trying to scroll to section
Bug: T225292
Change-Id: I07d899098cff13cf4f8224c45f118290bc392c53
2019-06-11 22:02:39 +00:00
Ed Sanders 7ad624f0a3 Remove switch confirm dialogs
Bug: T220007
Change-Id: I81b39a02d573d96bcb6b4238aabbcd077e874906
2019-06-11 22:35:34 +02:00
Bartosz Dziewoński eb8aede95f MobileArticleTarget: Update loading interface for new design
* Remove animation for toolbar sliding into place. It now happens on
  the fake toolbar in MobileFrontend shown before the real toolbar
  loads, and our toolbar just transparently replaces it.

Bug: T217784
Depends-On: If21aa0ea619ec2500ce5fca6fe81eb27f26bb047
Change-Id: Ib6ff7594e1982d1b46e9ca89d6b9722d025e8207
2019-06-05 12:43:33 -04:00
Bartosz Dziewoński f48b5bcc9a MobileArticleTarget: Fix silly indirection via a global variable
Change-Id: I71349313b493c18cebe30df0b1b03defe81bb80e
2019-06-05 16:40:18 +00:00
Bartosz Dziewoński 9cbc22c70d MobileArticleTarget: Remove a method that just calls the parent
Follow-up to 500462f4b2.

Change-Id: I1916a58b8814d1f03a14a35881f531d9de319736
2019-06-04 15:52:13 -04:00
Bartosz Dziewoński 4184d44dc5 MobileArticleTarget: Remove duplicate way to trigger abandon warnings
Abandon warnings are already handled by the code in MobileFrontend's
EditorOverlayBase. Using window.history.back() causes that code to run.
Having a duplicate way to trigger them only results in inconsistencies
because our dialogs animate in a different way.

Bug: T222315
Change-Id: I19c5616a6aeecf0ac63f37a564ef44f11df010b0
2019-06-04 15:50:59 -04:00
Ed Sanders b1ac5b74d3 Update VE core submodule to master (06f1ebb8e)
New changes:
06f1ebb8e Local/SessionStorage refactor

Local changes:
* Update for core storage refactor

Depends-On: I3cc1d5adfbce794e8345b7f1090c10fb0d42d150
Change-Id: If855ee33b0993788cc159d8c3acf03070e6a9566
2019-05-29 14:49:53 -07:00
jenkins-bot 795e7b13fb Merge "Special-case redlink URLs to load preferred editor" 2019-05-28 23:21:28 +00:00
Ed Sanders 4a692e762d Special-case redlink URLs to load preferred editor
In general action=edit could be bound to a wikitext-specific
edit link, but in the case of redlinks we can use the
preferred editor instead.

Bug: T223793
Change-Id: Ib0851e9e2ce441ae93311153801e2c3de0a2063d
2019-05-26 17:55:38 +01:00
Ed Sanders 5b4158860a 'scrollCursorIntoView' -> 'scrollSelectionIntoView'
Change-Id: I202b1bdb3196b318c26422577b66de66d37080c8
Depends-On: Iac446ce9fce170b43c96001ca89e8af4825522ca
2019-05-24 10:11:38 +00:00
jenkins-bot 603223152c Merge "Replace call to setToolbarHeight with setPadding" 2019-05-23 18:25:46 +00:00
Ed Sanders 617e4d8d61 Replace call to setToolbarHeight with setPadding
Bug: T224126
Depends-On: Id5f7ead769dc30c0fbd2a8b8f6f6c4d68dcfabac
Change-Id: I140cdb320dbb0368bc36a0a0210523937b9f7dea
2019-05-23 18:11:03 +00:00
jenkins-bot 9482cc3ec5 Merge "Debounce calls to 'adjustContentPadding'" 2019-05-23 17:57:14 +00:00
Ed Sanders 9bc0383733 Debounce calls to 'adjustContentPadding'
Change-Id: I045ad541c5997a7d9c0f24b4e097057524756def
2019-05-22 15:06:12 +01:00
Ed Sanders 4beab42217 Switch to wikitext: Don't set oldid if unmodified current ID
Bug: T223651
Change-Id: I5a896cd98d304c419e61c5f56adb6175bc1c72a8
2019-05-22 14:32:54 +01:00
Ed Sanders 47af04b8d9 MobileCollabTarget: Cleanup toolbar
Change-Id: I4b2e21ce61cb647ca6a74bdbdd8def614ed41341
2019-05-14 20:19:54 +01:00
Bartosz Dziewoński aadec90f0f DesktopArticleTarget.init: Fix wrong message used for 'Edit' tab in rare cases
If a new namespace was added to $wgVisualEditorAvailableNamespaces,
but VE was loaded on a page with old cached HTML, the 'Edit' tab's
text would incorrectly be 'Edit source'.

If $wgVisualEditorTabMessages['edit'] or ...['create'] was changed
from non-null to null, but VE was loaded on a page with old cached
HTML, the tab would still use the old text.

Change-Id: I2d5c7b922ba480eb90fa0a6da7a1901f062c96df
2019-05-14 00:19:08 +02:00
Bartosz Dziewoński a76d3daf54 DesktopArticleTarget.init: Allow veaction=edit to override namespace settings
Prior to 80bfbfc54b this worked by
accident, and with a number of bugs depending on your settings (see
T219457). It turns out that Wikipedia users have invented various
workflows that depended on this bug (mostly involving sandbox pages in
namespaces where VE is not enabled). Restore it as a supported
feature, and in a way that avoids the problems it previously caused.

Bug: T221892
Change-Id: I62714b6f2905efd1d1b34c7a13b9917cb6c609fc
2019-05-14 00:18:47 +02:00
Ed Sanders 3a4822c2fe Section switch from wikitext to VE
Use an API 'parse' call with a sectionid to trigger
a full document expansion using replaceSectionAtRev.

Then send this off the RESTBase to convert to HTML
and statsh.

Ensure the etag is passed back to the API response.

Bug: T117716
Bug: T223023
Change-Id: I1b35b28e428a1f86d2e34d90ddbe73361ce14818
2019-05-13 19:49:10 +01:00
Ed Sanders 83b1e02286 MobileArticleTarget: Fix typo in tool config
Change-Id: Ib465ac175a3ab40584c0199b7801eca03644b2d5
2019-05-11 21:36:42 +01:00
Ed Sanders c035073cf9 Fix abandon edit warning message
This message was upstreamed to core and later renamed.

Use the upstreamed dialog itself when switching sections.

Bug: T222525
Change-Id: Ibd2d75ec503e92b5ddec2105f762b0c9f0dc96fb
2019-05-06 15:11:58 -05:00
Ed Sanders 8068198efc ArticleTarget: Return dataPromise from #load
Allows users to get hold of the data promise, as
this.loading is reset to false on completion.

Change-Id: I90452ac21c898185ec993b05c12f80ae2edfb814
2019-05-01 16:48:31 +01:00
jenkins-bot 857c1bd3d1 Merge "Replace the save button with a save tool" 2019-04-30 19:51:36 +00:00
jenkins-bot d85062d1d1 Merge "Fix switching without changes" 2019-04-30 19:37:03 +00:00
Ed Sanders f9330c8564 Replace the save button with a save tool
Now shows correct tooltip for save button (including
the access key).

Bug: T163142
Change-Id: If14a1a5a5829fc215cb79827392173dc05c4bdd7
2019-04-30 19:32:33 +00:00
Ed Sanders 30095b68c3 Make mobile check icon progressive blue
Bug: T222187
Change-Id: Ie713aa662bdc8bf9a74c6de8add4848b3d1499d6
2019-04-30 16:05:28 +01:00
Ed Sanders 7739b1c79b Fix switching without changes
* Remove 'discardChanges' from switchToWikitext. This was
  intended to discard changes even when the document was
  modified, but it is no longer used as we always keep
  changes if we can.
* Remove 'leaveVE' param, it was only used once and has
  been replaced with a direct call to switchToFallbackWikitextEditor.
* Don't reset 'section' if there are no changes.

Bug: T221981
Change-Id: Ia39345da44d203ba67ae331917c8d5ece7d42ef7
2019-04-30 14:52:58 +01:00
Bartosz Dziewoński 75ff121b29 ve.init.mw.DesktopArticleTarget.init: Update for Minerva changes
I think mostly the incompatible changes were made in commit
I5a7d73b20617cb3c6d6379084ac4bea23ec3bc74, but I didn't try
to track them down.

Also fix an issue where hrefs in section edit links generated
by this code were wrong.

Bug: T208102
Change-Id: Ibf6564bc0dcb7fcb420739a897b54346a01add02
2019-04-26 20:52:52 +02:00
Ed Sanders 4fb17205b6 Allow switching from mobile visual to mobile source mode with data
Bug: T128422
Depends-On: I11b7195e9d63f9b279213201036c6338d71669f0
Change-Id: Ieaa2df17c1f73d681d935cd6103ef41c061e1a28
2019-04-25 22:37:53 +02:00
Ed Sanders 709530993b DesktopArticleTarget: Remove changing document opacity when switching to WTE
When this was introduced in 7b2cacbe57
(2013), the confimation dialog was a generic confirm() popup. Now that
it is a OOUI dialog, the dialog overlay serves the same function.

Change-Id: I9812ab55c7a8179524865d93a6d269e388d4c4ab
2019-04-25 21:08:42 +02:00
Dayllan Maza 96de1353d3 Remove block notice tracking
This is a clean up after collecting the necessary data related to
blocks and how often users see the block notices

See: https://phabricator.wikimedia.org/T189724

Bug: T214214
Change-Id: I532a0cd95009109ba25caa8dd31badd5c1900da7
2019-04-23 11:31:37 -04:00
jenkins-bot 32985886e3 Merge "eslint: Enable valid-jsdoc" 2019-04-17 18:39:41 +00:00
Ed Sanders 0db4ae6e00 eslint: Enable valid-jsdoc
Change-Id: Ia0d1e57246a1c567d73022ceca9b8c02850f9bc8
2019-04-17 17:13:39 +01:00
Bartosz Dziewoński 80bfbfc54b ve.init.mw.DesktopArticleTarget: Validate 'veaction' parameter against available modes
If a page can't be edited in the requested mode (e.g. veaction=edit on
talk pages), the parameter will now do nothing (the editor won't
load), instead of trying to load the editor in another available mode.

Bug: T219457
Change-Id: I2cd78ea13ba13ff622f5e4b7db033f82dfa7875e
2019-04-16 20:19:37 +02:00
Timo Tijhof cc599c2e36 init: Bundle wgVisualEditorUnsupportedEditParams with DesktopArticleTarget.init
Bug: T219342
Change-Id: I4b5a048779bd4b957cc5d99c3a7686363ffb3df9
2019-04-16 16:33:53 +02:00
jenkins-bot f9f8ce8919 Merge "Fix mobile done/tick button" 2019-04-12 16:12:50 +00:00
Ed Sanders 79cee8d820 Fix mobile done/tick button
Change-Id: I53eebfe9b94354521763743ab70e4d1a919286f8
2019-04-10 22:51:08 +01:00
Ed Sanders 476d64957e SurfaceView: Use new #isDeactivated method
Change-Id: I5a53f331b6417b72b9f78f3f869579573ea05fef
Depends-On: I043a213fb4a06b02e160315fe3a846a1dd4d7cc1
2019-04-09 15:51:03 +00:00
jenkins-bot 2fc64107f4 Merge "Give mobile document a min height based on 100vh" 2019-04-09 11:59:04 +00:00
Ed Sanders d0a3237f1c Give mobile document a min height based on 100vh
Makes the whole page focusable.

Bug: T109508
Change-Id: I93e9269a89281d342551be5de43a2c60c848ef33
2019-04-08 13:32:31 +01:00
Bartosz Dziewoński 17a0b407fc ve.init.mw.MobileArticleTarget: Remove code causing scrolling issues
This code is supposed to check if we have scrolled past the end of the
page, and if we did, scroll back up to a more reasonable position.

However, it seems to incorrectly trigger in other cases, and scroll
the page back to the top, because getBoundingClientRect() occasionally
still returns bogus values (even though we try to avoid that). This
happens inconsistently when focussing the surface or closing a dialog.

We can't correctly display the toolbar while scrolled past the end of
the page. Removing this code causes it to go into an endless animation
loop in that case. But that may be preferable…

Bug: T219200
Change-Id: I152f2b39351ffd3c9799eea33cce95e05d2f9ab9
2019-04-04 17:07:39 +00:00
Bartosz Dziewoński ac3d5e7925 ve.init.mw.MobileArticleTarget: Fix placeholder being hidden by the toolbar
Follow-up to 500462f4b2.

Bug: T219066
Change-Id: Ie0c35339c440bf85545e51fb5398d0936757432a
2019-04-01 22:48:36 +00:00
Bartosz Dziewoński f46045b69e ve.init.mw.MobileArticleTarget: Save/restore scroll position on surface (de)activation
Bug: T218650
Depends-On: Ib943ca806b6eaaf1d7b650c8ebb24cc30d9fe700
Change-Id: I18047eaa1068b8d06cd708da9e3853abe6d252bb
2019-03-29 21:21:45 +00:00
Bartosz Dziewoński ff88be0d35 ve.init.mw.MobileArticleTarget: Set 'padding-top' on the correct node when section-editing
Follow-up to 500462f4b2.

Bug: T219066
Change-Id: I7344fa8f4ad672e4be7a3b98c5b9a1b1c65131dc
2019-03-28 20:42:30 +00:00
Ed Sanders 592c84a529 Emit 'position' event on surface view after changing doc padding
Bug: T219508
Change-Id: I7ffb47e4ba031096879a88355f5fa3048a4ab09f
2019-03-28 14:40:44 +00:00
Bartosz Dziewoński 500462f4b2 ve.init.mw.MobileArticleTarget: Improve iOS Safari by moving 'padding-top' for toolbar
We need to set 'padding-top' matching the height of the toolbar
somewhere, so that the toolbar doesn't cover the top of the editing
surface. Apparently moving it from the current place (the top-level
wrapper for the MF overlay) to the document node (the node with the
'contenteditable' attribute) allows Safari to properly scroll the
cursor into view when focussing, rather than scrolling it offscreen.

Bug: T219066
Change-Id: Iee1e03bce24c2f149a0aa0f393a37b9db43eaca6
2019-03-27 22:06:14 +01:00
David Lynch 5496d18953 MobileArticleTarget: When saving a section don't trust current page markup
The edit might have changed the section title, which will change the
section-hash, which will make the redirect break. The only way to avoid this
is to use the HTML provided to saveComplete to check for the new hash.

Bug: T213120
Change-Id: I5adfdb44a8304ed4f30def74400e4512e9e8c0ae
2019-03-27 16:58:58 +00:00
jenkins-bot 455c95df32 Merge "ve.init.mw.MobileArticleTarget: Bring the toolbar back into view after it scrolls out" 2019-03-23 12:10:29 +00:00
jenkins-bot c02b357b39 Merge "ve.init.mw.MobileArticleTarget: Remove unused method" 2019-03-23 04:37:46 +00:00
Bartosz Dziewoński 9dc3632982 ve.init.mw.MobileArticleTarget: Restore missing methods
It appears that I did a Ctrl+X in one file, but forgot to Ctrl+V in
the other. And no one noticed that 100 lines of code went missing.

Follow-up to 73561f7aba.

Bug: T218946
Bug: T219041
Bug: T219043
Change-Id: Ib1fd85d121083239397698ff1a30a7908deca25f
2019-03-23 04:49:53 +01:00
Bartosz Dziewoński e9ef3a6f78 ve.init.mw.MobileArticleTarget: Remove unused method
ve.init.Target#isToolbarOverSurface has been removed in VE/VE in 2016:
8b1208cb976278bd44025e6d2c86a3ea6ed8c177. Nothing calls this method.

Change-Id: I9640978b45e568412db4b1c5aa80631a68d847b2
2019-03-23 03:52:01 +01:00
Bartosz Dziewoński f2fc7b8e73 ve.init.mw.MobileArticleTarget: Bring the toolbar back into view after it scrolls out
On iOS Safari, when the keyboard is open, the editor toolbar could
previously be scrolled out of view, due to how the keyboard affects
the viewport (or rather how it doesn't).

Detect when this happens and bring it back in, with a similar slide-in
animation as when the editor loads. Technical restrictions prevent us
from really keeping it in view at all times, and I think this is the
best we can do (and it looks almost intentional).

Bug: T218414
Change-Id: I5eed360d4644815bc9829fbc6b0ffd79b205d10b
2019-03-23 00:59:50 +01:00
Bartosz Dziewoński 73561f7aba ve.init.mw.MobileArticleTarget: Merge in downstream code from MobileFrontend
It will be easier for us to maintain this way. The code I'm moving had
a lot of comments saying that it should be moved here.

See MobileFrontend change Ibe192360bdecab86519de1781f66f90a3441c551.

Bug: T218946
Change-Id: I908e035ec245a9b190f05e64c35dbb29936434de
2019-03-22 18:30:05 +00:00
Bartosz Dziewoński 5806329748 MobileArticleTarget: Remove padding below the surface on iOS
It was here because our old hacks prevented the viewport from being
scrolled, so the keyboard would always cover the last few lines of
the surface. But it is no longer necessary after we ditched the iOS
scrolling hacks in MobileFrontend.

Bug: T217769
Change-Id: Iaf3f86c0fc43f75d11a43462721f44d62abc6eb3
2019-03-21 18:33:02 +00:00
Bartosz Dziewoński a89896a500 MobileArticleTarget: Remove broken iOS override for #scrollToHeading
This is no longer necessary and doesn't work after we ditched the iOS
scrolling hacks in MobileFrontend. And the default implementation works!

Bug: T218429
Change-Id: I5fba78a3877901dac5afda46d3004c07cad383d0
2019-03-21 18:32:54 +00:00
jenkins-bot 074973f01d Merge "Remove special handling for category and file pages" 2019-03-19 19:24:13 +00:00
jenkins-bot ba5589f801 Merge "ve.init.mw.DesktopArticleTarget: Remove some unnecessary toolbar setup code" 2019-02-28 13:19:30 +00:00
jenkins-bot 3ccbc96fa7 Merge "When rendering categories, hide/show catlinks as needed" 2019-02-26 19:52:37 +00:00
David Lynch b1863f4b25 When rendering categories, hide/show catlinks as needed
Catlinks is hidden via a class when there are no non-hidden categories on the
page. We thus need to toggle that class depending on the categories
added/removed from the page.

Bug: T213528
Change-Id: I4067c5721c28041542b9ef2dbc796fbc41b1afe8
2019-02-26 11:26:27 -06:00
Bartosz Dziewoński 92bb0e557a ve.init.mw.DesktopArticleTarget: Remove some unnecessary toolbar setup code
This code, added in 703b2c2ed0 (2015),
is no longer necessary.

    // Disconnect the tool factory listeners so the toolbar
    // doesn't start showing new tools as they load, too
    // much flickering
    this.getToolbar().getToolFactory().off( 'register' );

Introduction of targetLoader (d371014e5d)
resulted in all tools already being loaded before a Target is
constructed, so this is definitely not needed.

    // Disable all the tools
    this.getToolbar().updateToolState();

The tools are already disabled because we set the surface to read-only
above, so this does nothing.

Change-Id: Idb162b60891cd1b961e29d2b9f62b74908f17957
2019-02-22 21:03:36 +00:00
Bartosz Dziewoński 7ade9938d0 Remove special handling for category and file pages
Previously, we tried to keep the list of category members and the file
thumbnail, history and metadata visible while the editor was open.

I am removing it because:
* It is not very useful, as you can't interact with them (e.g. links
  are unclickable).
* It is inconsistent with the wikitext editor (except for non-existent
  category pages, and I'm proposing to change that behavior in T139191).
* It causes issues when other code doesn't expect the special setup
  for those pages (T194068).

This introduces a minor change to the handling of normal pages: after
the save, instead of replacing all contents of #mw-content-text with
the new page content, we only replace the .mw-parser-output child.
Normally the effect is the same (it's the only child), but this could
theoretically affect interactions with other extensions or gadgets.

Bug: T194068
Change-Id: I26cc82d3e0f0d64e3f18a80d232005fc7ab3b374
2019-02-22 20:59:36 +00:00
Ed Sanders 23267264ce Load VE in read-only mode on protected pages
Bug: T53547
Depends-On: Ifaa74be266c048d87f94b4ae2df59cafc7aa155f
Change-Id: Ic90a0b86f45696a8782dec8e3d155ca91107b759
2019-02-22 19:09:23 +00:00
Ed Sanders 18907dde5a Implementations for read-only mode
Depends-On: Ifaa74be266c048d87f94b4ae2df59cafc7aa155f
Change-Id: Iedd1bd9ce17750ad8528c1a053293c4a7321c5de
2019-02-22 18:20:51 +00:00
Ed Sanders 332aa1f3d2 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: I5a294705eed1760e2d4dde33934d2ffb12e29525
2019-02-20 20:23:43 +00:00
Ed Sanders 3269d53632 Support only surfacing part of the document
Bug: T76541
Depends-On: I227a0d704b9b337cff2102d424be9795d6362ed7
Change-Id: Iac71a51c8696434658f24fbb41c8142237bd810e
2019-02-13 19:03:44 +00:00
Bartosz Dziewoński 7fedb7be07 ve.init.mw.MobileArticleTarget: Change "back" tool icon from "<" to "x"
Icon name changed from 'previous' to 'close'.

This matches MobileFrontend's wikitext editor and other overlays.

Bug: T210630
Change-Id: I5f588c65887dd2247d3f816959807f943215e0c3
2019-02-13 00:29:24 +01:00
Bartosz Dziewoński 6e076b3b6c DesktopArticleTarget: Make the progress bar into a reusable widget
We want to add a similar progress bar on mobile without copy-pasting
all this code.

Bug: T210630
Change-Id: I7192869cb719114ffd04940eabf38cf0f0421c13
2019-02-06 22:20:37 +01:00
Bartosz Dziewoński cb09d6a54d DesktopArticleTarget: Fix position of progress bar if editor is reloaded
Change-Id: I5f181a9516ff64988aa67e54ebd342c56e4b7e70
2019-02-06 02:11:48 +01:00
Bartosz Dziewoński 3dbff552dc ve.init.mw.Target: Remove unused property
Unused since 6e64fba2f8.

Change-Id: I223f2346c04573a9e853b49bfc83e542cec47c61
2019-01-24 21:05:48 +01:00
Ed Sanders 74f6c4899c build: Update eslint-config-wikimedia to 0.10.0
Change-Id: I63a0ebf0b31a0d5d4e680a4e2a5a0be4850be165
2019-01-08 17:00:09 +00:00
James D. Forrester 3c293ea00c doc: Bump copyright year for 2019
Change-Id: I8991b97c980d4149f53eb5601036220ef3c0c440
2019-01-01 13:24:23 +00:00
Ed Sanders ad5b8f99ee Replace $( 'body' ) with $( document.body )
Better to use the actual element rather than a string selector.

Change-Id: I7d2c08cf1e3c6f14be5bf65ac040b7cdfdd8c594
2018-12-13 16:44:25 +00:00
James D. Forrester dab9c26c4d Drop EducationProgram hacks, now that it's undeployed
Change-Id: I65030e3e1b5ce006a458cfbe65a97e738a00a4c3
2018-12-06 12:14:03 -08:00
Ed Sanders be9c6800ad Audit target hooks
* Move (de)activationComplete up to ArticleTarget
* Mark (de)activate to be deprecated in the future
* Fix some properties to ensure target.edited is boolean

Change-Id: Ie34139cb68f90f34eb243f1bb964ef578e90dfb2
2018-12-05 15:45:19 -05:00
Thalia 2516753c53 Rename configs for tracking block notices on visual editor
* Also make sure block notices have type 'block'.
* Remove old flag for tracking since we'll be using one
  from core

Change-Id: I4b66e73c8a4c4dd7bffd7c0239b1d5ec06eed12f
Depends-On: I6bd1c95548616677e1f72ba6bcfc6f2b551c1ca6
2018-11-28 15:26:15 -05:00
Thalia 883e0c23a5 Track when block notices are shown on visual editor
When an edit notice is passed through from the API, allow
a type to be specified, and specify type 'block' if the
notice is a block notice.

If VisualEditorTrackBlockNotices config is true, track
when a message with type 'block' is shown.

Bug: T209633
Change-Id: If5fecc2c2c1c39f4b7245b9a215e1120c93b2b22
2018-11-21 11:22:50 +00:00
Thalia ceb02d3296 Remove needless function call in DesktopArticleTarget
Change-Id: I6e691e97fe7330496cdf45a2439d8fd373cf221f
2018-11-19 18:58:38 +00:00
jenkins-bot 45c9ff5e21 Merge "ve.init.mw.DesktopArticleTarget.init: Make multi-tab mode compatible with Minerva" 2018-11-07 12:26:38 +00:00
Bartosz Dziewoński 5996cf15e9 ve.init.mw.DesktopArticleTarget.init: Make multi-tab mode compatible with Minerva
* Make inserting secondary tab work with Minerva's non-standard structure
  of navigation menus
* Distinguish primary and secondary tabs with tiny icons, since Minerva
  hides their text
* Hide section edit link dividers (unnecessary when we use icons)

Bug: T208102
Change-Id: Ieaec60165617e3b423ec58857d6f0a0406e22b1d
2018-11-06 17:45:48 +01:00
Bartosz Dziewoński 259aadaf12 Revert "Disable VE on Special:Undelete"
No longer needed. The underlying problem was fixed in
1aae17c7a5.

Bug: T173154
Bug: T174748
Change-Id: If10301ee78ba031238a11a9f9b2130a2b47a567c
2018-11-05 18:41:05 +01:00
Bartosz Dziewoński 1aae17c7a5 DesktopArticleTarget.init: Don't load on special pages with action=submit in the URL
Bug: T168533
Bug: T176022
Change-Id: Ifb7b9cca21423684a901dccabab23fb64e576102
2018-11-02 17:54:01 +01:00
Bartosz Dziewoński 62273183a8 Simplify handling of messages for section edit links
Change-Id: I5b84fc3863747b4d092a7025475730bb28efeff2
2018-10-13 03:16:53 +02:00
Bartosz Dziewoński e048c3e188 Use the right localisation message for edit tab on Vector skin
Bug: T206892
Change-Id: If9494be10c684c1d8892a990dd7ba9c68caa4b69
2018-10-13 03:16:53 +02:00
Ed Sanders e176ecceae Move 'done' tool out of static config
Bug: T206132
Change-Id: I3319fc56209cab303448f7abe1e6334c50100947
2018-10-03 22:37:48 +01:00
jenkins-bot f6cea616ef Merge "Remove #ca-edit from required skin elements on edit pages" 2018-09-26 11:27:22 +00:00
Bartosz Dziewoński f67dfea29d Remove #ca-edit from required skin elements on edit pages
I suppose technically you don't need it if you're already on an
?action=edit page, since that will cause the editor to load as well.
At a glance nothing seems to break if it is missing (other than the
fact that there is no way to launch the editor, obviously).

Bug: T179427
Change-Id: I3c221ded302702b881857930da5dc41630680c02
2018-09-25 20:39:12 +02:00
Ed Sanders 78a3c0dfb6 Provide platform when tracking mwedit.ready for tempWikitextEditor
Bug: T205241
Change-Id: Icf77ad9028e7e87c0189ef2b4cad5dbea20cb2f1
2018-09-24 16:03:55 +01:00
Ed Sanders 917645eb27 Use mw.Title.isTalkNamespace
Depends-On: Ie57243bac1aa5e23bc8b1c027bcb1b83090ee433
Change-Id: I303401ff34425831cb3c32d25df635aefa5b5926
2018-09-14 13:37:17 +01:00
Bartosz Dziewoński bb5762a0b2 ve.init.mw.DesktopArticleTarget: Handle deactivate on namespace tab when it's a talk namespace
Turns out, talk namespaces are special.

Bug: T204194
Change-Id: Ie9af128edd5874075098f8593e01595da863102d
2018-09-13 11:04:47 +02:00
jenkins-bot df253967e1 Merge "DesktopArticleTarget.init: Pass platform to ve.track directly" 2018-09-12 14:20:43 +00:00
David Lynch 627128f1ae DesktopArticleTarget.init: Pass platform to ve.track directly
ve.track tries to guess the platform, but it needs a loaded Target to do so,
and init happens before that.

Also, log a warning when this happens, in case it comes up again.

Bug: T203618
Change-Id: I35fa58a42cd247e01f3717c9ab3a10d8ea93a484
2018-09-06 10:52:46 -05:00
Ed Sanders 6396fad416 Release editWarning unload event when switching from old wikitext to VE
Bug: T202587
Change-Id: I81ff882e0e4ccf0b26d73be5f55cbf2da0d97a47
2018-09-06 14:13:55 +01:00
Ed Sanders 8ac5a03a05 Cleanup setEditorPreference: Always return promises, never deferreds.
Change-Id: I59a5fdc29ee64abe422610da835e6f089ad7267a
2018-09-04 13:45:52 +01:00
jenkins-bot 919f74f10b Merge "Don't wait for surface to blur before hiding pageToolbar" 2018-08-29 01:58:14 +00:00
Ed Sanders eea7b93895 Don't wait for surface to blur before hiding pageToolbar
Bug: T202986
Change-Id: Ia25dd7aab7c72f6888fab1fcec0185fe0b4111b5
2018-08-28 12:08:09 +00:00
Ed Sanders e67f870922 Fixup Ie40baad: Avoid triggering surfaceReady when adding dummy surface
Change-Id: I01f77633a11c6c5b8d484836940ea10b975c7a9e
2018-08-25 18:06:37 +01:00
Ed Sanders 8f49bb391a WelcomeDialog: Check at least one editor is available
Bug: T201928
Change-Id: Ibac6cf921fdc3daba2d671d9bd668fa7bcb9e7a2
2018-08-23 14:21:40 +01:00
David Lynch 26f6429702 TemplateStyles support
MWTransclusionNode will preserve TemplateData <style> in its generated content.

Disable TemplateStyles stylesheets in the original page content, and reenable
them when the surface deactivates.

Remaining TODO: if multiple copies of a template with deduplicated styles are
on the page, and the one containing the actual <style> is removed, all will
lose their styling.

Bug: T197563
Change-Id: Ibd8939eef7d8eb532719f4ee0ce200600449ef81
Depends-On: Ia9f2afcdba5456238e3ef444c202c9b0c78838bf
2018-08-22 17:03:27 +00:00
Ed Sanders cb10316a7b Export to page using action=submit
Change-Id: I0d719905203d24a545d9b7dcea5bb9d032f10a76
2018-08-19 11:25:17 +00:00
jenkins-bot c0c94668c9 Merge "DesktopArticleTarget.init: always bind to #ca-edit" 2018-08-09 22:18:55 +00:00
David Lynch e99749aa80 DesktopArticleTarget.init: always bind to #ca-edit
Refactoring in 92c4e23 didn't account for the case where there are multiple
tabs and source mode isn't NWE, which caused the "edit source" tab to just be
a page- navigation that always discarded changes. onEditTabClick handles this
case fine, so just always bind the handler.

Bug: T199655
Change-Id: I3dca87a7a3b0ea88ef0008be89cd1f6007167916
2018-08-09 23:36:08 +02:00
Ed Sanders 4ee09f75af Replace Bugzilla numbers with Phab numbers
Change-Id: I0e91d63b3872520b8f66002615967b2cfe235bf5
2018-08-09 15:11:27 +01:00
James D. Forrester 3c6ca93b92 build: Enable and make pass no-prototype-builtins
Including a spectacular whoops in MWGalleryDialog.

Change-Id: Id9863f6dc3701cb0df6684380fa5ecac4526d37d
2018-07-06 10:58:18 -07:00
jenkins-bot 67e4799d39 Merge "DesktopArticleTarget.init: Fix URI comparison if it contains a port number" 2018-07-03 23:16:33 +00:00
jenkins-bot 13e4f0bbd0 Merge "DesktopArticleTarget: consolidate edit tab behavior" 2018-07-03 22:27:42 +00:00
Bartosz Dziewoński 9ef039dd4b DesktopArticleTarget.init: Fix URI comparison if it contains a port number
If the wiki runs on a host that contains a port number, section edit
links would always reload the page, and the "Add section" tab would
not work.

As it happens, my local testing wiki runs on localhost:3080.

It is an unfortunate naming mishap:
* mw.Uri#host is equivalent to location.hostname
* mw.Uri#getHostPort is equivalent to location.host

In this case, we have to compare the port too, otherwise a setup (my
setup ;) ) where one starts up another wiki on localhost:3081 to test
cross-wiki features would fail.

Change-Id: Ib7de4ba3c3a84888f24186af03bd9dcced131051
2018-07-04 00:11:48 +02:00
Ed Sanders f1b506bb6a Fix toolbar group names
Bug: T198583
Change-Id: I7b2e15dc65655bf048a02d9902a8f6e1c491edef
2018-07-03 14:23:21 +01:00
David Lynch 92c4e231f2 DesktopArticleTarget: consolidate edit tab behavior
What happens when an edit tab is clicked is spread across handlers in
DesktopArticleTarget and DesktopArticleTarget.init. Consolidating the logic
into the handler in DesktopArticleTarget.init makes it easier to understand.

It could be moved further into DesktopArticleTarget, but the init handler has
to exist to activate the target in the first place.

This patches a hole where clicking "edit source" while in visual mode would
sometimes not switch to source mode, because it didn't think it was changing
the current section.

Also, fix a typo in the documentation.

Bug: T198272
Change-Id: I12d958b6af1b9fa9aca68b498eb2a1a2d76b5a82
2018-07-02 16:17:15 -05:00
jenkins-bot 13fb253532 Merge "mw.DesktopArticleTarget: remove action=edit when tearing down as single-tab" 2018-06-25 17:59:14 +00:00
David Lynch 09a315ca69 mw.DesktopArticleTarget: remove action=edit when tearing down as single-tab
aeb4f2f2b7 added a #wpTextbox1 to the wikitext surface, which confused our
existing teardown check. This confusion only became apparent in single-tab
mode, when using the wikitext editor.

Bug: T197615
Change-Id: I98e64e7135aaf6f8fda441a91e6cbc4bac6cea39
2018-06-25 11:55:51 -05:00
Bartosz Dziewoński 37e349913e If VE was opened on action=edit URL, redirect to view URL when closing
We already do it after save, but not if the editor is closed without
saving.

This behavior is a bit awkward for non-existent pages (redlinks),
since MediaWiki normally doesn't display them in view mode (all links
point to action=edit). But this seems less weird than not allowing the
editor to be closed.

Bug: T122388
Bug: T168338
Change-Id: Id9ee41356f011dfbfa6e8744b8d9076f8eacaf39
2018-06-22 01:10:11 +02:00
Ed Sanders efcea82c9c Follow-up I348b8522: Fix context variable
Bug: T197762
Change-Id: Ife163e1666ec43ecbb21099a9342960615c573d8
2018-06-20 19:50:39 +01:00
David Lynch 814e26f1e9 DesktopArticleTarget: view click handler should only run for active target
Not checking this results in handlers blocking click actions for "read" after
the teardown of the target.

Bug: T197445
Change-Id: I3a962c66c82a0e48ca54bf2f0b822a9a005da54c
2018-06-18 20:45:52 -05:00
Bartosz Dziewoński e484522161 ve.init.mw.DesktopArticleTarget: Only change document title on activate
Previously, we changed it on every load, which also occurs when
switching editor modes. That caused it to not be restored when editor
was closed.

Bug: T197490
Change-Id: Icb20c38309fd440553d5245d865b05145542313f
2018-06-15 22:10:25 +02:00
Ed Sanders 6459de6978 Move module pre-loading from DAT.init to ArticleTarget
This makes this feature available on Mobile as well.

Change-Id: I26a2af63b3665f5563f8562f1a8e94287cad439f
2018-06-10 16:07:44 +01:00
David Lynch d3824dee76 DesktopArticleTarget: Section-scroll as part of restoring the page
We were scrolling to the edited section when we saved the page, and otherwise
reverting scroll position to the top if we just abandoned the edit. This
unifies these cases, so any section-edit which leaves the editor will scroll
to the section being edited. (If section==new and the edit is abandoned, it'll
scroll to the last section on the page.)

Bug: T194631
Change-Id: Ic2aca68b3127c435545644912b96212bcfa6648d
2018-05-25 16:30:22 -05:00
David Lynch 4d5fc16a9a MobileArticleTarget: Include placeholder for references
Cite's a08febb0afa2d changed the rules for adding the Cite button to the
toolbar – it now requires a placeholder slot in the toolbar, rather than
finding the link tool and adding itself after that. As ve.init.mw.Target
was updated for this it kept working on desktop, but MobileArticleTarget
completely overrides the toolbar, and was missed.

Bug: T195191
Change-Id: I55c9de9e736bb83f5f05028f2fc07af0ad996050
2018-05-24 17:18:50 +00:00
David Lynch c76c41f3dc DesktopArticleTarget: on escape close toolbar dialogs first
Pressing escape will close toolbar dialogs (find/symbols/etc) if they're open
instead of trying to teardown the editing surface.

Bug: T190068
Change-Id: I27080649392f17344c901269029368fa0b3c2963
2018-05-19 19:29:34 +02:00
jenkins-bot 60ef3af0b1 Merge "Fix position of inspectors/context inside dialogs" 2018-05-18 14:55:01 +00:00
Bartosz Dziewoński dfe65db5bb Fix position of inspectors/context inside dialogs
Override #addSurface instead of #getSurfaceConfig, so that the
$overlayContainer option only applies to the "main" surface of the
Target rather than all of the surfaces (including those in
TargetWidgets).

Bug: T194433
Change-Id: I61c609e2d52814b4547fb5292a0bfb237c4c218f
2018-05-18 14:26:00 +00:00
David Lynch 150fb16008 MobileArticleTarget: fix deprecated toolbar calls
Change-Id: If7d4b52c29e9648f17eda2d62f8fcdad744f82ae
2018-05-18 15:59:15 +02:00
Ed Sanders 9b8e501333 MobileArticleTarget: Show both edit modes in edit switcher, for consistency
Change-Id: I48193db0d8282e31265e95884878eb81cbaeeedd
2018-05-16 15:20:25 +00:00
jenkins-bot 4ca3f1661d Merge "ArticleTarget: Change rendering of category preview" 2018-05-15 13:28:57 +00:00
David Lynch 5d19272aa1 ArticleTarget: Change rendering of category preview
Just generate the standard wiki skin markup for categories. Adjust linkcache to always know
whether links are hidden categories. (It previously knew *sometimes*,
depending on whether a MWCategoryWidget had interacted with that category.)

Make the save dialog preview use the same method as the bottom-of-editor preview.

Bug: T194092
Change-Id: I37fea15eaef0a5847f27ce41dd92370a4bf353b6
2018-05-13 16:40:59 -05:00
Ed Sanders 900b74e9a9 Update VE core submodule to master (14bcc9256)
New changes:
14bcc9256 Give toolbars groups names

Local changes:
Give toolbars groups names

Also create an empty placeholder group for reference tools.
This allows targets to specify if they should show them.

Depends-On: Iccaf35cf941cb47ad55e8d98373461f5eaff5fed
Change-Id: I0bace5e5fe05f9c214d57a74c478b48a7dcaec3b
2018-05-13 18:09:33 +01:00
Ed Sanders 5974c59b97 Follow-up Ifdc951fdc: Don't use target when it doesn't exist
Change-Id: Idf546f7b1d2c12f59b5024f3365665214e4e5f49
2018-05-07 21:22:09 +01:00
jenkins-bot 95d831c2de Merge "Create getters for localised APIs (getContentApi/getLocalApi)" 2018-05-07 15:51:45 +00:00
Ed Sanders 478b0bcbb9 Create getters for localised APIs (getContentApi/getLocalApi)
Pass through the current document when available, otherwise
assume the current surface's document.

Also add a getter for getPageName, so that can vary based
on the target document.

Bug: T193856
Change-Id: Ifdc951fdc6a43b924d102e3fcd7e59e52023757b
2018-05-05 14:32:55 +01:00
jenkins-bot 1f6cf4883d Merge "ve.init.mw.DesktopArticleTarget.init: Edit the latest revision when viewing a FlaggedRevs-stable one" 2018-05-05 01:03:04 +00:00
Bartosz Dziewoński 192a232410 ve.init.mw.DesktopArticleTarget.init: Edit the latest revision when viewing a FlaggedRevs-stable one
When the user is viewing the last stable revision of a page which has
newer unreviewed revisions, FlaggedRevs wants us to open the latest
(unreviewed) revision of the page for editing.

Use the JS config variable 'wgFlaggedRevsEditLatestRevision', provided
by FlaggedRevs since change I4c9804fe2c4924e28770807881379ddca4fd8b76.

Also add an extra comment about loading latest revisions in general.

Bug: T165283
Depends-On: I4c9804fe2c4924e28770807881379ddca4fd8b76
Change-Id: Ic47491e690153d0ad87ce64bfc9e7a28a06fc6e2
2018-05-04 22:04:02 +00:00
David Lynch 3f91a27809 DesktopArticleTarget: track mwedit.ready even if skipping temp editor for new sections
Bug: T193206
Change-Id: I78555b84bde3d5bd14b032862e5a020121fc5c2e
2018-05-02 11:35:42 -05:00
jenkins-bot ffac6b14dd Merge "Check link 'host' in onEditSectionLinkClick" 2018-04-30 15:17:45 +00:00
Ed Sanders f8cebb8f51 Follow-up Ib7e769e: Fix typos in static method calls
Also move desktop-only methods to DesktopArticleTarget.

Bug: T193217
Change-Id: Icc2bb6602a62057da9f841793d8fe06d9814230e
2018-04-30 11:05:43 +01:00
Ed Sanders ad170023e6 Check link 'host' in onEditSectionLinkClick
Bug: T193323
Change-Id: Id67798e5689af9d528bf29bb1b42047adaedaabd
2018-04-30 10:57:45 +01:00
Ed Sanders cddf206f5b Set surface's $overlayContainer in DesktopArticleTarget
Logically depends on Ia96b1a89dd9582303b80be85b3971cf3341cad24.

Bug: T166217
Change-Id: Icc54f87bac46d39e8c49010ed052e1db66827f06
2018-04-27 21:55:12 +00:00
jenkins-bot fd082e577b Merge "ve.init.mw.DesktopArticleTarget: Setup toolbar before section title input" 2018-04-24 16:24:42 +00:00
Bartosz Dziewoński e3378e6d77 ve.init.mw.DesktopArticleTarget: Setup toolbar before section title input
When we set up the new section title input and possibly set its value
(preloading from URL query, or from autosave), the "Save" button on
the toolbar must already exist, because we try to enable it.

Bug: T192901
Change-Id: I3bba86a8c8a9b81014d425db256ff49f06bdaea6
2018-04-24 18:11:42 +02:00
Ed Sanders 1f4baa7b58 Teardown target before reloading article
Ensures that auto-save data is cleared after
creating a new article, or restoring a revision.

Bug: T192770
Change-Id: I348b8522c1a935d7db1243ba8fcbd5b24e3383a2
2018-04-23 21:30:37 +01:00
jenkins-bot 6902e81768 Merge "Use ellipsis on toolbar save/publish button" 2018-04-17 18:34:17 +00:00
Ed Sanders 11eaab48c8 Move redirect building methods from DesktopArticleTarget to ArticleTarget
These are not specific to desktop.

Also make the static builders static, and move VE target specific
code to caller, such as the click handler.

Change-Id: Ib7e769e3d6d339b9e66e1bc924480b0b0d5db17d
2018-04-02 17:32:24 +01:00
David Lynch d77ea2bf16 DesktopArticleTarget: use -published message instead of -saved
Bug: T183901
Change-Id: I09f6e44f9f743f079ca5504ec06706c764ce6e25
2018-03-27 10:49:03 -05:00
jenkins-bot 58f9cf7050 Merge "Autosave section title when adding new section in source mode" 2018-03-26 21:19:26 +00:00
Ed Sanders 28d8d2923e [BREAKING CHANGE] Use upstream tryTeardown instead of close in MobileArticleTarget
Change-Id: I33bcc98bc75ab049568de47faceb3f3390df5901
2018-03-26 15:32:55 +01:00
Ed Sanders 307e6c2922 Move some deactivation code from DesktopArticle to ArticleTarget
Also rename tryDeactive to tryTeardown.

Change-Id: Ie89d59a62826bcfe3d30ad04f89d3c4211cc34f4
2018-03-26 15:32:55 +01:00
jenkins-bot 2c96d24c76 Merge "Avoid jQuery.parseHTML" 2018-03-20 21:44:37 +00:00
jenkins-bot 0ed47a025e Merge "Only use pre-computed measurements for position loading bar" 2018-03-20 21:44:36 +00:00
Ed Sanders 0f56af016d Use ellipsis on toolbar save/publish button
Bug: T189803
Depends-On: Ic29717a660de5e80ee2a37f583b2a61c11fa87c4
Change-Id: Idaf80ea7e6ae9ffa165a8638af886bf6ab21a7f0
2018-03-20 19:46:36 +00:00
jenkins-bot ff21c17c37 Merge "Remove unnecessary attachToolbarSaveButton override" 2018-03-20 17:25:11 +00:00
Ed Sanders b80075a5e4 Avoid jQuery.parseHTML
Change-Id: Iaf5cbe27b8883d6e4c468a3b4dae11438d264894
2018-03-16 15:43:03 +00:00
Ed Sanders a1dffa2dd7 Only use pre-computed measurements for position loading bar
Change-Id: I5fc17a432de8030a6154c4e961ac10c73f391a79
2018-03-16 15:39:21 +00:00
jenkins-bot 79f27a5447 Merge "Clear VE autosave whenever WikiEditor is loaded" 2018-03-14 18:25:48 +00:00
jenkins-bot 3c861d7ed1 Merge "Clear auto-save when switching to fallback wikitext editor" 2018-03-14 17:55:44 +00:00
Ed Sanders e0419f8388 Autosave section title when adding new section in source mode
Change-Id: Idcbe2f12e3eb0bb85e2c986885bd8084b16dbe5b
2018-03-12 12:25:12 +00:00
Ed Sanders e78379a395 Attach deactivate code to namespace tab ('Main'/'Article')
Bug: T189380
Change-Id: I9f05722b9a1c740f9f982d9c5690d48046f19fdd
2018-03-10 19:07:11 +00:00
Ed Sanders c3c3c60f1f Clear VE autosave whenever WikiEditor is loaded
Bug: T189381
Change-Id: I21a76dc32327d6c6e72a793d9b579cb7b6a5e32e
2018-03-10 18:34:17 +00:00
Ed Sanders ec6d9b235a Clear auto-save when switching to fallback wikitext editor
Bug: T189381
Change-Id: Id89fa2a673ad8aef3826c0ef862770bf522bbdcf
2018-03-10 18:04:44 +00:00
Ed Sanders 8b208c80d5 Remove unnecessary attachToolbarSaveButton override
It's identical to the code inherited form ArticleTarget.

Change-Id: I7fe7a48b0614f2ac2665ece042bb95a6f77303ad
2018-03-10 16:20:30 +00:00
Ed Sanders 19d9e9eb98 Tag TODO comments with bug number
Change-Id: I965e8d4bed4fdfa24738ca5cce0ae3f51e7f2b40
2018-02-28 14:36:42 +00:00
Ed Sanders 76caef6b4b Use session storage to auto-save
Ensure we start with the same HTML (i.e. if an edit has
been made since the crash-recovery):
* Whenever an article target is activated, stash the initial
  document html, other parsoid response data, and the request
  parameters (pageName, mode, section) in session storage.
* Whenever an article is fetched through the target loader,
  recover from session storage if the request parameters match.

Store transactions:
* On document transaction (debounced) append the latest
  changes to session storage.
* If a document state is recovered from session storage,
  attempt to re-apply the stored transactions.

Clear transactions:
* Whenever the target is torn down (i.e. save, deliberately
  closing the editor to go back to read mode)

Other:
* If writing to session storage fails once, disable future
  attempts for that session (assume storage quota exceeded)
* Disable tempWikitextEditor when recovering. We don't have
  the transaction code loaded yet to perform the recovery.

Bug: T57370
Depends-On: I3832243fc347a99641fcb7e39a887a153c9a3b22
Depends-On: I448fb566fe9f7f5b5a76e88b70ca000e3d35b415
Change-Id: Id9d877f903cf4796a52f90991c030417a9f8786f
2018-02-27 12:19:06 +00:00
Ed Sanders 05a504887d Drop IE10 support
Change-Id: Ib1cb8fb32c499ba0bdc87ec55e1e2e95d2eb39ec
Depends-On: I68c882e64fba95d5e1bf41f64658fcef7524dcf5
2018-02-22 00:47:38 +00:00
jenkins-bot 8d3e702976 Merge "Disable tempWikitextEditor for section=new on talk pages" 2018-02-21 01:29:58 +00:00
Ed Sanders ee5b80aeee Avoid jQuery.parseHTML
Bug: T187713
Change-Id: Ic156d6fb670fa2f79cf3c1d5fe0c6272b53b6440
2018-02-19 15:41:20 +00:00
Ed Sanders f2e7361460 Disable tempWikitextEditor for section=new on talk pages
The temp editor doesn't know about the title input
widget yet, so disable for now.

Bug: T185633
Change-Id: I3e44dcc30ee8372080c7cd8c5fc27eb167e24fc6
2018-02-16 18:32:41 +00:00
Ed Sanders 119e9ef0f6 Remove IE9 workaround
Change-Id: Ifcb1690934ece7d373c764591e00740d6f1238ee
2018-02-13 10:45:16 +00:00
Fomafix 8079d081d0 Remove /* global confirm, alert */
The browser functions alert() and confirm() are not used.

Change-Id: I1b069937fe1548298d55a3e6616e189b72c3e8fa
2018-02-12 10:49:11 +01:00
Ed Sanders cefa0ebf7b Add trailing linebreak to NWE's temporary wikitext editor
Bug: T185632
Change-Id: I8225b08484e535668e8b0bd33eb3b8b09b80ff35
2018-02-02 11:10:18 +00:00
jenkins-bot 97fbd5619c Merge "Public API for the tempWikitextEditor" 2018-01-24 00:53:11 +00:00
jenkins-bot a77eea97b3 Merge "Sync tempWikitextEditor just before building target, not on every change" 2018-01-24 00:50:41 +00:00
jenkins-bot 14e557e936 Merge "Use jQuery 3 .catch( fn ) instead of .then( null, fn )" 2018-01-24 00:06:11 +00:00
Ed Sanders 8afe6c5c6d Public API for the tempWikitextEditor
Allows users to know when the widget has been constructed,
and access it (e.g. to set an initial selection)

Bug: T185279
Change-Id: I3678996bcf644cc889dd168ac3ce48b5c3633ec1
2018-01-23 15:30:51 -08:00
Bartosz Dziewoński a0e2afef8e Use jQuery 3 .catch( fn ) instead of .then( null, fn )
Change-Id: I676eec0acf25690c2b2dd0b9a414be5fee887395
2018-01-23 15:25:15 -08:00
Ed Sanders d294006d7b Sync tempWikitextEditor just before building target, not on every change
Also ensure tempWikitextEditor is always torn down, even if
target setup fails.

Change-Id: Idc30a9dc00491b8c85353d73cb9ff70afea1d51c
2018-01-23 15:13:10 -08:00
jenkins-bot f52ee56a02 Merge "Toolbars: Replace $.height with clientHeight/offsetHeight" 2018-01-23 23:01:37 +00:00
Ed Sanders 154f49e964 Toolbars: Replace $.height with clientHeight/offsetHeight
Bug: T185599
Change-Id: I43fbce8f221553e9ae03f8385f39a19de01e8eb7
2018-01-23 12:32:16 -08:00
Ed Sanders 3077bbe51c Remove Firefox support comment
This line isn't solely for supporting FF52, that is the order
in which it is called (move after attach, not before),
but that matches all our other widgets, so not sure
it needs commenting.

Change-Id: I6f3cc5687f1e4b995dff700d0765d14de1927d51
2018-01-22 11:27:46 -08:00
Ed Sanders f2568c8d7d NWE: Don't attempt to set selection on unattached textarea
Prevents an exception being thrown in Firefox <= 52.

Bug: T185304
Change-Id: Ic9a43e3cf12d4cc566cebb328f8e807e464af634
2018-01-22 18:58:26 +00:00
jenkins-bot 140ec5f2ab Merge "NWE: Show temporary wikitext input widget while loading" 2018-01-16 18:13:47 +00:00
Ed Sanders b1ea5d618a Don't pass wikitext to requestPageData if unmodified
Bug: T184875
Change-Id: I41a72a9c7546fafc834bf837e507d9359872ff11
2018-01-14 16:16:47 +00:00
jenkins-bot 2091b8634a Merge "Use section fragment after-save even if the query is empty" 2018-01-10 21:41:59 +00:00
Ed Sanders 886faf2adc NWE: Show temporary wikitext input widget while loading
Bug: T184614
Change-Id: I2e4964cb6329660957815dcb9a74d2ad24d5256b
2018-01-10 21:34:53 +01:00
David Lynch 64944c119a Use mw.storage instead of localStorage
mw.storage catches errors, so we won't crash horribly when the user has
localStorage disabled / full.

Bug: T181822
Change-Id: I212994eb535b9a8fb5f6c09deaa10b16c3d7f10e
2018-01-10 11:44:24 -06:00
David Lynch 874ba30ce8 Use section fragment after-save even if the query is empty
Bug: T181075
Change-Id: If2d1107982d3f947330c750c635ee221ab71610f
2018-01-05 11:55:38 -06:00
Bartosz Dziewoński 23158de319 Fix context menu for mobile TargetWidgets
Depends on Ica66325a8267d14f25fbc537b956573d1d3cc336 in VE core.

Bug: T157084
Change-Id: I9d9839d7e96eb1ef254e11554acfb955750a2915
2018-01-04 16:53:40 +00:00
James D. Forrester 0a7a845a42 doc: Bump copyright year
Change-Id: I0b299c840ede1a1b8552cecfc70c5760ab036181
2018-01-03 17:45:07 +00:00
David Lynch 6f2c829bd9 Add section id to URI fragment on save
Bug: T181075
Change-Id: Iea63112301bfa0860c3d68efc35648a5af7e4ae6
2017-12-15 00:03:52 +00:00
Ed Sanders 8f612fbe64 Pass editor mode (visual/source) to tracking code
Change-Id: Iba5d3c66ecbd2872d76ea12f795ef3bebaae9d81
2017-12-07 11:14:00 +00:00
David Lynch 7a260ad1b7 Track action=loaded for consistency with WikiEditor
Change-Id: I1b92996e63dd85416755377dc14a5a997aac6657
2017-12-06 11:32:01 -06:00
David Lynch 396ce6eb6b DesktopArticleTarget: enable spellcheck on sectionTitle
Tell browsers we explicitly want spellchecking on the section title. If
unspecified this is browser-dependent, so it was inconsistent.

This won't actually have an effect until the next OOjs-UI release (v0.24.3),
as this was a new feature added to TextInputWidget.

Bug: T179654
Depends-On: Ifdd44ead7d782288aaef0979322f0943f7304835
Change-Id: I588874efcff91c5be03da2fc03c268f883b718e2
2017-11-29 00:06:20 +00:00
Ed Sanders 6761a3619a Use more common 250ms transition for toolbar instead of 400ms
Change-Id: I8ad1a20753b7bd4a17db605d31502e57149b5348
2017-10-18 19:17:05 +01:00
David Lynch 80c813e08c init.mw.DesktopArticleTarget: properly set up section links
We were reimplementing (incompletely) the setup from the .init version. Just
call the original, modified slightly so it doesn't over-setup on repeated
calls.

Bug: T151021
Change-Id: I65bd7c5ecf75c478d6babeb13e7fb2a76a9842c8
2017-10-17 10:14:50 -05:00
Ed Sanders 169ce28c44 Remove duplication from browser whitelist
The whitelist isn't checked for blacklisted browsers,
so if all non-blacklisted browsers are whitelisted,
set the whitelist definition to all (null).

Change-Id: I8ee3569d9d5be2eda9153f1b087c1be385f93d9c
2017-10-12 16:54:46 +01:00
James D. Forrester bd2deb3ac4 DesktopArticleTarget.init: Load 'mediawiki.action.view.postEdit' via loader
Bug: T164148
Change-Id: I537144bfd52ff84499f5d086f5d05efe2ba0493b
2017-10-05 15:54:20 -07:00
Ed Sanders 43763f0a75 Target teardown refactor
* Rename 'deactivate' to 'tryDeactivate' as it may prompts
  the user to deactivate.
* Merge 'cancel' and 'teardownSurface' in to 'teardown',
  extending the parent method.
* Rename elementsThatHadOurAccessKey to $saveAccessKeyElements
  and move teardown to parent class where it is setup.
* Move toolbarSaveButton teardown to parent class where it is setup.
* Cleanup changeDocumentTitle

Depends-On: I9d97614695272dca6936ef6f3461178fcf0368a8
Change-Id: Ie998a04c21f6615b4415edf471310db5edca3b5a
2017-10-05 10:26:46 -07:00
Ed Sanders 1256b19d72 Use destroy event to teardown new section inputs
Change-Id: I4990a162b62b7195016efba47cc5926b9e3a0f21
2017-10-05 16:20:48 +01:00
Ed Sanders e0f7f30bbd Use parent #clearSurfaces method to clear surfaces
Move mwTocWidget teardown to a destroy event listener.

Change-Id: If96be96aa67da55d3b17dd2565f5e954786ff3ff
2017-10-05 16:03:55 +01:00
Ed Sanders 58237588ad Abort loading when 'escape' is pressed
Bug: T117359
Change-Id: I2c60588f14b9f80b18a7ac8da753fee224be35a4
2017-10-04 14:09:19 +01:00
James D. Forrester 09cde07c45 DesktopArticleTarget: Retain 'mwTarget' stats tracking object
Bug: T177250
Change-Id: I1584f452e16272886af459bac3e24c4995af2231
2017-10-02 21:03:09 +00:00
Bartosz Dziewoński 81d567bfdc ve.init.mw.DesktopArticleTarget: Fix the code to reorder tabs
This code is meant to fix up the tabs if wgVisualEditorTabPosition
was changed and we're seeing cached HTML with the tabs in wrong order.
But it seems it has never worked. `$caEdit[ 0 ].nextSibling` is a text
node and obviously not equal to `$caVeEdit[ 0 ]`, and vice versa for
the other case. The logic is actually correct, so let's fix it to skip
over text nodes.

Also, remove a stray 'eslint-enable' comment left over in
a0f934ed26.

Bug: T50017
Change-Id: I23663a9bfcfdbf52918452c878a128e6960b1191
2017-09-28 15:54:55 +02:00
Bartosz Dziewoński a0f934ed26 ve.init.mw.DesktopArticleTarget: Remove hack for reversed tabs in RTL in Vector
Vector no longer does the silly thing where the tabs are reversed in
the HTML in RTL languages, so we must remove our hack to do the same,
since otherwise it reintroduces the issue it was intended to prevent.

This essentially reverts 2efd4f0061.

Bug: T50017
Change-Id: Ibeaa55bc34899bffab849ea8ad8b127fb5184d43
2017-09-28 07:35:18 +02:00
Ed Sanders 90a9fdb6aa Ensure mw-notification-area doesn't get disabled
Bug: T176874
Change-Id: I43af13a0fcb5c19fdea53cfaeb941ac100579945
2017-09-27 14:50:59 +01:00
Ed Sanders 1b8f8d8908 Replace wg(Relevant)PageName with target#pageName
The default value of target#pageName is wgRelevantPageName
but other targets my override this, or change it dynamically
(e.g. ContentTranslation).

Also remove duplicate setter of pageName in mw.ArticleTarget,
already set in mw.Target.

Change-Id: Iebd1def1d4142978a673afec584a0b663644d176
2017-09-26 13:22:00 +01:00
David Lynch 02c6e9142b Api: Missing preloadparams
* Tiny fix to 33dc60838c for PHP variable name
* Bigger fix to properly pass preloadparams in and split them up

Change-Id: I844db115f2563cb9ee1629c30d5f49d1ce58f5bd
2017-09-25 11:42:09 -05:00
David Lynch 325de4b130 DesktopArticleTarget.init: handle new-section tab when in visual mode
Bug: T157755
Change-Id: Ida657edb57c4d3067f17104ff1b74965c8082131
2017-09-20 15:49:21 +00:00
jenkins-bot 0246c2a62f Merge "Enable preload in VisualEditor" 2017-09-18 19:59:13 +00:00
David Lynch c440a3576f DesktopArticleTarget: Support preloadtitle in source mode
Can't support it in visual mode, since there's no new-section handling at all.

Bug: T51622
Change-Id: I763d5fff156e9ef3893bd882fab1dc2d47121728
2017-09-18 10:18:37 -05:00
David Lynch ea274c94cd Enable preload in VisualEditor
This allows the use of the preload and preloadparams query parameters. They
should behave as they do in the old editor, loading substituted content in
visual and source modes.

Bug: T51622
Change-Id: I522fb5b480d17912f6d6116be6aa043ead855b52
2017-09-15 17:17:51 -05:00
Ed Sanders d515d418c1 Use lowerCamelCase for javascript var oldId
Change-Id: Idd04578a0035320f85dc911a2f4ddbc6f378887f
2017-09-13 12:57:37 +01:00
Ed Sanders ebce67b6ab Remove pageName/revision from ArticleTarget constructor
Other page state is read directly, rather than passed in.
If we come up with a use case for passing this in at a later
date we can reconsider the best way to do this.

Change-Id: Iee7e608c969776b89dbb38b3b56a5177e48344af
2017-09-13 12:57:37 +01:00
Ed Sanders 682787f312 Change ArticleTargetLoader#requestPageData API to use options object
Change-Id: I02e6218a8359b1cbc8fed1a34d68206a2a154d46
2017-09-13 12:57:37 +01:00
Ed Sanders 3ba918a6ae Disable VE on Special:Undelete
Bug: T173154
Change-Id: I2a7d815a67c9e0f80ab3cdfd3a3755370c831867
2017-08-25 18:09:37 +01:00
David Lynch 5f6e186ed4 ArticleTarget: set local config to hide welcome dialog
This stops the welcome dialog from being displayed repeatedly if the user
edits the article multiple times in the same pageload.

Bug: T170983
Change-Id: I8cc5990e9acb1ac09a2d6dd95eef8042c70088c7
2017-07-19 14:29:49 -05:00
Ed Sanders 835a775a49 build: Upgrade grunt-eslint from 19.0.0 to 20.0.0
Mostly indent and regex fixes.

Change-Id: Iaf9d02363c78cb71deec5c4cab53a05b67f60600
2017-07-18 12:55:33 +01:00
David Lynch c7486ae19b DesktopArticleTarget.init: more explicit no-welcome-on-protected-pages
Bug: T138715
Change-Id: I1d1efe7fb3286bbf85ea2a17356dcad1d3346517
2017-07-17 17:17:07 -05:00
David Lynch a2f8597712 DesktopArticleTarget.init: only show welcome dialog if page editable
"Welcome to wikipedia, anyone can edit, we welcome all improvements. Start
editing!" is a bit out of place when what you'll see after clicking "start
editing" is "you can't edit this page".

Bug: T138715
Change-Id: I9f655a5f12d4e45644bd01631c2d3131375d8e8f
2017-07-12 10:29:54 -05:00
Ed Sanders af25311201 DesktopArticleTarget: Regenerate title in all non-view page scenarios
Bug: T168236
Change-Id: I15f2aeb42b98855512970e2f07396fd7a7c97354
2017-07-01 17:27:07 +00:00
Ed Sanders fd1adfb3b5 Keep TOC in correct place in document
Change-Id: I6ad8cd8cbd7ef902204408673eb096b7405abd24
2017-06-22 15:16:15 -07:00
Bartosz Dziewoński 4f55d8066e Update for deprecation of OOjs UI openWindow/closeWindow promise
Bug: T166729
Change-Id: I95b85a8c0d488993c11da74e1d856fef6cf0ebb4
2017-06-02 00:21:58 +02:00
Timo Tijhof a9ce695f75 mw.DesktopArticleTarget: Use require() for mw.page.watch
Add 'require' to eslint global whitelist for this extension,
since ResourceLoader provides this in all contexts now.

Bug: T166254
Depends-On: I0e6a95bd4fbaba06eae5137ac7af84f62bebf6f0
Change-Id: I6b2fe57317dcff18ec6d9ea0cd9e4eb9c894c169
2017-05-24 21:17:02 +00:00
jenkins-bot 526d1ba71e Merge "Enable edit tab setup on appropriate Special pages" 2017-05-18 16:18:49 +00:00
Bartosz Dziewoński d687e01208 Do not check for visual editor availability when loading source editor
Follow-up to fefb76eebc. Prior to that
change, the condition for this looked like this:

  // … if on a ?veaction=edit/editsource page
  (
    isViewPage &&
    uri.query.veaction in editModes &&
    (
      uri.query.veaction === 'editsource' ||
      init.isVisualAvailable
    )
  )

In the refactor, the `uri.query.veaction === 'editsource'` check was
lost.

Since that code is pretty messy (probably predating the source editor
and hastily adjusted), instead change the check for `isVisualAvailable`
to just `isAvailable`. If the requested mode turns out to not be
available later, the editor will not load.

Bug: T165146
Change-Id: Idfaf9115dd20cec8f8e044a704b93b07984cdcee
2017-05-16 18:57:56 +02:00
Ed Sanders 63c36c87da Always prefer wikitext for action=edit on non-SET wikis
Ideally we could use the preferred editor, but this breaks
tab switching to the old editor.

Bug: T165238
Change-Id: I5f5ee5566cdd2080ba7c89d43cf127b457537768
2017-05-15 12:48:30 +01:00
Ed Sanders 9342e45f7b Fix action=edit links for NWE
We added support loading NWE from action=edit in I35208cce069
but missed this check in the front-end.

Bug: T165238
Change-Id: I2732eaa81a3f968b34c4e878b2ad36de981dd567
2017-05-15 11:52:06 +01:00
James D. Forrester 57aad56a7b Enable edit tab setup on appropriate Special pages
Using the forthcoming wgRelevantPageIsProbablyEditable.

Bug: T165010
Depends-On: I6c6ca1cfd93e7be917952980f1e1d57aec3a1292
Change-Id: I6c6ca1cfd93e7be917952980f1e1d57aec3a1229
2017-05-15 11:14:29 +01:00
Bartosz Dziewoński a02e68374e init: Fix checks for required skin elements to avoid false positives
* Do not try to load the editor on protected pages, or if the user
  doesn't have permission to edit pages.
* Move the check for required DOM elements after the check for
  pages without the editor (T162411) and after DOM ready (T163307).

Bug: T162411
Bug: T163307
Change-Id: I8149694ba8155682701f2cda6ca212d60f446caa
2017-05-01 11:24:01 +00:00
Ed Sanders cd8b059e7d Synchronise VE availability checks in frontend and backend
Adds better support for NWE loading on action=edit.

Change-Id: I35208cce0696607377378a1b58d426e914a3ba7d
2017-04-28 17:45:27 +01:00
Ed Sanders fefb76eebc Rewrite logic for choosing initial editor
Expanding from a single if-expression lets us make the
code much more readable, and reveals some minor bugs.

Change-Id: I49e57bfc093e019c837a73eab5c25fdbd14de0af
2017-04-26 12:07:51 -07:00
David Lynch e1e89e8b14 DesktopArticleTarget: only destroy notices tool if it exists
Bug: T163813
Change-Id: Ib957eac2d3d407f8e683082938ec51d882c2d041
2017-04-26 18:03:39 +00:00
Ed Sanders c02c529537 Load notices when switching, just don't show them
Previously we completely disabled the loading of notices
when switching, instead of just not showing them (so they
don't clash with the "switched" popup).

Bug: T162812
Change-Id: I3f8e787630e196cee1dbb1aa449b3558b74fcd04
2017-04-20 21:20:10 +01:00
Esanders eeab63d2c7 Revert "Dropping IE9: Remove disableUneditableContent from DesktopArticleTarget"
IE10 also lacks pointer events support.

This reverts commit 5266776953.

Change-Id: I42c9530c45ad98657b403bdb266188368085716b
2017-04-14 13:53:56 +00:00
James D. Forrester d989de5c09 DesktopArticleTarget.init: Don't call setEditorPreference twice
This is run after the targetPromise completes (via the platform-agnostic
setDefaultMode proxy), which is the correct time to do so. We should not
do this twice, and we definitely shouldn't do this before the target has
successfully loaded, lest a user ends up with us setting their option to
"prefer" an editor that they actually can't load. Whoops.

Bug: T156316
Change-Id: Icf4b5ddd9c8265ade55f43328f807344b41db350
2017-04-13 04:38:07 +00:00
jenkins-bot 77987b976d Merge "Remove #wpTextbox1 fallback from ArticleTargetLoader#requestPageData" 2017-04-10 17:05:03 +00:00
jenkins-bot edb911ef71 Merge "Dropping IE9: Remove disableUneditableContent from DesktopArticleTarget" 2017-04-10 16:50:59 +00:00
jenkins-bot c0361ab40e Merge "Update VE core submodule to master (da9c49395)" 2017-04-10 16:49:13 +00:00
Ed Sanders 5266776953 Dropping IE9: Remove disableUneditableContent from DesktopArticleTarget
Bug: T162277
Change-Id: Ibb38284573078098c2173232239e9836a8161f56
2017-04-10 08:37:03 -07:00
James D. Forrester d1c24ce226 Update VE core submodule to master (da9c49395)
New changes:
dc0cad28c tests: Factor out ve.dm.TestRebaseClient/Server into their own files
98061108b Convert RebaseServer tests to data provider
3e746a51b Update OOjs to v2.0.0
16231a812 [BREAKING CHANGE] Drop support for Internet Explorer 9
64daeb4b5 Localisation updates from https://translatewiki.net.
3310e876c Update DOMPurify to 0.8.5
579033a83 Follow-up 16231a81: Drop IE9 support in createDocumentFromHtmlUsingIframe

Bug: T162277
Change-Id: If17c6a3fac0920db29f80069f344ffd6be46c3c9
2017-04-10 08:32:51 -07:00
Ed Sanders ddf6a89c72 Remove #wpTextbox1 fallback from ArticleTargetLoader#requestPageData
Makes the API clearer and the method re-usable.

Change-Id: If79afb262e0c8c8e2193c07fef6bb0712496a4d9
2017-04-09 22:28:03 +01:00
Ed Sanders 981dd6c250 Don't set oldid if it is equal to curId
Change-Id: I0fff55ab1e8d9c5c24b39526aa5d8a893cd99a2a
2017-04-07 11:49:30 +01:00
Bartosz Dziewoński ae8b0a1f36 Replace $wgVisualEditorSupportedSkins with a check for required elements
The bare minimum of elements that must be present on the page for
VisualEditor to start and mostly work is:

* '#content' to attach our interface (toolbar etc.)
* '#mw-content-text' to replace with the editing surface
* '#ca-edit' to start up the editor

When those elements are missing (and we expect them to be present,
e.g. we're not on a special page), we print a console warning.

For example, VisualEditor now launches on Timeless and CologneBlue.
It does not launch and prints a warning on Modern and Erudite.
(It is actually possible to edit and save pages on CologneBlue,
although various pieces of the interface look funny.)

This does not change which skins we claim to support: these are still
currently only Vector, MonoBook and Apex. But it allows third-party
skin developers to more easily test the editor and fiddle with their
CSS to make it look right.

Bug: T161373
Change-Id: I97c786f3c8c795c238b10bef332a129ea26f86c2
2017-03-29 18:13:05 +00:00
jenkins-bot 11f562c4e2 Merge "Don't use '#content #firstHeading', unnecessarily specific" 2017-03-29 18:02:22 +00:00
Bartosz Dziewoński 645eb8e543 Don't use '#content #firstHeading', unnecessarily specific
Simply '#firstHeading' does fine.

Change-Id: I7c72496f0d58b86582bd33c018b618e1b75f2c7a
2017-03-29 17:37:29 +00:00
Bartosz Dziewoński 38db8bbe0e Consistently use #catlinks to refer to category links container
The element has both the class and the id set to 'catlinks'. This is
just for consistency, I have no preference on which to use.

Change-Id: Ic96b0f21fe790d0aa03bfd6366ba246e8493a038
2017-03-29 17:36:58 +00:00
jenkins-bot d3df69ee99 Merge "ve.init.mw.DesktopArticleTarget: Refactor redirect interface handling" 2017-03-28 16:41:40 +00:00
jenkins-bot 3d9b2fbd8a Merge "DesktopArticleTarget: Make the waiting module list extensible" 2017-03-28 15:59:02 +00:00
jenkins-bot 0dfe429a1e Merge "ve.init.mw.DesktopArticleTarget: Hide redirect subtitle if we cancel editing" 2017-03-28 15:43:09 +00:00
Bartosz Dziewoński 0462b6ed8f ve.init.mw.DesktopArticleTarget: Refactor redirect interface handling
Redirect pages have two extra things not present on normal pages:
* Redirect subtitle: the "Redirect page" shown under the page heading.
* Redirect page content header: the "↳ Foo" at the beginning of content.

Our handling was pretty messy and had some bugs (T161614).

Notable behavior changes:
* Update 'wgIsRedirect' in mw.config after saving the page.
* Use #mw-content-text rather than .mw-jump for inserting the fake .redirectMsg.
  .mw-jump is not guaranteed to exist on the page (it's a skin feature).
* Never replace the real .redirectMsg existing on the page, except by the
  new HTML after a page is saved. Our fake is separate now.

Bug: T161614
Change-Id: I96a5e45a71bf10bf6a2b501dc0cf81e6c37060ec
2017-03-28 17:40:23 +02:00