Commit graph

216 commits

Author SHA1 Message Date
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
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 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
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
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 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
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
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
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
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 c0361ab40e Merge "Update VE core submodule to master (da9c49395)" 2017-04-10 16:49:13 +00: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 3d9b2fbd8a Merge "DesktopArticleTarget: Make the waiting module list extensible" 2017-03-28 15:59:02 +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
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
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
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
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
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 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 4abdf21413 Merge "Also allow opening in source mode if VE is unavailable on action=edit" 2017-01-03 20:19:09 +00:00
jenkins-bot a973528d67 Merge "Don't block VE/NWE from loading if 'editintro' is specified" 2017-01-03 20:13:29 +00:00
jenkins-bot f439843964 Merge "Factor out preferred editor check" 2017-01-03 17:50:42 +00:00
jenkins-bot f89a6a3880 Merge "build: Bump file copyright notices for 2017" 2017-01-03 17:11:04 +00:00