Commit graph

7729 commits

Author SHA1 Message Date
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
jenkins-bot ae404ff919 Merge "Remove some hardcoded CAPTCHA support code" 2020-04-17 19:56:57 +00:00
Sohom Datta d16d93ccf7 Treat links to diffs and history pages as external links
Wrote code such that only redlinks and normal page urls
 using the script path are treated as internal links.

Bug: T248076
Change-Id: Ie476bf7f4b389a659899eab4351c912fc6b24bee
2020-04-17 22:48:14 +05:30
libraryupgrader d1efaac5b2 build: Updating npm dependencies
* eslint-config-wikimedia: 0.15.0 → 0.15.3
  The following rules are failing and were disabled:
  * mediawiki/class-doc
  * mediawiki/valid-package-file-require

* grunt-banana-checker: 0.8.1 → 0.9.0
* grunt-stylelint: 0.14.0 → 0.15.0
* stylelint-config-wikimedia: 0.9.0 → 0.10.1

Change-Id: If718fe8876cc4721602757d38fe06ab421ce8d80
2020-04-16 22:55:11 +00:00
jenkins-bot 298a889319 Merge "DesktopArticleTarget.init: Also extend existing URL in SET mode" 2020-04-16 19:07:18 +00:00
jenkins-bot faa6d75de8 Merge "Adding accessibility label to template and field name edit textbox" 2020-04-16 17:04:54 +00:00
Bartosz Dziewoński 1846b72998 Remove some hardcoded CAPTCHA support code
While we pretend that the ConfirmEdit CAPTCHA support is added by
ve.init.mw.CaptchaSaveErrorHandler in the ConfirmEdit extension,
we still have a bunch of code here required for it to work.

This commit removes some of it, no longer needed after
I6605017fd31a4f96c529dd0beb69e9f4433cebc1.

Depends-On: I6605017fd31a4f96c529dd0beb69e9f4433cebc1
Change-Id: I41e032fd754927b7ea6cfb767eb9f21b522ccacd
2020-04-15 13:18:47 +00:00
Roan Kattouw de2baff16d DesktopArticleTarget.init: Also extend existing URL in SET mode
This unbreaks the use of ?vehidebetadialog=1 on page views (i.e. without
action=edit) in single edit tab mode.

Bug: T249957
Change-Id: I0109f5d95cebbb3e585d25b7623764cc7350cda0
2020-04-14 17:01:23 -07:00
Akinwale Alagbe 3b7a567bfc Fix: Adding label to source editor switch editor tool
Change-Id: I7cd90bbbd0f65c0a5b0588fd337e922a63b618b5
2020-04-06 18:10:26 +00:00
Akinwale Alagbe 229a249cca Adding accessibility label to template and field name edit textbox
Change-Id: Ieeb29de8534300751956eb76477b38578478b4a2
2020-04-02 21:02:55 -07:00
jenkins-bot 443cb0fe55 Merge "Overwrite "edit source" link only when needed" 2020-04-01 21:51:56 +00: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
MtMNC fd0b145db3 Overwrite "edit source" link only when needed
Prevent JS from overwriting the contents of the "edit source" link
if the change is unnecessary as it can break third-party skins.

Bug: T248025
Change-Id: Ica1e45488813877583efadabc72526544e8943ac
2020-03-27 12:20:33 -07: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
jenkins-bot 6c29d69e33 Merge "MWTransclusionDialog: Set 'aria-expanded' on "Show/hide options" button" 2020-03-19 19:57:37 +00:00
jenkins-bot 007604dd24 Merge "Update VE core submodule to master (cf72879d2)" 2020-03-19 19:51:19 +00:00
Akinwale Alagbe 2aeae1c3f9 MWTransclusionDialog: Set 'aria-expanded' on "Show/hide options" button
Adding the ability for screen reader to announce 
the state of the Transclusion dialog 
when the show/hide options button is clicked.

Bug: T248089
Change-Id: I89b86179bcb63376e480cb8df55e24b9d29df037
2020-03-19 19:43:14 +00:00
jenkins-bot fe15e3cc89 Merge "Add accessibility labels to all type: 'list' toolbar groups" 2020-03-19 19:35:52 +00:00
Ed Sanders 788c57a3ea Update VE core submodule to master (cf72879d2)
New changes:
cf72879d2 Show sum/average when selecting multiple numeric cells

Local changes:
Implement number parsing/formatting for table summing

Bug: T247877
Change-Id: I52af622dc8cfe7e77fd7ce88428be092d5b092a2
2020-03-19 12:26:26 -07:00
Bartosz Dziewoński e2cb9ce93e Remove incorrect handling for 'T-' prefix in section numbers
When a page is preprocessed for transclusion, sections are numbered
differently, and the 'T-' prefix indicates this. It can't just be
removed.

It seems that all of our other code can handle section "numbers" like
"T-1" just fine.

Bug: T246164
Change-Id: If19a2d48f94411a89525fb605169c7f8dd4b1797
2020-03-18 21:23:38 +01:00
jenkins-bot 39a8ecf890 Merge "Remove X-Parsoid-Variant configuration value, which is no longer needed" 2020-03-17 00:13:39 +00: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
Akinwale Alagbe a65c905287 Adding aria-label to the widgets in page settings that fail accessibility
Bug: T247048
Change-Id: I08469c9a38d905b8953b471f11839a5b99f4e7c8
2020-03-13 20:54:43 +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
jenkins-bot cb9895e304 Merge "Ensure that ve.init.target is correct when re-activating an ArticleTarget" 2020-03-11 23:28: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
C. Scott Ananian ce094c72d4 Remove X-Parsoid-Variant configuration value, which is no longer needed
Reverts Ib1403638b12ec5808f6b81bd114949043aa9ac2e.

Bug: T229074
Change-Id: I9bbc02821d5ee82c9944516ab07d3cb380d2f3a8
2020-03-11 13:24:43 -04:00
jenkins-bot 74ee640664 Merge "ve.ui.MWSaveDialog: Remove meta element filtering from wikitext preview" 2020-03-11 15:26:05 +00: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
jenkins-bot ee43838e79 Merge "Making Categories page in page option dialog accessible" 2020-03-10 19:48:57 +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
Ed Sanders bc29a8cdd1 MobileArticleTarget: Remove definition of editSource, identical to parent
Change-Id: I939b34416722fe81f643ca48fe1c5f8ea9e3cbc5
2020-03-09 18:55:05 +00:00
Akinwale Alagbe 30c90b867a Making Categories page in page option dialog accessible
Bug: T247122
Change-Id: Id91438bf6bc1bf0781fbbcbed32326c5700bfb7d
2020-03-06 13:32:48 -08:00
Bartosz Dziewoński 734c929ea0 Add some accessibility labels to buttons on mobile
Various buttons have a label on desktop, but only an icon on mobile.
We should still use the label for accessibility.

Change-Id: I2b49a80e174dc30ae997a69662643b28b428263a
2020-03-06 15:09:44 +01:00
Bartosz Dziewoński d0c45940d0 ve.ui.MWSaveDialog: Remove meta element filtering from wikitext preview
Once upon a time, we added code to filter <style> and <link> elements
from the rendering of templates in visual editor, because attempting
to cut them would crash Chrome (T52043).

There are at least three reasons why that is not needed here:
* The preview is not editable text, so you can't cut from it
* The Chrome bug was fixed 7 years ago anyway
* We now use TemplateStyles in articles and they work just fine

The code was added here in 9dd638a5ab
without explanation, I think it was just done for consistency.

Bug: T212085
Change-Id: I0712e3a081f04d0b74cda47652fa6eb118dfe7b2
2020-03-05 16:57:51 +01:00
jenkins-bot c69b46adfc Merge "Clean up code related to token and bad token handling" 2020-03-05 11:25:58 +00:00
jenkins-bot 5bcd4a82f8 Merge "Use built-in mw.Api 'badtoken' handling, also 'assert'/'assertuser'" 2020-03-05 11:25:46 +00:00
jenkins-bot becafcdadf Merge "Fix checkbox handling in the API" 2020-03-02 18:06:36 +00:00
Ed Sanders 42194ec411 Fix checkbox handling in the API
The code for setting 'watchlist' in the EditAPI request
was completely broken as it always evaluated to 'unwatch'.
Instead pass through 'watchlist' directly from the client
where it must be set to 'watch' or 'unwatch'.

Bug: T245579
Change-Id: Ia5a2bb76ef35a685b39bcc0c4727796acd0f510d
2020-02-29 17:35:29 +00:00
jenkins-bot f2cc6d9fc0 Merge "NWE: Don't change editor preference if visual mode not available" 2020-02-27 17:23:53 +00:00
Ed Sanders 71157aab76 NWE: Don't change editor preference if visual mode not available
Bug: T246259
Change-Id: I1513098be707ca5c1a40a061917487785f5100e8
2020-02-27 16:53:45 +00:00
Derk-Jan Hartman 9655bee7de Fix dimensions of WE2017 switch to VE
Correct dimensions are 32px, not 34px.

Bug: T223155
Change-Id: I74da7fc12b642984a680d58c20af054ebaf2e64c
2020-02-26 14:02:41 +01:00
jenkins-bot 4a2d636dab Merge "Fix: non descriptive announcement of version no." 2020-02-25 22:00:52 +00:00
Akinwale Alagbe dd91c3cd09 Fix: non descriptive announcement of version no.
When user navigate to the version number,
the screen reader only narrates the hexadecimal number
associated with the version label without providing context
about what this number represents

Bug: T245470
Change-Id: If9cccac0d71de2de5da96a3a053d21e3deb0d80c
2020-02-25 21:45:31 +00:00
jenkins-bot a2ceb67351 Merge "Fix:Internal and External Link annotation widget" 2020-02-25 16:03:01 +00:00
jenkins-bot a0cf9cb9f6 Merge "ve.ui.MWEducationPopupTool: Autofocus the button to close it" 2020-02-25 14:28:05 +00:00
Akinwale Alagbe d3292378cc Fix:Internal and External Link annotation widget
Adding the ability to special aria-label for the link annotation widgets
in order to aid accessibility to visually impaired audience

Bug: T245294
Change-Id: I3e1fd4a3e3a951092b5212397acc38b2b89a23c2
2020-02-24 16:40:19 -08:00
jenkins-bot 119d3df502 Merge "Remove incorrect init special case for wikitext single edit tab" 2020-02-20 22:39:13 +00:00
Bartosz Dziewoński 387e0d3cb3 Remove incorrect init special case for wikitext single edit tab
This line was added in 9eebfbcac5
and I can't tell what it was supposed to do (that commit's message
only says "Fix NWE-only edit tab", thanks a lot).

Since then the init code was refactored a lot, at some point this
line was moved to be a part of a completely different check (???),
and now it's causing visual mode to be disabled even though the
user only set their preferences to *prefer* wikitext mode.

Bug: T243723
Change-Id: I3c1f502c3cd079fc5eeb2e9587b22d854ae3a72c
2020-02-20 22:37:45 +01:00
Adam Wight c0ad11b960 Purge autosave before submitting merged content
When using TwoColConflict with VisualEditor, the autosave buffer wouldn't
be cleared after saving the successful merge.  This would cause a user to
see a "restore changes?" prompt the next time they entered the editor,
with the potential to confuse them and cause them to do extra work,
repeating the conflict resolution unnecessarily.

This change purges the autosave buffer before submitting a merge.

Note that it is not transactional, so there is a chance we're losing the
autosaved content even if the submit will fail.

Bug: T245119
Change-Id: I150023f548c5565412769d644a828176f907bc25
2020-02-20 09:43:26 +01:00
Bartosz Dziewoński 8c949955e6 ve.ui.MWEducationPopupTool: Autofocus the button to close it
Change-Id: I4c2a3620b0477492713580baab8c3ae503009ed5
2020-02-19 00:25:37 +01:00
jenkins-bot 13108d8f4d Merge "ve.init.mw.DesktopArticleTarget.init: Update for Minerva changes yet again" 2020-02-16 00:13:18 +00:00
jenkins-bot 95a20dbc08 Merge "ve.dm.MWGalleryNode: Preserve 'class' attribute unchanged" 2020-02-15 16:59:56 +00:00
Bartosz Dziewoński a0c603a137 ve.init.mw.DesktopArticleTarget.init: Update for Minerva changes yet again
This continues to take more effort than all other skins combined, but
still every time our overrides get less crazy. Maybe, and stay with me
here, maybe a year and five patches from now I'll remove the last one.
See 91f99ce78d for the last time.

Change-Id: Id880d1cd1ecef59635b347102dc2107204382fb2
2020-02-15 16:40:57 +01:00
Bartosz Dziewoński 8065fdf2b9 Clean up code related to token and bad token handling
Things I noticed while writing I37f8e89b6d92c419d1b6569891612256342f8139,
but which felt too messy to include in that commit.

* Use promise chaining
* Update documentation
* Remove redundant code
* Split a method that now handles two different errors
* Grumble about localisation messages

Change-Id: I81e28a03af4f6c3452679ef6bbcaa89bb1235122
2020-02-15 03:52:40 +01:00
Bartosz Dziewoński 58757d4e3e Use built-in mw.Api 'badtoken' handling, also 'assert'/'assertuser'
When the user is saving their edit, we want to ensure that they
understand how it will be attributed. If the user gets logged out or
logs in in another tab, we want to display a message about it before
saving.

Instead of manually managing tokens and handling the 'badtoken' error
to detect this, use the 'assert'/'assertuser' parameters for the API
to detect it for us. Thanks to this we can rely on automatic retrying
for 'badtoken' errors in mw.Api#postWithToken.

It will be possible to share some of this code with other extensions
that already use ArticleTargetSaver, namely DiscussionTools, now that
it doesn't need to manage tokens for VisualEditor.

Bug: T245327
Depends-On: I485f99e1f5f493262b0c9af22370da01adf1e09c
Change-Id: I37f8e89b6d92c419d1b6569891612256342f8139
2020-02-15 03:37:22 +01:00
Bartosz Dziewoński 26062fd3a0 ve.dm.MWGalleryNode: Preserve 'class' attribute unchanged
By removing this line, we fall back to the default behavior,
which is to copy the attribute from the original DOM element.

The gallery is supposed to have a class indicating the type (packed,
traditional, etc.). However, Parsoid doesn't care about that and
instead reads the type from 'data-mw'. Instead, changing the attribute
is causing dirty diffs.

Bug: T214649
Change-Id: I96b5a21777046b1caf07a3b1def9fad81bb15939
2020-02-14 22:05:50 +01:00
Bartosz Dziewoński 9119e57a2e Improve rendering of audio files (for real this time)
ve.dm.MWImageNode:
* Define sensible scalable properties for audio files. They are now
  scalable to any width but have a fixed height. (Ideally they would
  have no concept of height, but that would require many more changes.)
  This prevents them from resetting to 0x0 when resized.

ve.ce.MWBlockImageNode:
* Remove override for #isResizable, audio files can be resized now.
* Move #updateMediaType to MWImageNode mixin so it applies to
  MWInlineImageNode as well.

ve.ce.MWImageNode:
* Add #updateMediaType from MWBlockImageNode.
* Hide the real image 'src' using CSS rather than changing the
  attribute. It seems the previous solution depended on the order in
  which methods are called, because it stopped working when I moved
  the code here. (This depends on VE/VE change If5b1b5b5d.)

audioPlayer.svg:
* Make the file nicely resizeable. The dimensions of the "play" icon
  and time are fixed, the bar adjusts to the width of the container.

Bug: T206022
Change-Id: Ia0f38ca11e0d55a5b725fd9aeb6c79ec1345376d
2020-02-14 04:18:28 +01:00
jenkins-bot 5bcfdcd963 Merge "Localize remaining hardcoded English error messages" 2020-02-13 00:20:07 +00:00
jenkins-bot 2b8f2c276d Merge "Fix reporting of loading errors from ArticleTarget#loadSuccess" 2020-02-12 23:33:06 +00:00
jenkins-bot 99b0a33e99 Merge "ArticleTargetSaver: Fix error messages" 2020-02-12 23:33:03 +00:00
Esanders c9b2e8b4d2 Only preserve data-parsoid/RESTBase ID on transclusion nodes
The previous attempt to fix this didn't preserve any attributes
but removing data-parsoid can result in a loss of wikitext formatting.

This reverts commit bdfd4b6d8f.

Bug: T207325
Change-Id: I2a38e651d17262889eddb149c72c9e08b4e56ed0
2020-02-12 22:51:43 +00:00
Bartosz Dziewoński c95be08cc4 Localize remaining hardcoded English error messages
Bug: T227325
Change-Id: Ibee27bd8457f83910da03ecb8801e5f26bdb3b2a
2020-02-12 22:18:40 +01:00
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 6d993fee49 ArticleTargetSaver: Fix error messages
Follow-up to 5f1c68945d, which renamed
these messages while moving them into MediaWiki core.

Also, parse HTML in them. This is consistent with real API error
messages, and with the behavior of mw.Api#getErrorMessage. (And also
fixes potential HTML escaping issues.)

Change-Id: I307ca9873e245169a0d4b43499317acbac69fb9b
2020-02-12 22:18:40 +01:00
jenkins-bot 94abf22847 Merge "Add .mw-parser-output to historical visual diffs" 2020-02-11 22:25:59 +00:00
Bartosz Dziewoński 115c0b03fa Add .mw-parser-output to historical visual diffs
It was already added for visual diffs inside the editor. This fixes
some minor styling issues, e.g. the arrow after external links is now
shown.

Bug: T244673
Change-Id: I3ea72930ee7822a7579ebe787654d716f5947224
2020-02-11 21:12:19 +01:00
Bartosz Dziewoński 2f5856bd2e Fix EditAttemptStep events logged with revision_id=0
When opening the old wikitext editor, 'wgRevisionId' is always set to
0, and remains that way even if we switch to visual editor.

Elsewhere in the code, we handle this case by reading the revision ID
from the old wikitext edit form, so do that here as well. (This still
works after switching to visual editor.)

Bug: T230133
Change-Id: I9d3a23beb6b1393633b94ac3c9c6c667d7560308
2020-02-11 19:37:22 +01:00
jenkins-bot 5b2ba08c44 Merge "Use WMUI styled WikiEditor switcher when in Vector" 2020-02-08 02:37:12 +00:00
Ed Sanders eebe103fe4 Use WMUI styled WikiEditor switcher when in Vector
Bug: T223155
Change-Id: I6cf305e77cfeda96e7736dc26f1d7feff6fb3911
2020-02-07 18:20:39 -08:00
Bartosz Dziewoński a816baedd9 Fix handling of pasted internal red links
Bug: T239550
Change-Id: Iacfba4b46bea8294f12a0c010344fda317f75df6
2020-02-07 17:41:19 +01:00
David Lynch 0d6f984cc5 Change tags method so anon edits will go through
It turns out anonymous users can't apply change tags, so change
I2c1d0f8d69bc03e5c1877c790247e165f160e966 broke editing for them.

Bug: T242184
Change-Id: I7c27e4d9995428e213a980819810f235fdfe9435
2020-02-06 15:31:45 -06:00
jenkins-bot d5ea567039 Merge "Match WikiEditor switching widget to Apex toolbar theme" 2020-02-05 22:40:59 +00:00
Timo Tijhof 761c26e0a0 ve.init.mw.trackSubscriber: Remove 2015 compat for this.timeStamp
I8e82acc12 is from 2015, a long time has passed since then.

Bug: T229577
Change-Id: I656a9994451299c482e6752d6a03663f3270b8e1
2020-02-05 20:09:52 +00:00
jenkins-bot 22c6449d5f Merge "Don't offer switching to VE if it's disabled in preferences" 2020-02-05 01:48:34 +00:00
jenkins-bot 54c8ca6c39 Merge "Fix tab initialization if NWE is enabled but VE is disabled" 2020-02-05 01:48:31 +00:00
Ed Sanders 787d16f512 Match WikiEditor switching widget to Apex toolbar theme
Bug: T223155
Change-Id: I5c14f28ba3c341c74875bac090c6106655c6b4c7
2020-02-04 17:25:59 -08:00
jenkins-bot 582b99781c Merge "Change gallery structure to match Parsoid" 2020-02-05 00:52:51 +00:00
jenkins-bot 0896917030 Merge "ve.ce.MWGalleryNode: Fix how 'mode', 'class', 'style' changes are applied" 2020-02-04 20:03:29 +00:00
Bartosz Dziewoński 353549003a Change gallery structure to match Parsoid
Bug: T214649
Change-Id: Ia5eb2057a8073488de2228315f08a20656ee946b
2020-02-04 20:02:18 +00:00
Bartosz Dziewoński 98ed2311b6 ve.ce.MWGalleryNode: Fix how 'mode', 'class', 'style' changes are applied
* Changing the 'mode' did not clear the old class, only add a new one.
* Clearing the 'class' or 'style' did not really clear it if the field
  was left empty.

Both of these could result in the action not taking effect visually.

* Setting a class unintentionally also removed internal VE classes.
  This doesn't seem to have any negative effects at a glance, but it's
  probably a bad idea.

Change-Id: I304c222a2c8bc9d35b1cfaee401ab1f815251fde
2020-02-04 19:49:01 +00:00
jenkins-bot 124ae7a444 Merge "Tag VE edits from the client-side" 2020-02-04 16:43:59 +00:00
jenkins-bot 48da3746f8 Merge "Disallow switching in NWE welcome dialog if VE should be unavailable" 2020-02-03 23:59:10 +00:00
jenkins-bot f7a61e3f42 Merge "Allow switching in welcome dialog on mobile" 2020-02-03 23:57:18 +00: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
Máté Szabó ff4f382322 Use autogenerated parameter info for templates without TemplateData
When a template does not have user-provided TemplateData documentation,
the TemplateData API falls back to extracting possible parameters from the raw wikitext
to generate an API response with a list of potential parameters. However, it also
sets the "notemplatedata" field in the response, causing the VisualEditor to think
the response contains no useful information and ignore it. This appears to have been
an unintended side-effect of I97a1bfc9f9ead082a673a91b9d2053630a90309c.

This patch ensures that the VisualEditor will correctly consider such responses from
TemplateData by modifying ve.dm.MWTransclusionModel to check if the response contains
a parameter map. Some unit tests were added for the class to verify this behavior.

Bug: T243868
Change-Id: I72005880d9301a53224473900efe2917379e8708
2020-01-31 13:43:56 +01:00
David Lynch d85d30f9b3 Tag VE edits from the client-side
This opens up the API so that other tools can use it without being
forced to tag those edits as being from VE.

Also, document that tags is a working parameter that can be passed
through to the edit API.

Bug: T242184
Change-Id: I2c1d0f8d69bc03e5c1877c790247e165f160e966
2020-01-29 21:55:07 -08:00
Bartosz Dziewoński 4fc5d964db ArticleTargetLoader: Fix loading visual diffs when no RESTBase
When mw.libs.ve.diffLoader#fetchRevision was calling this method, we
were accidentally making no query at all if RESTBase wasn't in use.

Change-Id: Ia98343aa1ba7f4f3be0c1a8ee5864653c429fb82
2020-01-29 11:15:18 -08:00
Bartosz Dziewoński 3458d8a27e Don't offer switching to VE if it's disabled in preferences
In many places we check whether VE is available before doing things
(init.isVisualAvailable). This variable includes checks for whether
the page is wikitext, etc. Now it will also include checking whether
VE is enabled in user preferences.

In almost all places where init.isVisualAvailable is used, we were
already also checking if VE is enabled, so this doesn't affect the
behavior. But notably, we didn't do it when showing the option to
switch to VE in the welcome dialog and in the toolbar, causing T243723.

Changing init.isVisualAvailable this way makes it consistent with
init.isWikitextAvailable, which has always included a checking whether
NWE is enabled in user preferences.

Bug: T243723
Change-Id: Ie174bc3f16bceb29cb155b9223e0acef70167fd6
2020-01-28 16:26:03 -08:00
Bartosz Dziewoński 0791dd352d Fix tab initialization if NWE is enabled but VE is disabled
Bug: T178976
Change-Id: I16b7ef564e8c28c0c583c724ffb482b2c9fcbadb
2020-01-28 16:26:03 -08:00
Bartosz Dziewoński 5c8d04afdb Disallow switching in NWE welcome dialog if VE should be unavailable
When NWE is enabled but VE is supposed to be unavailable on the page
(e.g. in talk namespaces), do not show the option to switch to VE in
the welcome dialog.

This is relevant if new users use NWE, due to config like below
(we use this on WMF Office wiki):

    $wgDefaultUserOptions['visualeditor-newwikitext'] = true;

Change-Id: Iee8c3d3604a13dcd20efa713e49461ba9b885749
2020-01-28 16:26:03 -08:00
Bartosz Dziewoński 36c2cb90ab Allow switching in welcome dialog on mobile
This code works perfectly on mobile now, I believe change
4fb17205b6 fixed that.

Note that the dialog is currently never shown due to the override
in MobileArticleTarget, but I tested after removing it.

Change-Id: I305a01fc78366a3d2d13662e6d71711864e0dffc
2020-01-28 16:25:53 -08:00
Ed Sanders 62145b11e6 Fix variable scope in ArticleTargetSaver
Also fix docs

Change-Id: Ida47968c995166b1dca36fc9fe28fac374010564
2020-01-24 15:32:46 -08:00