Commit graph

952 commits

Author SHA1 Message Date
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
Bartosz Dziewoński d905d705ce ve.init.mw.DesktopArticleTarget: Hide redirect subtitle if we cancel editing
To reproduce: start editing a page, turn it into a redirect,
cancel editing and go back to view mode. The "Redirect page"
subtitle under the page title should disappear.

Note that #redirectsub is correctly spelled all lowercase,
unlike #contentSub.

This reverts commit 0e1bc7309b
and fixes the code instead.

Change-Id: Ibacd73122dfec63268a77794bc77c4b88876d3ee
2017-03-28 01:31:29 +00:00
jenkins-bot 57d57cdbbf Merge "ve.init.mw.DesktopArticleTarget: Remove unused code" 2017-03-28 00:50:50 +00:00
Bartosz Dziewoński 0e1bc7309b ve.init.mw.DesktopArticleTarget: Remove unused code
As it happens, #redirectsub is correctly spelled all lowercase,
unlike #contentSub. This line does nothing. We remove #redirectsub
correctly elsewhere; I don't think this was ever meant to be here.

Follows-up 96421b283c.

Change-Id: I3e4c6eb2ff94f363b488477b3ddd248e571e723a
2017-03-28 00:39:38 +00:00
James D. Forrester 79b7d0305a *ArticleTarget: Don't trust oldid in the query string, it lies
Bug: T156998
Change-Id: Iacb94710c8f2f5fbd8d3de9c8a44424aba0c7d02
2017-03-24 00:30:00 +00:00
Ed Sanders 1adedfbd8b Disable clickable categories bar in wikitext mode
Bug: T160733
Change-Id: I79b7c880e63675a322b2ada053819b36a175ccbe
2017-03-20 11:07:52 +00:00
David Lynch 217640624a DesktopArticleTarget: Make the waiting module list extensible
So that GlobalCssJs and other extensions can hook in.

Bug: T156899
Change-Id: I045c7b045ce28047298b28a05e77ef27749c1ee1
2017-03-16 17:48:03 -07:00
jenkins-bot 85736d5a7b Merge "Follow-up eb8ba26a: Make MWNoticesTool#setNotices() display its own popup" 2017-03-16 20:14:05 +00:00
Ed Sanders 12c73bc01f Update VE core submodule to master (ef5dc965f)
New changes:
4b94f212e Add tool to change directionality of document view

Bug: T153356
Depends-On: I1e3d89e8250b75d0b6992cf4664e84de66d99bc0
Change-Id: Ic832cc661a0899b1668eb650fb09b66ada54d1ef
2017-03-16 12:42:42 -07:00
James D. Forrester ec5590418e Follow-up eb8ba26a: Make MWNoticesTool#setNotices() display its own popup
Running setNotices( [] ) makes MWNoticesTool run this.destroy() to avoid taking
up extra space in the toolbar when not needed.

Also, make setNotices() bail earlier.

Change-Id: I492fd59a1e15e8f296bf7f03d9b0035c40dafa59
2017-03-16 11:29:34 -07:00
David Lynch eb8ba26adf DesktopArticleTarget: Only try to show notices if some exist
This avoids an OOui deprecation warning for trying to toggle a popup which
isn't connected to anything.

Bug: T160161
Change-Id: I9ad97785f0de4ecf81d189985459689644e25923
2017-03-16 11:35:10 -05:00
James D. Forrester c07a6df74c Don't load VE or NWE on lint-targetted pages (until that works)
Bug: T160102
Change-Id: Ibb364ff2d89975d5907fa887cca666eee6e78d37
2017-03-15 14:23:17 -07:00
David Lynch 4864189781 DesktopArticleTarget: Discard edit summary when canceling an edit
Bug: T160130
Change-Id: I2a631b63c3f90bcd60a81312ee031f90dcbf6586
2017-03-14 10:53:21 -05:00
David Lynch 05e2a3119e ArticleTarget: Improve edit summary behavior when switching
Distinguish between the initial summary state, and a value stored from the
summary when switching modes. This lets us avoid overwriting a stored value
when section-editing, or assuming a stored value after a switch was never
edited.

Bug: T159686
Change-Id: Ie7640538140a14bbafd539b3a45928f5c55cf804
2017-03-09 14:23:36 -06:00
David Lynch d6c71632ef Switching modes created an infinite loop onBeforeUnload
Switching from visual to source reruns setupUnloadHandlers, which caused an
infinite loop where it thought it was its own fallback pre-existing handler.

Bug: T153346
Change-Id: I8df55a5395ede02fc34ec47a94f2c780dc08595f
2017-03-08 11:32:03 -06:00
jenkins-bot 5aba0ee22b Merge "Improve NWE new section styles" 2017-03-03 18:06:04 +00:00
Ed Sanders 06fa5166c7 Improve NWE new section styles
* Use <h2> for TextInputWidget to avoid duplicating skin styles
* Fix placeholder colour and font

Change-Id: I36c0b79ec9cbf3fa2ead0541ef5bac4a14a8781b
2017-03-03 11:59:06 +00:00
David Lynch 6cb6933e67 DesktopArticleTarget: Correctly bind section link handler
Since December, the handler now expects to be passed the mode we're switching
to. Since we're filtering for just the edit link and not edit source, we can
hardcode 'visual' here.

Bug: T159374
Change-Id: I160045dd59ff1b4c2d180dbbe37280a1839886df
2017-03-02 11:43:11 -06:00
Ed Sanders e163a09105 Use more specific event name for switching editor from the toolbar
As we are in the global toolbar event namespace, 'switch' could
mean anything.

Change-Id: I66751faa249710af634ed0fd0c2f2a0bcd872db3
2017-02-28 23:07:54 +00:00
Ed Sanders 109a136bd6 Use pencil icon for editor switcher dropdown
Pencil is the icon we use for 'edit' elsewhere in the UI.
Use the eye icon for the VE tool to specify 'visual'.

Bug: T116417
Change-Id: I12b6bab2a52758685abde04579b274a32d651174
2017-02-28 22:59:51 +00:00
Ed Sanders b3989e4f07 Move switching methods to ArticleTarget and fix in mobile
Change-Id: I7796dab5d2a24f9719870abf383925442b787612
2017-02-28 11:47:35 -08:00
Ed Sanders b3cfca5401 MobileArticleTarget: Don't explicitly set menu indicator
It is now inferred from toolbar position.

Change-Id: I9e3ac28aee74599b4b35ac2f870dca2556efb027
2017-02-28 10:37:30 -08:00
jenkins-bot 2e2a5e452c Merge "Use list tool group for editor switching" 2017-02-28 18:33:44 +00:00
Ed Sanders cb60db4c7f Use list tool group for editor switching
Bug: T116417
Change-Id: Iadf5a81e2733ab81fe25c686dcd6dad8eac3885c
2017-02-28 15:06:48 +00:00
Ed Sanders a3433e67fd Move modules loaded from DAT.init/TargetLoader to ResourceLoader
This will make it easier for third parties to load the required
modules for an article-like target.

Also cleanup mobileArticleTarget to better match desktopArticleTarget.

Change-Id: Idb75e2bd99d8cf2c298e101cf92e8af4f85f5ad5
2017-02-27 16:48:56 +00:00
David Lynch b1d68872b0 DesktopArticleTarget.init: Don't hardcode single-tab accesskey
Bug: T156141
Change-Id: I1312283437714bf338a8ee3cf63e93ac67db1c45
2017-02-14 11:24:50 -06:00
Ed Sanders 6bd650d50a Check for 'veaction' when clicking section edit links
Such as in the 'add topic' link.

Bug: T157104
Change-Id: Ide2d4cf8c23a5d0db24456d15b4312f7c0a5f922
2017-02-08 17:48:04 +00:00
Ed Sanders 7a058a4de8 Remove explicit toolbar indicator definitions
These are now computed upstream based on position of toolbar.

The menu tool now needs its indicator explicitly hidden.

Change-Id: Id2280f70553e1e45f3a42af45684c5808797925c
2017-02-04 10:25:37 +00:00
WMDE-Fisch a0af0b0529 Disable VisualEditor in the TwoColConflict extension
As for the Translate extension this will read a global set by the
TwoColConflict extension to disable the VisualEditor and its hooks
on the modified edit conflict page there.

Bug: T156251
Change-Id: I164d1546c9d98d8715650e13c63a01d06c76315d
2017-01-30 14:06:59 +01:00
Ed Sanders 1df022a6d6 Ignore section edit links when no action present
BUg: T156282
Change-Id: If3d039da36db946dcbba123d3cdc4e99c45f6a4e
2017-01-25 18:13:56 +00:00
Ed Sanders 171286c120 Fix typo in target config
Change-Id: I5815ce5b0e05ce166e02bfcced520e3770f5453d
2017-01-20 23:15:23 +00:00
Ed Sanders f58d00b110 Move #getWikitextFragment up to ArticleTarget
Change-Id: Ice4b04db4a45c07ccffc3892e6db5d814c2ec37b
2017-01-20 23:15:17 +00:00
Ed Sanders 1ae5c13cb9 Update VE core submodule to master (f0dcedb)
New changes:
5b448fa [BREAKING CHANGE] Merge Mobile/DesktopSurface into Surface
2d8959b Localisation updates from https://translatewiki.net.
7eee772 Follow-up 2d8959b: Fix build for added language 'io'
f0dcedb ve.dm.TableMatrix: Really indent ASCII-art comments

Change-Id: I62708f7caeb03b16cd318aab0b0ee3c674e75a26
2017-01-20 14:35:39 -08:00
Ed Sanders 889ffc0efc DesktopArticleTarget: Prevent infinite while loop if $content is empty
Change-Id: I629b2c3f1a4af3441764db7d1d0a7cec96181396
2017-01-11 18:29:16 +00:00
jenkins-bot 09829ae7b4 Merge "MWMetaDialog: Move categories to the top as they're used most" 2017-01-07 14:56:56 +00:00
jenkins-bot 4d64196fcb Merge "Fix loadFail parameter handling" 2017-01-04 22:46:27 +00:00
jenkins-bot e91f8f913e Merge "Allow 'T-' prefixed sections, and redirect if section link title isn't current page" 2017-01-04 22:38:34 +00:00
Alex Monk 1bcaa9056c Fix loadFail parameter handling
Rename them while we're at it.

Bug: T151278
Bug: T152429
Change-Id: I435ac148007db87da69e8cf48568fafa646abb71
2017-01-04 22:31:08 +00:00
James D. Forrester 6795430831 MWMetaDialog: Move categories to the top as they're used most
Bug: T74399
Change-Id: I696d8484ed00c92340f178d5c9dcfe978998dce0
2017-01-04 11:18:00 -08:00
Ed Sanders 808de2acea Add "templates used" page to meta dialog
Bug: T149009
Depends-On: Id617f9afbddf094140133f9659efc4b4e746148c
Change-Id: I63e663d05aefb47274f1f28bdcafc5317c2fc4f6
2017-01-04 18:30:11 +01:00
Ed Sanders b7dd6077b8 Allow 'T-' prefixed sections, and redirect if section link title isn't current page
Bug: T153176
Change-Id: Ic6fda78d00715777df4a273e7d3e150f20185185
2017-01-04 16:53:03 +00:00
jenkins-bot 1ac5ede187 Merge "Don't try to JSON stringify load error messages that are already strings" 2017-01-03 20:22:50 +00:00
jenkins-bot 4abdf21413 Merge "Also allow opening in source mode if VE is unavailable on action=edit" 2017-01-03 20:19:09 +00:00