Commit graph

1319 commits

Author SHA1 Message Date
Gergő Tisza de7c6e913b
Avoid undefined in Math.max
Math.max( undefined, x ) is NaN.

Change-Id: I60bde01d4fc6e9a52182753f79232045f48d1f8b
2020-10-14 23:51:02 -07:00
jenkins-bot 05ec421073 Merge "Don't navigate back immediately when trying to teardown" 2020-10-02 00:22:23 +00:00
Ed Sanders 27e19025a4 Fix cancelled browser-back on desktop
Bug: T263464
Change-Id: I808f7effffca5fbe9d8416d447df61dde57776c3
2020-09-21 16:23:18 +01:00
Ed Sanders 587dc1a3c8 Don't navigate back immediately when trying to teardown
Let MobileFrontend deal with all the history management.

Bug: T247171
Change-Id: I666b31285761c80407b4f0fe65c48f76b3e72bf2
2020-09-21 15:21:24 +01:00
Ed Sanders 7a61992fbb Store revid as undefined when document doesn't exist (revid=0)
Bug: T262838
Change-Id: I9ac1815e281544916ea9aded8e80039245c9d871
2020-09-16 11:13:38 +00:00
Ed Sanders 1c9bb2518c Drop iceweasel and blackberry tests for new jQuery.client
Change-Id: Ie5fd40415b6c38471ef6df875f67678326007552
2020-09-10 13:49:03 +01:00
jenkins-bot a7832b6bf5 Merge "Start using edit api results for watchlist UI updates" 2020-08-26 23:32:44 +00:00
Dayllan Maza 4fc73112ee Start using edit api results for watchlist UI updates
This patch starts using watchlist related values from ApiEditPage
results instead of updating the "watch link" based on whether the
checkbox was selected or not at the time of saving the article.

This change does not depend on T261030 and can be merged without it
but T261030 needs to be fixed or temporarily watched items will not
display the right tooltip when hovering the "watch link" or star icon.

Bug: T260434
Change-Id: I2c844223620d7d28f36a0cd8ae3dee4b0c8ae5bf
2020-08-26 23:08:47 +00:00
Bartosz Dziewoński b9a0def93a ve.init.mw.MobileArticleTarget: Fix floating toolbar workaround for iOS 13.6
If we call getBoundingClientRect() while the 'transform' animation is
still ongoing, it's going to return values reflecting the transform
- that is, the rect will be partially offscreen - which will trigger
our code that runs the animation again.

I don't know why this wasn't a problem on iOS 13.3 and earlier. Either
the timing was slightly different and the 'transform' animation was
able to finish earlier, or getBoundingClientRect() was buggy and
returned wrong values that conveniently worked right for us.

Bug: T259321
Change-Id: I6be0ddaeb6df54295fb14c45ba15fee41d61e33f
2020-08-21 23:33:37 +02:00
Ed Sanders 4545f53245 build: Update eslint-config-wikimedia to 0.17.0
Fix instances of variable shadowing.

Change-Id: I6e2befb020d7d4b506c7b46131eafacd951aa6d1
2020-08-18 13:16:49 +01:00
Ed Sanders dd862a837d MobileArticleTarget: Move MWBackTool to a separate file
Change-Id: I1561f454bcc779f97c758ba7178b09d15f52fe42
2020-07-31 16:15:10 +00:00
jenkins-bot b55ba6f1dc Merge "Also check for revid conflict when RESTBase says page doesn't exist" 2020-07-27 21:29:50 +00:00
jenkins-bot 9d1b3a6d49 Merge "Always rebuild category list from Parsoid data on surfaceReady" 2020-07-17 16:01:23 +00:00
David Lynch c190fab8ea Always rebuild category list from Parsoid data on surfaceReady
Rebuild the category list from the data we got from the API. This makes
it work regardless of whether we came here from activating on an
existing page, switching from source mode, or loading via an edit URL.

Because Parsoid doesn't include redlink status on the <link>s it
represents the categories as, we do have to manually update those
styles.

Bug: T251398
Change-Id: Iaaef3223816269bba1371fbb07956119a120c1ca
2020-07-17 10:24:00 -05:00
Bartosz Dziewoński 8702d59879 Toggle TemplateStyles at a better time during (de)activation to avoid flashing
Change $originalContent to $editableContent, as counter-intuitively
the editing surface is attached inside $originalContent, while
$editableContent contains only the hidden existing page content.
It was not a problem previously because of the order.

Bug: T254518
Change-Id: I68f7ddb45f09dff475b183ccfeaf98e67b83066e
2020-07-15 21:27:27 +00:00
jenkins-bot 51b8ff5a72 Merge "Remove warning shown when editing a translatable page source" 2020-07-08 20:18:19 +00:00
Bartosz Dziewoński 4ea0cf0cab MobileArticleTarget: Double-check that section is not 'undefined'
It's supposed to be a string or null. The parent class sets
`this.section = null` for us by default.

Bug: T257355
Change-Id: I375a3f6724235f22888bb7f0cb77a7081153768e
2020-07-07 20:50:59 +02:00
Abijeet 24c8b2d2b6 Remove warning shown when editing a translatable page source
Translate itself will show an warning dialog when user tries to edit
a translatable page in visual mode. Editing in the source mode is
allowed.

Bug: T192052
Depends-On: I03ea64353b2d5b28d684f90936cab75ea4fd40d2
Change-Id: Ie4f3a6003c27773c6d0c5086c876fe424befe25a
2020-07-07 11:49:19 +05:30
Bartosz Dziewoński 36bd09c429 Also check for revid conflict when RESTBase says page doesn't exist
There used to be similar code here, but it was removed in 2015 in
85b745666f because it wasn't correct in
some cases. Restore it and instead separately check for those cases.

Bug: T257124
Change-Id: Id4a17266111d064805aa0ca865182bb2f4b019eb
2020-07-05 19:42:12 +02:00
jenkins-bot 6f6c4828a7 Merge "When returning to section, avoid counting sections outside the content" 2020-06-22 22:30:44 +00:00
Mvolz 842a728488 Revert "Allow generic params to be passed to getWikitextFragment"
This reverts commit e5c1ef651b.

This change caused an error where templates failed to be inserted
into wikitext in the 2017 wikitext editor.

Bug: T255785
Change-Id: Ie57c49e68e594be22af2b1b479840f29e46131db
2020-06-19 13:15:23 +00:00
Ed Sanders 013b7419bf build: Update eslint-config-wikimedia to 0.16.2
Use jsduck config

Change-Id: I5cd7bbcee83b0fa148b8fb8c3b4adcf08f96cefc
2020-06-18 19:16:52 +01:00
jenkins-bot 15443d35c5 Merge "Allow generic params to be passed to getWikitextFragment" 2020-06-15 20:42:45 +00:00
Ed Sanders 9c8195f823 Replace browser blacklist/whitelist with (un)supportedList
Bug: T254646
Change-Id: Iac0fc850520f2a83954d3fac21b38715e2f76a8c
2020-06-10 16:30:57 +01:00
Bartosz Dziewoński 27ca1082a9 When returning to section, avoid counting sections outside the content
Bug: T254593
Change-Id: I8126e21b3732b45c0a5b418e3832ccc4c72a1b73
2020-06-05 17:56:08 +02:00
Ed Sanders e5c1ef651b Allow generic params to be passed to getWikitextFragment
mw.Target doesn't know about revid and etag, so move that logic
to ArticleTarget, where the param can still just be a boolean.

Change-Id: Idf4632cd28554aaf5bbf5f2b44ded047c0c4b182
2020-06-04 22:45:09 +01:00
jenkins-bot 7a2fffae39 Merge "When switching from wikitext to visual, preserve the edit checkboxes" 2020-06-04 15:10:51 +00:00
Bartosz Dziewoński 186f5dc424 When switching from wikitext to visual, preserve the edit checkboxes
This handles the minor edit and watch checkboxes, as well as any added
by extensions (e.g. FlaggedRevs).

Switching in the other direction already works fine, that is
implemented in ArticleTarget#getSaveFields.

It doesn't seem ideal to put this code into the constructor of
ve.init.mw.DesktopArticleTarget, but that's where we already have
similar logic for the edit summary. I filed T253696 about this.

Bug: T250388
Change-Id: Ia6a9c0465ed215e8f74b9fff4590593383e9a1e6
2020-06-03 23:30:45 +02:00
Ed Sanders 6076708ff3 build: Update eslint-config-wikimedia to 0.16.0
Change-Id: I638e0f82949597e2a2e4ea18fc2f0258f225358c
2020-06-02 21:30:00 +01:00
Bartosz Dziewoński 61de7530c7 Improve deactivating tabs when switching/exiting on MonoBook etc.
Previously we didn't deactivate them, so if you opened VE, then
switched to NWE, then exited the editor, all three tabs would appear
active.

Change-Id: I904d6daf2896ceadf004f5e57a88c2359f33fd44
2020-05-14 20:24:57 +02:00
Ed Sanders 0c6b6e3e89 Improve shortcut in getWikitextFragment
Use hasContent to
1. Catch cases where the document is empty, e.g. <p></p>
2. Avoid having to use the converter

Change-Id: Ib1bb36824ca871e535bef38cef8137fdfb81b53e
2020-04-29 17:32:09 +01:00
jenkins-bot 3e519667a1 Merge "DesktopArticleTarget: Move shouldShowWelcomeDialog() to init" 2020-04-21 21:27:04 +00:00
jenkins-bot 3e70794645 Merge "ArticleTarget: Move shouldShowWelcomeDialog() into DesktopArticleTarget" 2020-04-21 21:27:01 +00:00
jenkins-bot c8cffbd394 Merge "ArticleTarget: Clean up WelcomeDialog show/hide handling" 2020-04-21 21:25:36 +00:00
Roan Kattouw e0125e3e9d DesktopArticleTarget: Move shouldShowWelcomeDialog() to init
Move shouldShowWelcomeDialog() and stopShowingWelcomeDialog() from
DesktopArticleTarget to DesktopArticleTarget.init, and use them to
deduplicate code in init that manages the wikitext welcome dialog.

Look for both the vehidebetadialog and hidewelcomedialog URL params.
The code in DesktopArticleTarget used vehidebetadialog, but the code in
init for the wikitext welcome dialog used hidewelcomedialog.

Bug: T249954
Change-Id: I19f1a2da36bc65addb52811c3d3c73c1259bc8f5
2020-04-21 11:41:59 -07:00
Bartosz Dziewoński b01c69a800 mw.ArticleTarget: Fix #saveErrorBadToken / #saveErrorNewUser calls
Follow-up to 8065fdf2b9.
I noticed this while trying to reproduce an unrelated bug.

Change-Id: If5b18b055cbee6fc2513161a4f445667dd2a72e0
2020-04-21 18:52:02 +02:00
Roan Kattouw e1f4e3f148 ArticleTarget: Move shouldShowWelcomeDialog() into DesktopArticleTarget
The base class doesn't use it, it only defines it, and
DesktopArticleTarget is the only subclass that uses it.
MobileArticleTarget calls it, but also overrides it to be a no-op.

Change-Id: Ib3feea94844f4e1ed71dccece7657450516cac89
2020-04-17 15:46:07 -07:00
Roan Kattouw 7457834dc5 ArticleTarget: Clean up WelcomeDialog show/hide handling
Factor out the logic for whether the WelcomeDialog should be shown into
its own method, and write it in a less confusing way. Do the same thing
with the logic for setting the preference/storage/cookie for hiding the
WelcomeDialog.

This makes maybeShowWelcomeDialog() much simpler, and removes duplicated
code in DesktopArticleTarget.

There is one minor change in behavior: if the WelcomeDialog is
suppressed using the URL parameter, that no longer causes the preference
to be updated as if the dialog had been shown.

Change-Id: I1d4f912c5f6bd7a2bbad2b209b97c3ec1f250a07
2020-04-17 15:46:07 -07:00
Ed Sanders 651756c4fc eslint: Enable the mediawiki/class-doc rule and make pass
Also minor other adjustments

Change-Id: I9ee48359e3e53799f2f6240e44b53972283ce328
2020-04-17 22:59:11 +01:00
Bartosz Dziewoński 92c3055628 Fix issues with treating section "numbers" as integers
In MediaWiki, section numbers may be prefixed with 'T-' if they refer
to sections on a transcluded page, so they are not really numbers.

Change e2cb9ce93e caused us to treat them as strings most of the time,
but it looks like there are several places where we treated them as
integer numbers, which I missed when making that patch.

The first two changes in ArticleTarget#restoreEditSection fix T248795
and T248968/T249112, respectively. The other changes are cleanup.

Bug: T248795
Bug: T248968
Bug: T249112
Change-Id: I8373a7ab515595769ce6f3051a182c922415b643
2020-04-01 21:41:17 +02:00
jenkins-bot 774c3ec1e4 Merge "Move MWutils to preinit and rename to parsoid utils" 2020-03-24 22:31:17 +00:00
Ed Sanders de47496b19 Move MWutils to preinit and rename to parsoid utils
Bring in ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref
and ve.resolveUrl, so that the file has no dependencies on VE.

Change-Id: I03bc455d5484a6c51f3fa2397c64936b829fe7e3
2020-03-24 23:13:16 +01:00
Bartosz Dziewoński 494fc439fd Fix new section title when switching from NWE to OWE
This code path is triggered when saving a new section in NWE causes an
edit conflict, which should be impossible, but apparently does happen.

Add some TODOs for parameters being added to the API calls in weird
places, instead of the dedicated methods.

Bug: T248364
Change-Id: I0686671e86e35f9ba503d0dd84e9074dde72dc10
2020-03-24 21:57:03 +01:00
Bartosz Dziewoński 7b47575a45 Add accessibility labels to all type: 'list' toolbar groups
Bug: T245776
Change-Id: I67d8e239f4fed7dd7ac4b98be3362426e753076b
2020-03-14 14:13:53 +01:00
jenkins-bot 2c1383b79e Merge "Move checkbox widget creation to mw.libs.ve" 2020-03-13 18:13:46 +00:00
Ed Sanders e3d3e0869d Move checkbox widget creation to mw.libs.ve
So this can be used other VE API users (e.g. DiscussionTools).

Bug: T245222
Change-Id: I1e0e9bb9da53a62f8a20126e579dcd6300bd2376
2020-03-13 18:00:44 +00:00
jenkins-bot a5420c624a Merge "Update VE core submodule to master (ff82c0966)" 2020-03-11 23:32:23 +00:00
Ed Sanders 0091d69231 Update VE core submodule to master (ff82c0966)
New changes:
8a3e25b98 build: Updating acorn to 7.1.1
032a2520d Localisation updates from https://translatewiki.net.
ff82c0966 [BREAKING CHANGE] Remove ve.init.target lookup from TargetWidget

Local changes:
* Pass toolbarGroups explicitly form Target to TargetWidget

Change-Id: I4ff6f432412ab958f2858879b2b857278866350a
2020-03-11 23:59:10 +01:00
Ed Sanders bcfb250f56 Ensure that ve.init.target is correct when re-activating an ArticleTarget
Change-Id: Ic30cd99583019823b51f52ab97ee6f9d7adc53f2
2020-03-11 14:45:37 +00:00
Ed Sanders 8726a71342 Move switchToWikitext to switchToFallbackWikitext
This should be a no-op as the inherited switchToWikitext
implementation will always call switchToFallbackWikitext
if 'source' is not passed as a supported mode (which it
isn't currently in MobileFrontend).

Change-Id: I213e7d54d158127b5c42bc05ff9ea2dececc42fe
2020-03-09 18:55:15 +00:00