Commit graph

1015 commits

Author SHA1 Message Date
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