Commit graph

12063 commits

Author SHA1 Message Date
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 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
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
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 389fd5c668 Merge "Catch errors during document initialization" 2019-10-11 16:24:02 +00: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
Ed Sanders 57d8e53111 Catch errors during document initialization
Change-Id: I5dc29666f99ac10bbf63a56153ba9a32d3568daa
Depends-On: I57fb6319bc3a9cee347c39fc75f555543991d703
2019-10-11 15:13:10 +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