Commit graph

7764 commits

Author SHA1 Message Date
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
jenkins-bot 9e6a40a827 Merge "Use mw.Api#getErrorMessage instead of custom handling" 2020-01-10 14:22:14 +00:00
jenkins-bot bc2204b6c0 Merge "Add handling for mw:DisplaySpace" 2020-01-08 22:26:08 +00:00
James D. Forrester 2c77e88d2c doc: Bump copyright year for 2020
Change-Id: I30539877543dc2a57bd1428a00d10ac46d8fc294
2020-01-08 09:13:24 -08:00
Bartosz Dziewoński 8341f96217 Add handling for mw:DisplaySpace
It's supposed to be non-editable but deletable text, like mw:Entity.
We decided to handle them this way in 2015 but never implemented it
(T94509). Currently, accidentally editing text inside of
mw:DisplaySpace node causes the changes to be lost when saving.

Bug: T241906
Change-Id: I78a0cc7a75061a7eefb8b677898b5756326615d6
2020-01-08 01:40:12 +01: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
James D. Forrester 1f74985894 Update VE core submodule to master (e032fa161)
New changes:
479b50059 Localisation updates from https://translatewiki.net.
c595d8ab0 Metion task related to Firefox hack
0a160fac2 Don't trust selections from the server
d796f3db5 rebaser: Update dependencies
b097dfaad ve.dm.Transaction: Don't translate offsets inside annotate-only replacements
eadee0343 FragmentWindow: Replace previousSelection with initialFragment
561e88158 Use ve.dm.example.imgSrc everywhere
d1dceab31 DesktopContext: Remove onModelSelect event
85947ac55 Pause synchronizer while staging
9a4dd169d Catch various out-of-bounds exceptions
341114afc Remove CE HTML from DM html test fixture
5d3a673e0 ve.ce.Document test: Add src to test image
182ac338e Evalutate fragment selection after staging
e032fa161 rebaser: Drop document opacity while paused

Change-Id: Id551ee2e6510610b8f2e12cf77ce3c8429700872
2019-12-20 12:15:32 +00:00
Ed Sanders a725643aa1 ArticleTargetLoader: Check apiXhr exists
Change-Id: I891d642728094af9c5a550a814d322822436a9e5
2019-12-16 09:53:57 +00:00
Bartosz Dziewoński 5f1c68945d Use mw.Api#getErrorMessage instead of custom handling
Bug: T240519
Depends-On: Ie18666b41f4aff1ab4bcf93f9df6e3000ac7b500
Change-Id: I69d9432162f195dcfe9470485b549a1b007617ff
2019-12-14 17:01:35 +00:00
Ed Sanders e6bb954edd Don't bother fetching metadata for diffs
Only HTML content is used for building diffs

Change-Id: I4f9af162792c27e7771838b6294c106bc9dc359a
2019-12-13 18:18:36 +00:00
jenkins-bot f213e370f7 Merge "Update VE core submodule to master (b1617fdca)" 2019-12-13 17:22:33 +00:00
James D. Forrester 60721584fe Update VE core submodule to master (b1617fdca)
New changes:
d4a21a7e7 Localisation updates from https://translatewiki.net.
0e99d907a Update OOUI to v0.36.0
c422b8313 Localisation updates from https://translatewiki.net.
b1617fdca Update OOUI to v0.36.1

Local changes:
* Rename onLookupMenuItemChoose → onLookupMenuChoose
  (deprecated in OOUI v0.36.0)

Change-Id: If66f3f16c0e882e99b0d768a3cf4170d24e7093e
2019-12-13 18:06:59 +01:00
jenkins-bot cee6e3e6a9 Merge "ve.ui.MWEducationPopupTool: Respect default preferences for anon users" 2019-12-13 16:23:24 +00:00
jenkins-bot bb94043f34 Merge "ve.init.mw.ArticleTargetSaver: Fix exception when handling errors" 2019-12-13 16:14:15 +00:00
jenkins-bot f3833f4906 Merge "ve.init.mw.DesktopArticleTarget: Remove dead error handling code" 2019-12-13 16:14:12 +00:00
jenkins-bot af333be75f Merge "ve.init.mw.MobileArticleTarget: Don't close overlay when showing error" 2019-12-13 16:14:09 +00:00
jenkins-bot 95a46f1666 Merge "Exactly match collapsible logic of jquery.makeCollapsible" 2019-12-13 15:42:46 +00:00
jenkins-bot 7c745c32c2 Merge "ve.init.mw.ArticleTargetLoader: Fix promises to be abortable again" 2019-12-13 15:41:01 +00:00
Ed Sanders 1d3386b8ac Wikitext links: File/Category support
Change-Id: I282141c23738ca6fa1e634da9bf02912032e12ff
2019-12-12 01:34:40 +00:00
Ed Sanders a007781e81 Support wikitext link editing
Depends-On: I3eb2d5ee0da52942db1de75ef9f8b0ae2632657e
Change-Id: I7ad61899a221a198a06e206614d907a331861dbb
2019-12-12 02:33:35 +01:00
Bartosz Dziewoński f41f499a2e ve.init.mw.ArticleTargetSaver: Fix exception when handling errors
TypeError: Cannot read property 'onCacheKeyFail' of undefined

(found when working on Ice92fafb1f546510dab28e3f8aa7d2280668965a)

Change-Id: I2a731cb273401074e65f9283c1f629dbdb272002
2019-12-11 05:55:59 +01:00
Bartosz Dziewoński a2b556ed56 ve.init.mw.DesktopArticleTarget: Remove dead error handling code
The .statusText and .status properties belong to the XMLHttpRequest
object, and are not present on the API response data object. I think
these checks were left over "just in case" when this code was ported
to use mw.Api instead of XMLHttpRequest directly.

MediaWiki API should never return just 'error' as the error code.

Change-Id: Iac6f721881b9405919d3397df6606e54f182bc59
2019-12-11 05:55:25 +01: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
Bartosz Dziewoński 571bec41d1 ve.init.mw.ArticleTargetLoader: Fix promises to be abortable again
Cancelling the loading of the editor should stop the network requests.

Broken in 0498c03191. Forwarding the
'abort' function manually is the worst.

(found when working on I5146b726c5ce213992febb23f24c5937db0b9bfe)

Change-Id: Ifa7c11a433cb5ed3545fa2f3d9fae2800bcae7d7
2019-12-11 01:27:33 +01:00
jenkins-bot 90bbfb5683 Merge "ApiVisualEditorEdit: Simplify diff handling a bit more!" 2019-12-02 11:18:52 +00:00
jenkins-bot 9dbd6ce391 Merge "MWSaveDialog: Fix error handling for diffs" 2019-12-02 11:18:49 +00:00
jenkins-bot 51ed492d0b Merge "Don't reject activatingDeferred on loadFail" 2019-11-28 19:47:43 +00:00
Bartosz Dziewoński 9779336403 ApiVisualEditorEdit: Simplify diff handling a bit more!
Dealing with `result: 'nochanges'` is annoying. Just return an empty
diff to indicate no changes.

Change-Id: I192caa67ec85224500a6919efd370cf7b5c1c592
2019-11-24 09:51:54 +00:00
Bartosz Dziewoński 092d0c332b MWSaveDialog: Fix error handling for diffs
In case of HTTP errors we'd crash and show no message.

Change-Id: Ideeff4ce75e7ca82ce63bf7ede6dff03eaa1c5d7
2019-11-24 09:51:43 +00:00
Ed Sanders e1db46612c Paste plaintext if conversion fails
Change-Id: I3891888f5d1d1de0c47e7bbcb1897d23b49bfa00
Depends-On: I3e9d5e167274440a424a47c266d8af67574c70b5
2019-11-24 09:37:40 +00:00
jenkins-bot e9644ab918 Merge "Set tab-size to 4 in TempWikitextEditorWidget" 2019-11-20 17:27:03 +00:00
Ed Sanders 02d6709b1e Set tab-size to 4 in TempWikitextEditorWidget
Depends-On: Ic4a5ab803c89b3671f452579bca0da08b779bdfe
Change-Id: If6b87b9a86031b846a03d67cd8e05afd7ec0a888
2019-11-20 12:11:43 -05:00
jenkins-bot a1b6c47962 Merge "Localize some hardcoded English error messages" 2019-11-19 21:18:04 +00:00
jenkins-bot 924e579c19 Merge "ArticleTargetSaver: Fix handling for data.result !== 'success'" 2019-11-19 21:18:01 +00:00
Bartosz Dziewoński a8ab487876 Localize some hardcoded English error messages
Bug: T227325
Change-Id: I5a43b34a4492c20cab4b4ef3eceafaf669e89730
2019-11-19 15:23:58 -05:00
Bartosz Dziewoński 1dc642ee57 ArticleTargetSaver: Fix handling for data.result !== 'success'
The comment here seems to be wrong, as far as I can tell, this
case can only happen when viewing a diff with no changes
(`data.result === 'nochanges'`) or saving an edit and getting
a captcha (`data.result === 'error'`).

The handling here, added in the recent refactor
b0f4b4c94e, causes both of these
cases to behave wrong (displaying the error message, instead of
empty diff / captcha form).

Change-Id: I305e8ca9ff769c229a93d5fb3307e545a0227f2f
2019-11-19 14:23:58 -05:00
jenkins-bot 8a65008317 Merge "EditAttemptStep: Allow session ID override from query string or mw.config" 2019-11-19 14:19:44 +00:00
Roan Kattouw 0f97e1dce9 EditAttemptStep: Allow session ID override from query string or mw.config
Similar to WikiEditor, allow the editing_session_id value to be
overriden through the editingStatsId query parameter. Also allow
server-side code to override the session ID by setting
wgWMESchemaEditAttemptStepSessionId in mw.config.

Only apply the override to the first session. Once a second init event
happens, discard the overridden editing_session_id and generate a fresh
one.

Bug: T238249
Change-Id: I4ede70f310a35c95b6eb9cc34cfcf2baa77e69ee
2019-11-18 17:18:10 -08:00
jenkins-bot 35f2093c62 Merge "Move more code to ArticleTargetSaver" 2019-11-14 21:26:24 +00:00
Ed Sanders 687882f596 Don't reject activatingDeferred on loadFail
loadFail can result in a retry, in which case it isn't
approraite to reject this promise. Also many of the code
paths call 'tryTeardown' which itself will reject the promise.

Bug: T238332
Change-Id: I366662847304d8ecf79d5899b2804dded67ee999
2019-11-14 15:23:46 +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
Bartosz Dziewoński c8fa50c3b2 Exactly match collapsible logic of jquery.makeCollapsible
Bug: T236247
Change-Id: Iaf8e8515585989fd8ca64ffd33b02399a69278b4
2019-11-13 23:26:08 +00:00
Ed Sanders 6caa4601aa Generate internal links locally
Bug: T147230
Change-Id: Ib154ffebb601dc76c708f2d8a8315cbf98ff6da1
2019-11-12 20:36:00 +00:00
jenkins-bot 84663fab0f Merge "Add missing FragmentInspector tests to MW" 2019-11-12 15:27:39 +00:00
jenkins-bot 206c440a4e Merge "tests: Have MWDummyTarget create the correct surface type" 2019-11-12 15:26:41 +00:00
Ed Sanders 545c6f1301 Add missing FragmentInspector tests to MW
Requires unregistering MWLinkAnnotationInspector

Bonus: Remove unnecessary list of unregsiters as
teardownOverrides is run on init.

Change-Id: I3e36ab7736cc8479ab53f40d2eb24c0fa15d3dc0
2019-11-12 13:52:35 +00:00
Ed Sanders 3542799ab4 tests: Have MWDummyTarget create the correct surface type
Change-Id: I3cd025d726e9db56a2391ef52852d1cb2f4305a0
2019-11-11 20:22:33 +00:00
Ed Sanders 8d818d9ff0 Update VE core submodule to master (5b9ab1cfa)
New changes:
be8235e82 Localisation updates from https://translatewiki.net.
6f43a6c8d Remove MW-specific code for setting up section editing

Local changes:
* Bring in section editing logic from VE core
  Sets attachedRoot iff there is only one SectionNode in the whole document.

Change-Id: I15b5ebf3848482ef6df6d19114d26a1b1d4a3b13
2019-11-11 18:28:14 +00:00
jenkins-bot ef4c7a856b Merge "Follow-up I83b98e41: Always sanitize when using plain text paste in NWE" 2019-11-07 19:04:11 +00:00
Ed Sanders 737e9e82f5 Follow-up I83b98e41: Always sanitize when using plain text paste in NWE
Bug: T201561
Change-Id: I0405923b2ebd1b73119d29cb6091f53b8cddc84d
2019-11-07 14:49:57 +00:00
Bartosz Dziewoński a53c02f2c4 ve.init.mw.ArticleTarget: Fix error handling in #prepareCacheKey
If the paction=serializeforcache request fails, we were erroneously
converting it to a successful result with no value, which later causes
an exception, because since 381b58585c
other code expects the result to an an object.

The bug was introduced in 2015 in 07001001be,
but until that recent change it would only cause a 'badcachekey'
error, which was handled correctly later.

Change-Id: Ie1ffc8c3e616a7d296f2186fb17eaf039971a44f
2019-11-07 01:36:41 +01:00
jenkins-bot 36bde9d1c6 Merge "Config value for X-Parsoid-Variant" 2019-11-07 00:00:40 +00:00
Ed Sanders d71522c463 Set the plain text 'pasteSpecial' flag when using plain text paste in NWE
This means the multiple lines of html (e.g. '<p>a</p><p>b</p>') are
treated as plain text and only separated by one linebreak.

Bug: T201561
Change-Id: I83b98e41bfd92d1848557b58f961abdd0db26294
2019-11-06 19:11:58 +00:00
Ed Sanders 64be4b2a4b Update VE core submodule to master (2d0f0ec1f)
New changes:
18e32c6ed Simplify paste test runner
7d71154bd Properly support middle click paste

Local changes to use simplified paste tests runner

Bug: T157956
Depends-On: Id66bff4e41a36ed967a8cba2f6653bb26e7b4ea1
Change-Id: I0101e8bc079cd050bfbc65577a10e98213d5f00c
2019-11-06 10:31:38 -05:00
David Lynch 46e7b3ba19 Config value for X-Parsoid-Variant
Bug: T229074
Change-Id: Ib1403638b12ec5808f6b81bd114949043aa9ac2e
2019-11-05 10:56:10 -06:00
jenkins-bot 26ebdd0796 Merge "ve.init.mw.MobileArticleTarget: Improve toolbar scrolling behavior on iOS 13" 2019-11-05 14:26:27 +00:00
Ed Sanders 4c86c54e46 Replace $.when with ve.promiseAll
Add linting guards, except in preinit

Change-Id: I999641eddb0e0f5b112ec2259dbafc1e816e3437
2019-11-04 22:06:54 +08:00
Ed Sanders cc217cef29 Avoid use of $.parseHTML in model
Change-Id: Ide671e7459b14bfbb7385261221c2edd17bd1153
2019-11-04 13:23:12 +00:00
Ed Sanders 2d4234fac8 Remove jQuery from ve.dm.MWLanguageVariantNode
Change-Id: I849cb6756171aa7bba43dc390cbd390b323328d2
2019-11-02 16:28:32 +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
jenkins-bot b00787b572 Merge "Factor out save logic into ArticleTargetSaver" 2019-11-02 01:16:18 +00:00
Ed Sanders ffa3742ce1 build: Update linters
Change-Id: I03d1a8e63b730ad98ec07ad5f630ba82698de5be
2019-11-01 16:20:22 +00:00
Ed Sanders 381b58585c Factor out save logic into ArticleTargetSaver
Change-Id: I63fa04598e0d703fe1ba715c9c5a0abbb0d7ba5b
2019-11-01 15:45:27 +00:00
Bartosz Dziewoński 00eb79d4d7 Revert "Parse relative hrefs on image nodes like on regular links"
This reverts commit 6037fefbe0.
This reverts commit da9b6fffbd.

Bug: T237040
Change-Id: Id6ea5784512e4d4c3cb00927b859d713c3814f89
2019-10-31 22:40:42 +01:00
jenkins-bot f24c823212 Merge "Expand collapsible blocks in editor, like we do with collapsible tables" 2019-10-31 16:27:45 +00: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 c83d129f6a Expand collapsible blocks in editor, like we do with collapsible tables
Bug: T236247
Change-Id: I6389d2fbb4a5a5d58bfb08f38bd4c598e20c7aaa
2019-10-31 03:18:34 +01:00
Ed Sanders 1bb72f0bb5 Replace deprecated easy-deflate.deflate with mediawiki.deflate
Change-Id: I5c77d4818074fd3dc937d7688d449952b92ee358
2019-10-30 19:13:47 +00: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
Ed Sanders b345ae203b Fix documentation position
Change-Id: I8e1045f38e0cca3a937a5e2a07b1db820f64bee1
2019-10-24 14:31:38 +01:00
Bartosz Dziewoński 4086de5a9a ve.ui.MWEducationPopupTool: Respect default preferences for anon users
Bug: T231762
Change-Id: I05dccf79becab9487ee2a67c4970c938d52e25d7
2019-10-22 20:02:21 +02:00
jenkins-bot e4efbe2a46 Merge "ve.init.mw.MobileArticleTarget: Remove error handling hacks for MobileFrontend" 2019-10-22 15:42:32 +00:00
Bartosz Dziewoński f3dfd98e55 Don't retry when etag is undefined because the page doesn't exist
Follow-up to 5d1a67757a.

Bug: T233320
Change-Id: Ice27187862dde75c69bbdb666c0981fce94249ba
2019-10-21 19:21:59 +00: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
jenkins-bot 23213a17bd Merge "eslint: Add extra restrictions to ve-mw/dm/ folder" 2019-10-18 23:12:20 +00:00
Ed Sanders 837b01b534 Use consistent tag style when constructing nodes
Change-Id: I6a2d4d7d791a74b26770ef84d15659642401b0e7
2019-10-18 23:42:54 +01:00
Ed Sanders 2846144e96 eslint: Add extra restrictions to ve-mw/dm/ folder
Same as in core, follow up to I63fa04598e.

Change-Id: I4b63ef9d07205d91d6c20db310ab350f4160c3bc
2019-10-18 23:26:26 +01:00
jenkins-bot 416323bdca Merge "Fix media embeds which don't link to the file page" 2019-10-18 10:55:58 +00:00
Bartosz Dziewoński 6037fefbe0 Fix media embeds which don't link to the file page
Follow-up to da9b6fffbd.

Bug: T235707
Change-Id: Ie5a12bf274ae6178106f81a4c84686a88307c9fb
2019-10-17 22:12:58 +02:00
Bartosz Dziewoński 5d1a67757a Detect mangled etags from RESTBase and retry via MediaWiki API
Something is causing the 'ETag' headers produced by the "public"
RESTBase (queried directly from the client) to be mangled or lost.
My theory is that some proxy or browser extension is doing that.

When we detect a bad etag when fetching the page contents, discard
the result and try querying the "private" RESTBase via the MediaWiki
API (similar to what we do on private wikis, except there we talk
directly to Parsoid instead of RESTBase). After I463a84de63, that
returns the etag as part of the payload rather than HTTP headers,
and should pass unharmed through whatever is mangling the data.

Also compare and log the two etags.

Bug: T233320
Change-Id: I2ef0ca872597566f74b650aea71bf3f15747a6d7
2019-10-16 19:53:43 +02:00
jenkins-bot b15eea1cb0 Merge "Fix Vector wikitext surface padding overrides when using custom browser font-size" 2019-10-11 15:23:17 +00:00
jenkins-bot cc1bd58e83 Merge "Parse relative hrefs on image nodes like on regular links" 2019-10-11 15:22:29 +00:00
Bartosz Dziewoński 3f0f302577 Enforce that some files must not use the ve global
Previously, the ve-mw/init/ directory contained two kinds of files:
those that were used when initializing VE, and those that may be
loaded even if VE is not going to be initialized at all. The latter
kind must not use the `ve` global variable.

After moving those files to ve-mw/preinit/ we can enforce this with
.eslintrc.json in that directory. This would have prevented T228684.

(Technically they merely must not use `ve.init`, and may use `ve`,
but that's harder to enforce. We should instead move the few non-init
methods out of `ve`: now, track, trackSubscribe, trackSubscribeAll).

Also, group some files under ve-mw/init/: targets/ now (only)
contains ve.init.mw.Target and its subclasses, apiresponsecache/
now contains ve.init.mw.ApiResponseCache and its subclasses.

Bug: T228684
Change-Id: I945249a27f6a0fa10a432d5c5dc57bc7e0461fd8
2019-10-10 15:15:40 +00:00
jenkins-bot def3261c49 Merge "Fix linking to pages in media dialog/media context/internal link context" 2019-10-07 15:13:02 +00:00
Bartosz Dziewoński 55aec8f977 ve.ui.MWDefinedTransclusionContextItem: Fix handling of template names
The ...target.wt property contains the wikitext used to generate
the template name. It can contain trailing newlines (T234817) and
all kinds of funny wikitext syntax. Instead, use ...target.href,
which is the title of the page that is actually transcluded. Compare
the new code to ve.dm.MWTransclusionNode.prototype.getPartsList.

Additionally, fix some confusion about namespaces (treating template
names as titles in the main namespace). The template names in the
configuration page (visualeditor-template-tools-definition.json)
now support overriding namespaces in the same way as in wikitext.

Bug: T234817
Change-Id: I7c557d28e961d0b9117fc0380c65cdd42035ae96
2019-10-07 14:56:16 +02:00
Bartosz Dziewoński 7579f6eb1f Fix linking to pages in media dialog/media context/internal link context
If you had an image thumbnail for a file 'Foo?.png' on the page,
ve.ui.MWMediaContextItem and ve.ui.MWMediaDialog did not escape
the '?' when linking to it, which resulted in incorrect links.
Similarly, if you had an internal link to the page 'Foo?',
ve.ui.MWInternalLinkContextItem did not escape it.

Additionally, the links were always generated as if the wiki was
using short URLs, even when it is not (T233628).

The approach using mw.Title is copied from ve.ui.MWGalleryDialog.

Bug: T233628
Change-Id: I10256ed6883dae0ea216de4c0719f03d7fd19ae4
2019-10-07 14:27:02 +02:00
David Lynch d03db0e4f2 ui.MWSaveDialog: checkbox tracking was getting duplicated on every setup
Bug: T232790
Change-Id: Id19aa59c71432d0179fc06b6a30014d1037074ae
2019-10-03 12:44:43 -05:00
Ed Sanders 41572f2595 build: Update eslint-config-wikimedia and fix
Change-Id: Ib9cf45a393438e2eb47fd1b0c837d2d6acb06541
2019-10-03 00:54:54 +01:00
jenkins-bot 73a92d847d Merge "ArticleTargetEvents: clean up some duplication" 2019-09-30 23:49:27 +00:00
David Lynch 651e00d529 ArticleTargetEvents: clean up some duplication
Change-Id: Ied2851f9d77d055db9fc22668b963a01ca098a95
2019-09-30 11:29:01 -05:00
Bartosz Dziewoński da9b6fffbd Parse relative hrefs on image nodes like on regular links
* In normal images, parse relative 'href' attributes instead of
  expanding them to absolute, and parse 'resource' to keep it
  identical to 'href' if they refer to the same page (including
  same percent-encoding and space/underscore). This resolves Parsoid
  generating |link= options for copy-pasted images (T193253).

* In gallery images stuff, prefix the 'resource' attribute with './',
  same as normal images do. This causes no functional changes, but it
  makes updating tests easier, and the consistency is probably good.

* Update test examples to also prefix 'resource' and relative 'href'
  attributes with './', like the real Parsoid does.

Bug: T193253
Change-Id: If2d7f080d9d693568054f8311c1e1b15ca27ea5c
2019-09-25 00:25:04 +02:00
Bartosz Dziewoński e472a4bbd3 Fix mw:MediaLink support
* Handle mw:MediaLinks pointing to to non-existent files, which come
  with typeof="mw:Error" (similar to image nodes).

* Fix regression from c66f8e0547, which
  caused all mw:MediaLinks to be treated as plain external links again.

* Add test cases.

Bug: T232754
Change-Id: I9ae5bcfc4e24e8c0d22ef77d6a4d03f817fc9768
2019-09-24 22:46:03 +02:00
TheSandDoctor 70e3e7cc8b VisualEditor: Replace deprecated editToken with csrfToken
The editToken key of mw.users.tokens is deprecated since MediaWiki 1.27.

Bug: T233528
Change-Id: I7297e6abb159e9bb758859454b1097292e607117
2019-09-22 10:22:01 -07:00
jenkins-bot 7f7cf6ce79 Merge "MWInternalLinkAnnotationWidget: adjust the input for relative links to subpages" 2019-09-20 11:23:40 +00:00
Bartosz Dziewoński 69147ce3bc Fix Vector wikitext surface padding overrides when using custom browser font-size
In order to get the desired padding, the `em` values were pre-multiplied
by the parent font-size, which was assumed to be `0.875em` for normal
surfaces and `(13.3333/16)em` for wikitext surfaces. (That should have
been `(13/16em)`, by the way, but that's a negligible difference.)

Unfortunately, the font-size for wikitext surfaces is actually `13px`.
Unlike `em`, `px` values are not affected by custom browser font-size,
so when one was set, the final padding was all out of whack.

Use `rem` units instead to respect the custom browser font-size,
without getting problems due to the parent element font-size.
We don't need separate rules for .ve-ui-mwWikitextSurface now.

Bug: T222217
Change-Id: Ib7ffbf09d5aa23fddb894aa3b081ec993ddcee2d
2019-09-18 22:24:47 +02:00
jenkins-bot 067ec50ff8 Merge "MWSaveDialog: add more instrumentation" 2019-09-18 15:13:10 +00:00
David Chan c4cb88aded Don't unwrap a solitary paragraph in Wikitext string transfers
This meant we were returning invalid documents with bare content outside
content branch nodes. Instead let ve.ce.Surface in VE core do the unwrapping.

Bug: T232944
Depends-On: I8799d51958b966c99307f4c70546ea326e67385c
Change-Id: I0479116b51cc3135a992fdf36b8edfb2c44916ba
2019-09-17 20:44:45 +00:00
David Lynch 001ed6a88e MWSaveDialog: add more instrumentation
Bug: T229079
Change-Id: I2e5b45a4a28b580fbca872d620df94a61fb8a24a
2019-09-16 10:48:31 -05:00
jenkins-bot 6c52d4b9da Merge "ve.init.mw.MobileArticleTarget: Really deactivate the surface" 2019-09-12 16:43:05 +00:00
jenkins-bot a7a4886a54 Merge "Add new EditAttemptStep stage: firstChange" 2019-09-12 15:19:46 +00:00
jenkins-bot b75eb54bec Merge "Add another looser selector for catching pasted references" 2019-09-10 17:14:31 +00:00
David Lynch 22461568e0 Add new EditAttemptStep stage: firstChange
Depends-On: I79e04dda6323ebb05b129bb96c0323db112bcdd0
Bug: T229079
Change-Id: Icea7eed8a56e0c5a94c6dba4b0951ecf5f594da1
2019-09-10 10:41:13 -05:00
Ed Sanders 0371915832 Add unit tests for read-mode reference filter
Bug: T150418
Change-Id: I8b39694d5c01e0902491fe3d6f3a08451c7c5297
2019-09-10 14:46:45 +00:00
Ed Sanders 90426ba496 Use MW import rules in MW tests
Bug: T150418
Depends-On: I6ad87b53446d7d9fcaf82e1d60e3f9968c4409b6
Change-Id: I5d7f24a7e36ddd3624ef120783ceec5063cf3711
2019-09-10 14:46:37 +00:00
Ed Sanders c8582df1b9 Add another looser selector for catching pasted references
Bug: T232461
Change-Id: I82eef25fbbaa4b583fac660b172541db3160c99c
2019-09-10 12:32:10 +01: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 a3eb620570 Merge "ve.ui.MWEditModeTool: Fix showing active editor" 2019-09-09 17:55:33 +00:00
jenkins-bot 03bdace1ba Merge "MobileArticleTarget: don't access the surface after it's destroyed" 2019-09-09 16:35:18 +00:00
Bartosz Dziewoński a02323698b ve.ui.MWEditModeTool: Fix showing active editor
This line of code seems to have been accidentally deleted in
1761b6d6d6.

Bug: T232359
Change-Id: I7d9568cc11a7c96e607203d41ab132c6f304d304
2019-09-09 18:32:56 +02: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
jenkins-bot f12cb6d1cf Merge "MobileArticleTarget: Remove unused code (adjustContentPaddingDebounced)" 2019-09-06 21:26:51 +00:00
jenkins-bot 5bbcf9bac1 Merge "MobileArticleTarget: Remove unused code (hideSpinner)" 2019-09-06 21:22:25 +00: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
jenkins-bot 19ca9a4768 Merge "Update VE core submodule to master (0b17a137b)" 2019-09-06 00:17:08 +00:00
James D. Forrester a05f9e4bf4 Update VE core submodule to master (0b17a137b)
New changes:
d4cb2f03e Update OOUI to v0.34.0
b0b481693 jsduck: Stop listing OOjs in upstream, it's using JSDoc now
0b17a137b Update OOjs to v3.0.0

Change-Id: If29a97ce689523763431face5a13929a461735b4
2019-09-05 13:03:41 -07: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
Ed Sanders 7f854ff6ca Fix HTML blacklist inheritance
Bug: T150418
Change-Id: Ic56f90d654bfd34e353edafbbf5954fe167157f6
2019-09-04 17:14:38 +01:00
Ed Sanders 901f107bd0 Delete mobile toolbar flexbox code, upstreamed to VE core
Depends-On: If973baa556a557c2fe5cb3aed44f937fc9d2b62e
Change-Id: I775fb24bd16572cfb8472f5260a7552b2fbb9930
2019-09-03 17:30:19 +00:00
David Lynch 828aad2e01 MWLinkAnnotationInspector: track edits to the label field
Bug: T229841
Change-Id: If5aa535015260a315f02f9e694f1fcb533928b08
2019-09-03 09:19:09 -05:00
Bartosz Dziewoński 91f99ce78d ve.init.mw.DesktopArticleTarget.init: Update for Minerva changes again
The good thing is that every time our CSS overrides get less crazy.
See 75ff121b29 for the last time.

Change-Id: I9d81aff6a24ec28850563e00206e21c4a6593d2e
2019-08-30 21:40:40 +00:00
jenkins-bot bc963f4155 Merge "Support for defined template context items" 2019-08-30 18:50:27 +00:00
jenkins-bot 6cd05557d0 Merge "MobileArticleTarget: v1 of toolbar refresh" 2019-08-30 17:43:58 +00:00
Ed Sanders e5f5a49344 Support for defined template context items
Context items can be created for specific template titles. Titles
are mapped to context items using an on-wiki message.

Bug: T211243
Change-Id: Icfc39e350452da238d0e0c17cb2305c60d9ca16a
2019-08-30 13:02:47 +01:00
David Lynch 593d26b4ab Don't let double-clicking the save button trigger a save
Tapping the toolbar save button while the save dialog is open triggers a save
because of the accesskey. It shouldn't save on a double-tap, because that's
easy to accidentally do / trigger on a slow device.

Bug: T230816
Depends-On: I4c3afce9d57c9bca737272b40b9a4862b5794bac
Change-Id: I1925b1b97de6a811f73196b616ec09a2c30c336f
2019-08-29 22:43:53 +00:00
David Lynch 1761b6d6d6 MobileArticleTarget: v1 of toolbar refresh
Bug: T211789
Bug: T230807
Change-Id: Ifd2319039628a8143dc09f6fa35e4a9825d3062c
2019-08-29 15:27:56 +00:00
jenkins-bot dd86fc76aa Merge "Use upstream pulsating dot" 2019-08-28 17:31:52 +00:00
jenkins-bot 23f5488e93 Merge "Docs: Standardise "messages used" comments" 2019-08-28 16:58:12 +00:00
Ed Sanders 4a8947686d Docs: Standardise "messages used" comments
Change-Id: Ic563901a9439e86ca85ac6210323a35ab34736c3
2019-08-28 16:41:19 +01:00
jenkins-bot 5849de920c Merge "ve.init.mw.ArticleTarget: Use errorformat=html when saving" 2019-08-28 13:43:59 +00:00
jenkins-bot e7985003ab Merge "DesktopArticleTarget.init: Improve handling of 'preloadparams'" 2019-08-28 13:37:54 +00:00
Ed Sanders 7cc538fe51 Use upstream pulsating dot
Bug: T226719
Depends-On: Ibd035ea48b7d0316a7627a91623ff6116ccbae31
Change-Id: Iedf88e9c5ac8efa809ccb25f2081eff9946da395
2019-08-28 13:40:29 +01:00
Bartosz Dziewoński 035f34dac9 DesktopArticleTarget.init: Improve handling of 'preloadparams'
Depends on MediaWiki change I48d4bb3f, which adds the 'arrayParams'
option to handle explicitly indexed array parameters like
`&preloadparams[0]=a&preloadparams[1]=b`. Previously we only handled
implicit indexes like `&preloadparams[]=a&preloadparams[]=b`.

Bug: T231382
Depends-On: I48d4bb3fdf0ea7f5eb133c59bf63651ba356fc42
Change-Id: I8c899bce1b19fa286bd385f89e102a4b87db4db3
2019-08-27 22:32:13 +02:00
jenkins-bot 8f21ec6a5d Merge "ve.ce.MWSignatureNode: Fix rendering" 2019-08-27 18:27:33 +00:00
Bartosz Dziewoński b5aa9e9c72 ve.ce.MWSignatureNode: Fix rendering
The API response format changed in formatversion=2.
Follow-up to 934572cdf7.

Change-Id: I383dfac8b0d10a39b8a9a1b11e11fd595f482619
2019-08-27 17:16:21 +02:00
Ed Sanders 3b09a0719c Link inspector: Turn off 'addQueryInput'
The double result creates more confusion that it clears up,
and now that the query input is always used for text insertion
it is less of an issue that we don't have a case-exact match
in the results list.

Bug: T230819
Change-Id: I58cbe740fa7d0327aadd5dd111161bb7087a4ddb
2019-08-27 12:17:44 +01:00
Ed Sanders 042bfdfd9d Update VE core submodule to master (07687721b)
New changes:
77076f828 LinkAnnotationInspector: add a "label" field on mobile

Local changes:
* Updates for mobile link label editing

Bug: T229431
Change-Id: Ib0489f6f59b228ebc4a20f7a0a515be938a8f6d3
2019-08-23 00:25:51 +02: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
Bartosz Dziewoński 84d548e7b1 Remove redundant @method annotations
A @method annotation is only necessary when the docblock is not
directly followed by a function declaration (in which case JSDuck
assumes it documents a property), e.g. when defining an abstract
function or referencing a function from another library.

I verified that JSDuck generates exactly the same output before and
after this change (docs/data-<hash>.js files are identical).

Change-Id: I7edf51a8560ab9978b42800ab1026f0b5555c3bf
2019-08-21 23:33:15 +02:00
jenkins-bot eaeb3bde40 Merge "MobileArticleTarget: Tweak styling for editor switcher" 2019-08-21 17:00:41 +00:00
jenkins-bot 2d52d7e86c Merge "MWSaveDialog: On mobile show a back button rather than an x" 2019-08-15 09:32:32 +00:00
Ed Sanders 3cbe0a5a20 Update VE core submodule to master (c2c5149f3)
New changes:
62f06382c Localisation updates from https://translatewiki.net.
5fc25c0d9 LinkContextItem: Apply ellipsis directly to link

Local changes to fix link ellipsis styles.

Bug: T230267
Depends-On: I25bb4fa9b7288232b08bab9c88f281817a26d6bb
Change-Id: I8a4b04d45979a1f6c375a7c92a340e3e81d7753c
2019-08-15 10:12:22 +02:00
David Lynch ac471d47e9 MWSaveDialog: On mobile show a back button rather than an x
Bug: T230058
Change-Id: I370fedddf8475e5688ac4ce53f9ccd7d6137705b
2019-08-14 11:38:38 -05:00
Bartosz Dziewoński e14e24f037 MobileArticleTarget: Tweak styling for editor switcher
The .oo-ui-popupToolGroup-handle styles only need to apply to the
editTools toolbar, where they override OOUI styles so that our
"stretched" toolbar works; they don't need to apply to the pageTools
toolbar, which contains just the editor switcher, and where they make
it look different from the MF wikitext editor toolbar for no reason.

Change-Id: I21315b34be0a7c3938f84ada720ff5754d953879
2019-08-08 19:47:14 +02:00
Ed Sanders 348c880cbe MWSaveDialog: Don't pretend saveButtonLabel is optional
Change-Id: I7cfc5bfbf8893fa4808f2823b37efae7b9e520ac
2019-08-05 21:16:21 +01:00
Ed Sanders 88cb572e35 Fix typo in file header
Change-Id: I6f258f81e6cb129328bf912245f23d6c4d877f47
2019-08-05 21:15:58 +01:00
Ed Sanders bae45b63d2 Use flexbox for mobile toolbar
* Makes edit tools equal width
* Improves horizontal alignment within tools

Change-Id: I01b9668b638c21607b12381efc198edfe02f23da
2019-08-05 12:01:32 +01:00
jenkins-bot 644f409d61 Merge "Use MobileFrontend license message on mobile when available" 2019-08-02 22:12:12 +00:00
Ed Sanders 0b1f0a0eda Use MobileFrontend license message on mobile when available
Bug: T229579
Change-Id: I861f0d997607a34ca04727afd55771cbf14e253b
2019-08-02 16:29:54 -05:00
James D. Forrester 05fb44ae56 build: Upgrade eslint-config-wikimedia from 0.12.0 to 0.13.1
Change-Id: I43f407da92f59a8bf758cc2586e84aa5e18d9ab0
2019-08-02 09:51:07 -07:00
Ed Sanders 89ecd64a55 Make extension body the default description for extension nodes
Change-Id: Ifada2a6a0279e64a1ba82f49e03884e362516a83
2019-07-31 16:38:27 +01:00
jenkins-bot 51b93cea94 Merge "ve.init.mw.DesktopArticleTarget: Fix generated URL when loaded using veaction=edit in single-tab mode" 2019-07-31 13:28:59 +00:00
jenkins-bot 2d2e7dcdb2 Merge "ve.ui.MWLinkAnnotationInspector: Correct code comment" 2019-07-30 23:58:16 +00:00
Bartosz Dziewoński 7d3154fea8 ve.init.mw.DesktopArticleTarget: Fix generated URL when loaded using veaction=edit in single-tab mode
We were incorrectly always adding action=edit to the URL in that case.
The condition was always passing because `this.section` is `null` when
unset, but `this.currentUri.query.section` is `undefined` when unset.
This is a similar fix/bug to a68cc38b22.

Bug: T209163
Change-Id: Ic80ac377b763aea53678c4209ba6b3a6ba2996c9
2019-07-31 01:10:56 +02:00
Bartosz Dziewoński 0f5fe34534 ve.ui.MWLinkAnnotationInspector: Correct code comment
The way this works changed in ff9bf1fcb3 (2015).

Change-Id: I61617723ec6ada8018cdca55eb3fcc971796fded
2019-07-31 00:21:45 +02:00
Bartosz Dziewoński 7ac972d408 ve.ui.MWInternalLinkAnnotationWidget: Remove 'maxlength' to fix pasting URLs
Bug: T228240
Change-Id: I1f1be3a0893bdf8b7f9d07301ed01673eda8327d
2019-07-29 22:07:51 +02:00
Bartosz Dziewoński 8dd0bd23d4 Work around a Parsoid bug with creating interwiki links
As detailed in T95850#5078990, Parsoid incorrectly converts HTML to
wikitext when a link `href` refers to an interwiki page and contains
percent-encoded colon characters ':'. VisualEditor doesn't know
anything about interwiki pages (it treats those links as normal local
links, and expects MediaWiki and Parsoid to handle them specially),
so we can't easily special-case them. But since leaving the colon
unencoded is valid for all links anyway, we can just do that.

Bug: T103635
Change-Id: I87d7e6952983a72d90ea739b0bc8488d9f6a9be3
2019-07-26 01:01:01 +02:00
jenkins-bot 138c3eb53a Merge "ve.ui.MWLinkAnnotationInspector: Update size after showing/hiding errors" 2019-07-25 20:51:33 +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
Ed Sanders 9a1994e47c Update VE core submodule to master (7cb9caca1)
New changes:
28aea2e4d Edit cards v2 design
739017973 Track usage of the new "close context" button

Local changes:
* Edit cards v2 pull through

Bug: T222396
Change-Id: I1ca885e8d8127e7827a059755315ed789a7b9210
2019-07-25 22:24:48 +02:00
Bartosz Dziewoński bfc549e720 ve.ui.MWLinkAnnotationInspector: Update size after showing/hiding errors
Change-Id: I84af3fbfea4aa89d76de95cfcdbfd3bc9e69ee83
2019-07-25 00:06:02 +02:00
Ed Sanders b35241497a Use type=url for external link input
Change-Id: I13cfdaaf5e94f07d16270df2933d1b23cf9f0ff7
2019-07-24 13:50:11 +01:00
jenkins-bot ef25e831b9 Merge "MobileArticleTarget: Compat for OOUI scrolling fix on iOS Safari" 2019-07-24 11:34:23 +00:00
Bartosz Dziewoński cc1cb63aca targets: Fix silly indirection via a global variable
Since we're inside the Target instance, `ve.init.target` refers to
this object. Some of the code I'm changing even uses `this` instead
of `ve.init.target` on the next or previous line.

Most of the mistakes are a result of mass search-and-replace changes
(478b0bcb, e1a887cc), or moving the code from other classes (d294006d).
But I can't explain the "ve.init.target.getSurface().getDom()" line,
it would be good to figure out why it was this way before we change it.

Change-Id: I0d7c6a48369242d4c99620fcd775ab537420d84a
2019-07-23 22:39:47 +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