Commit graph

122 commits

Author SHA1 Message Date
Bartosz Dziewoński f491196559 Fix reporting of loading errors from ArticleTarget#loadSuccess
It was broken on desktop and on mobile, but for different reasons:

Desktop: In change 5f1c68945d,
I removed some code from DesktopArticleTarget that was checking for
`typeof errorDetails === 'string'`. I thought it was unused, but it
was actually needed for this code.

Mobile: overlay.reportError() doesn't work here: that method displays
the error inside the save panel, which is not visible at this point.

This is now solved by treating those errors as if they were API errors,
which is something we were already doing in ArticleTargetSaver.

Change-Id: I5207836f56d65171b1240cef02fc17b9956036ef
2020-02-12 22:18:40 +01:00
Bartosz Dziewoński f525f63b03 Remove hack to avoid iOS Safari menu bar area tap stealing
Explanation of what this code was for: T227628#5339392

As noted on that task, our behavior is actually unintuitive and
distracting, and iOS Safari limitations prevent us from doing it
better.

This reverts commit 600e369347.

Bug: T227628
Change-Id: Id1a5eebd06e4218e3e102165c60791999293d273
2020-01-31 21:22:23 +00:00
James D. Forrester 2c77e88d2c doc: Bump copyright year for 2020
Change-Id: I30539877543dc2a57bd1428a00d10ac46d8fc294
2020-01-08 09:13:24 -08:00
Ed Sanders edacc5bf65 MobileArticleTarget: Find DOM nodes after early return
No point running this jQuery search if we are about to return

Change-Id: I2240d4a15abbf7deb9b1f77154f299bd0d97ae18
2019-12-20 15:30:43 +00:00
Bartosz Dziewoński ef8ff1723a ve.init.mw.MobileArticleTarget: Don't close overlay when showing error
We've just displayed an error message in it, so don't close it.

I'm not sure if this code matters at all though. Usually when
there's an error during loading, code in MobileFrontend will close
the overlay and display an error message in a different way, so our
message won't be visible to the user. But maybe there's some case
I'm missing, and it's harmless. Closing the overlay was messing with
the MobileFrontend code though.

(found when working on I5146b726c5ce213992febb23f24c5937db0b9bfe)

Change-Id: Id1ea44d7bf6ef0f4fc0285e9e606dd415ed0a947
2019-12-11 05:55:25 +01:00
jenkins-bot 35f2093c62 Merge "Move more code to ArticleTargetSaver" 2019-11-14 21:26:24 +00:00
Ed Sanders b0f4b4c94e Move more code to ArticleTargetSaver
* Add a postWikitext method and split out postContent
  from postHtml
* Move saveSuccess handling into postContent promise
* Connect promise directly to saveComplete instead
* Pass whole response.visualeditoredit object, instead
  of splitting into variadic arguments for saveComplete.
* [DEPRECATION] Make serialize return the postHtml promise
  and deprecate passing a callback.

Change-Id: I905737515578000b2b87214c92e8b9fe9e82f6b7
2019-11-14 14:34:22 +00:00
jenkins-bot 26ebdd0796 Merge "ve.init.mw.MobileArticleTarget: Improve toolbar scrolling behavior on iOS 13" 2019-11-05 14:26:27 +00:00
David Chan 22098d6b16 Convert $.Deferred() to ve.createDeferred(), except in preinit
Follow-up to a8e07e026dea4f54241d1dbb6b7bcdbd8c670db2 in core.

Change-Id: I09333adb4876c6e584a4a6b6a1628227c4cd2616
2019-11-02 13:06:28 +08:00
Bartosz Dziewoński 95f0d5f428 ve.init.mw.MobileArticleTarget: Improve toolbar scrolling behavior on iOS 13
With this patch, the toolbar slides into place place nicely after
scrolling again, but it still occasionally flickers during the scroll.

* window.innerHeight is now smaller or something, and we have to
  twiddle the scroll position by a larger value.
* document.body.scrollTop no longer works for setting or getting the
  scroll position, so use different methods.
* requestAnimationFrame() now generates an insufficient delay to make
  scrolling happen, so use setTimeout() instead. We actually have to
  add a nonzero delay there, otherwise the toolbar sometimes doesn't
  animate like it should or flashes in random places on the screen.
  This delay is bad because the user can't start scrolling again
  during that time, but I think we can live with that.

Bug: T233470
Change-Id: I6c40ee8ce5994e12eadb085bbffd120ef160d4ee
2019-10-31 16:55:58 +01:00
Ed Sanders 4da31e7c9e Update VE core submodule to master (3075d3f8c)
New changes:
4af3f84f7 Mark surface as "showAsDeactivated" when opening a window
79eb0e4e5 ve.ce.Surface: Guard against focusing a un-initialized surface
4124c275e [BREAKING CHANGE] ve.ui.TargetWidget: Construct a real target inside the widget

Local changes:
* Use new target widget
* Remove calls to deprecated methods
* 'surfaceReady' event was upstreamed

Bug: T236400
Change-Id: I765d657c172d96c3b2e2ae5998083e4926a31f15
2019-10-25 17:16:17 +02:00
Bartosz Dziewoński e82f5ccf02 ve.init.mw.MobileArticleTarget: Remove error handling hacks for MobileFrontend
As of commit c65ed0e7a8ac5f32a3a6e4cb2760dae03e4fca22 in MobileFrontend,
it uses errorformat=html queries (the same as we do), so we no longer
need to massage the responses to make it happy. The same commit also
turned parseSaveError() into a no-op, so we can remove that as well.

Change-Id: I4f0109ce120ebf94e5709d47d775a8178ce216fa
2019-10-21 20:26:10 +02:00
Bartosz Dziewoński 8eef588593 ve.init.mw.MobileArticleTarget: Really deactivate the surface
The call to selectFirstContentOffset() below would re-activate the
surface and (attempt to) show the keyboard if the surface was
deactivated, but not shown as deactivated.

This might have worked correctly by accident before
I39fe44eee8eab7129340bcff796b6b9b3a59a398 in VE core.

Change-Id: I500309cc0aa8cd794175ae683a17c2614fd58cc9
2019-09-09 20:00:53 +02:00
jenkins-bot 03bdace1ba Merge "MobileArticleTarget: don't access the surface after it's destroyed" 2019-09-09 16:35:18 +00:00
David Lynch 74d7fe01be MobileArticleTarget: don't access the surface after it's destroyed
Some post-save scrolling would try to access the view before the
handlers were cleaned up.

Bug: T232347
Change-Id: I30433ef027c52d541351972f8ebb09fe6d45e436
2019-09-09 10:01:34 -05:00
Bartosz Dziewoński a1a082aafa MobileArticleTarget: Remove unused code (adjustContentPaddingDebounced)
As of I6c043e039fbef62a56f475b0dc365e171ab7bf59, this method is never
called. It was previously used to update the size of the toolbar when
context menus were displayed inside it, but they are now displayed
elsewhere.

Change-Id: I53030de1203a7f0d75780ae796bbb10082d5ef7a
2019-09-06 21:27:47 +02:00
Bartosz Dziewoński 08e16c0053 MobileArticleTarget: Remove unused code (hideSpinner)
As of I2f2495ab6c10116a6660f4361e49272cb95b988a in MobileFrontend,
the overlay never uses the default spinner.

Change-Id: Ie0aa624e33a5bd21fc20459697cca175d9de5606
2019-09-06 21:25:17 +02:00
Ed Sanders af0ca43125 Mobile surfaceReady: Account for selection changing in listeners
Bug: T232136
Change-Id: Ia49ea99320a8191a4d73703f1cbf3b9ef89035ec
2019-09-05 19:25:33 +01:00
David Lynch 1761b6d6d6 MobileArticleTarget: v1 of toolbar refresh
Bug: T211789
Bug: T230807
Change-Id: Ifd2319039628a8143dc09f6fa35e4a9825d3062c
2019-08-29 15:27:56 +00:00
Bartosz Dziewoński 756572ed8a ve.init.mw.ArticleTarget: Use errorformat=html when saving
When saving fails for a reason we don't handle explicitly, the error
message will have HTML formatting and will respect any on-wiki
overridden messages, rather than being plain text generic message.

Extensions providing custom SaveErrorHandlers may need to be updated.
The only one in Gerrit that requires a fix is TitleBlacklist:
Ibeae79c95557a7af699716c9d921f34c310bee6d.

* Remove handling for errors returned in .visualeditoredit.edit.info
  rather than .errors (.error in old format). AFAIK this is only used
  by some extensions, it is probably incorrect to do (T229539) and all
  extensions I know of that do this (AbuseFilter, SpamBlacklist,
  ConfirmEdit) have custom SaveErrorHandlers.

* Remove custom error messages for 'readonly' (identical to API
  response) and for 'hookaborted' (very unhelpful and there is a
  chance that the API response is better, if the extension causing
  this error generates any error message).

* Add a silly shim for MobileFrontend integration, because we allow it
  to handle error responses, and it expects them in the old format.
  This is probably subtly wrong in many ways, but MobileFrontend code
  only uses this for logging, so it shouldn't explode. In the future
  we will hopefully change it to use errorformat=html (T228897#5366960).

Bug: T229532
Change-Id: I3b9c4fefc0869ef7999c21cef754434febd852ec
2019-08-22 00:37:15 +00:00
Ed Sanders 32042d76e8 Update VE core submodule to master (fbbb9c4cb)
New changes:
854a1fa2c Distinguish active link styling

Local changes:
* Pull through active link styling

Bug: T228220
Change-Id: I925f88d32a514a749b96f501a211003bc4c924f0
2019-07-25 20:25:54 +00:00
Bartosz Dziewoński 0fb7d5efda Update VE core submodule to 962335a40293cf4b1314c0236788f35f080ae877
New changes:
a06204317 Fix TableNode unit test getOffsetFromCoords failure on Firefox
dfe0eb025 Refactor mobile context logic into ve.ui.MobileContext

Local changes:
* Pull through for edit cards refactor

Bug: T227532
Bug: T228767
Change-Id: I6c043e039fbef62a56f475b0dc365e171ab7bf59
2019-07-23 22:13:27 +00:00
Ed Sanders 393de5985f Update VE core submodule to abf2bfa85e64e67cdf963601fe1da2a11fd9e89a
New changes:
1a7460058 Remove ve.newMobileContext feature flag

Local changes:
* Remove ve.newMobileContext feature flag

Change-Id: Ia8def997b7cba4623866080752b06068d2118cc3
2019-07-23 22:12:48 +00:00
James D. Forrester 18472d84a2 Follow-up Id330efac: Only hide the welcome dialog on mobile
Change-Id: I8fa3c6100652d2f29a60bc22c8e08a4d9e79d37a
2019-07-10 13:10:27 -07:00
Bartosz Dziewoński cde7946bdc MobileArticleTarget: Don't show the welcome dialog
Bug: T227670
Change-Id: Id330eface30d5fad8c7264a2be1ceeb4df3a4952
2019-07-10 18:28:02 +00:00
jenkins-bot a5e87bca9a Merge "Pass newRevId through to MobileFrontend" 2019-07-02 19:16:07 +00:00
David Lynch 4d3ddb07e0 Pass newRevId through to MobileFrontend
Bug: T226847
Change-Id: I22daf4e7637c412aa444d98ec971bb294e4ade06
2019-07-01 15:59:55 -05:00
jenkins-bot 7796b569c9 Merge "MobileArticleTarget: Prevent unwanted page zooming on focus on iOS" 2019-07-01 16:14:35 +00:00
Bartosz Dziewoński 2563bb3d89 MobileArticleTarget: Prevent unwanted page zooming on focus on iOS
Bug: T216446
Change-Id: I48beb1e120b5b087533b0827904212be9286529f
2019-07-01 15:53:29 +02:00
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
jenkins-bot ed6d540289 Merge "MobileArticleTarget: Update loading interface for new design" 2019-06-13 20:00:34 +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
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 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 47af04b8d9 MobileCollabTarget: Cleanup toolbar
Change-Id: I4b2e21ce61cb647ca6a74bdbdd8def614ed41341
2019-05-14 20:19:54 +01:00
Ed Sanders 83b1e02286 MobileArticleTarget: Fix typo in tool config
Change-Id: Ib465ac175a3ab40584c0199b7801eca03644b2d5
2019-05-11 21:36:42 +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
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