Commit graph

14223 commits

Author SHA1 Message Date
jenkins-bot 2fdac8851c Merge "Revert "Rewrite mw.libs.ve.getTargetDataFromHref with URL API"" 2023-01-30 14:13:38 +00:00
Bartosz Dziewoński a92dce4999 Revert "Rewrite mw.libs.ve.getTargetDataFromHref with URL API"
This reverts commit 461c76981f.

Bug: T328143
Change-Id: Ib59192c650736eac9d4a2db130c3e29720c30486
2023-01-30 13:52:53 +00:00
Ed Sanders c5cccfc85b Set a min-height on surface in Vector 2022
We could do something more complex and compute the height of the
available space, but a fixed height is a reasonable solution with
a fraction of the complexity.

Bug: T328048
Change-Id: I0b7bfa55f23afc16be43b85270666ec6a480ca32
2023-01-28 14:07:11 +00:00
Bartosz Dziewoński e52058fad3 Error logging for native URL errors
Bug: T328094
Change-Id: I7d0e3bb403db7ddbc233d6b0a770533f02883c5a
2023-01-27 10:48:45 +01:00
Ed Sanders 420c0f6c10 ve.ui.MWLiveExtensionInspector: Account for this.selectedNode being null in debounced method
Change-Id: I74ab091d3bfbdd9290429cd50688f458118701e7
2023-01-26 17:58:00 +00:00
Jan Drewniak d98e9e83e1 Fix Wikitext editor preview layout in Vector 2022
Accounts for the use of CSS Grid in Vector 2022, in
the 2017 Wikitext editor preview, by placing the heading and
content in named grid areas (`titlebar` and `content`).

Bug: T327778
Change-Id: I66a30e282e808559b4f375f5924ae0d945c058a9
2023-01-24 10:39:40 -05:00
Bartosz Dziewoński 461c76981f Rewrite mw.libs.ve.getTargetDataFromHref with URL API
At first I was going for a more minimal replacement of mw.Uri with URL,
until I discovered that this code depends on a mw.Uri bug that would be
difficult to replicate:

  // Expected: Relative URLs are accepted
  new mw.Uri( '/foo' ).toString() // => 'https://localhost/foo'
  // Expected: Protocol is optional
  new mw.Uri( 'example.com/foo' ).toString() // => 'https://example.com/foo'
  // Unexpected: Treated as empty domain with no protocol rather than relative URL
  new mw.Uri( './foo' ).toString() // => 'https://./foo'

So I went for a bigger rewrite to preserve the intent rather than the
exact logic.

I had to change some test cases to use more realistic fake data. They
previously relied on bugs in our URL handling to pass despite the base
URLs being incorrect, particularly for non-short URLs (see T270219).
In my testing non-short URLs behave the same as before in practice.

Depends-On: I07a8c097dba0f5572c0aedf4febdf1434063ea6f
Bug: T325249
Change-Id: I232361266c1dda795b88018c3aaa3d9ecbe42b93
2023-01-23 14:59:23 +00:00
Bartosz Dziewoński e40b73ef57 Update VE core submodule to master (b7ff5aac0)
New changes:
2201b350c Localisation updates from https://translatewiki.net.
da74736c1 Remove unused test code
d1b016e90 Minor test tweaks
551de4f0c Specify document base URLs in more test cases

Local changes:
* Specify document base URLs in more test cases

Change-Id: I0e301bef38d97fa2234aa901c787360d9fbde8a3
2023-01-23 15:57:59 +01:00
Bartosz Dziewoński a3d0ff8449 More realistic mocked data for MWWikitextStringTransferHandler tests
The actual API responses do not have <body> tags.

Change-Id: I5f2ab7d0a4ad33497868f5488e376f9467c1256b
2023-01-23 14:40:11 +00:00
Bartosz Dziewoński 0689e9247f Minor test tweaks
Change-Id: Ib20f9665534873bd1d5963664399459d3f5b4234
2023-01-21 19:15:51 +01:00
Bartosz Dziewoński 8371d24c78 Remove unnecessary test file
Change-Id: Ib81f70d290374451c5164bff7adbe4e18b9e2a8f
2023-01-21 15:09:14 +01:00
Ed Sanders 24a89caf93 mw.Target: Allow passing storageExpiry to initAutosave
Change-Id: Idcf50a527e2386122d077c497477057657824646
Depends-On: I4557a8808145fd1a601fe9b3fa1b190f8dba0077
2023-01-21 09:42:26 +00:00
Ed Sanders 2df8a95ac3 Update VE core submodule to master (035756895)
New changes:
4355d697a Replace ListStorage with ConflictableStorage
978061f86 Update SafeStorage and ConflictableStorage with expiry functionality
79019ed88 ve.dm.Surface: Support storage expiry

Local changes:
* Pull through conflictable storage

Bug: T218663
Change-Id: I36e49c01e9f2ddb7d362d539b72a4beca925bcb7
2023-01-21 10:41:21 +01:00
thiemowmde 004d92d341 Work around Firefox bug affecting LazyMultilineTextInputWidget
Before the `height: 2.5em` was applied to _both_ the visible
<textarea> and the $clone. While this shouldn't make a difference –
one of the first things .adjustSize() does is setting the $clones
height to 0 – it somehow triggered that Firefox bug.

With this patch we remove the `height: 2.5em` before handing over to
OOUI's .adjustSize(). It looks like this fixes the issue. We might
be able to revert I7560ceb then.

Bug: T317369
Change-Id: I96c2d7d7bf359ff0373d478b2b7e97c8833ba5b6
2023-01-20 12:29:12 +01:00
jenkins-bot 9272edcbba Merge "Update eslint-config-wikimedia to 0.24.0" 2023-01-18 15:04:45 +00:00
Ed Sanders e4ce6db868 Update eslint-config-wikimedia to 0.24.0
Change-Id: I8299d287721eee6cb6d2354836e82812bf57badd
2023-01-18 14:39:04 +00:00
Wout Gevaert 0b75660801 Use getImageNodes instead of custom filter
Bug: T320874
Change-Id: I4ef69ea2395f310ce48f3e32bbf202713e2c7f15
2023-01-18 13:43:38 +01:00
jenkins-bot 8d94e10944 Merge "Replace mediawiki.Uri with native URL (ArticleTarget)" 2023-01-10 17:45:40 +00:00
jenkins-bot bc936d73ce Merge "Show "Continue" instead of "Try again" on button to save as another user" 2023-01-10 01:49:04 +00:00
Bartosz Dziewoński 2770809d1a Replace mediawiki.Uri with native URL (ArticleTarget)
Persistent global-ish properties in ArticleTarget and friends. A lot
of our own code re-uses them, and code elsewhere could refer to them
as well (although I didn't find any uses).

In one case we need to keep using mediawiki.Uri, to handle building
an array from query parameters exactly like PHP would handle it.

Bug: T325249
Change-Id: I57699ff9dd39179ca29a87b6e2d9b12c2b86eb7d
2023-01-09 20:34:27 +00:00
Nardog 17f40c29b8 Show "Continue" instead of "Try again" on button to save as another user
Bug: T190406
Change-Id: I513acdab8ba7b09c13901e070b88e34d2699fb06
2023-01-08 20:23:28 +09:00
Bartosz Dziewoński 9e79a0e218 Add more test cases for mw.libs.ve.getTargetDataFromHref
Bug: T324352
Change-Id: Ie6688736cadaa9f250f176b63b44fe85009dbbbf
2023-01-07 20:00:48 +00:00
Bartosz Dziewoński 25019d7f55 Fix encoding to roundtrip links without 'rawTitle'/'origTitle'
Our encoding for the hrefs like "./Foo" that we send to Parsoid
differed slightly from how Parsoid outputs them, so to avoid dirty
diffs, we had to store the original ones we received from Parsoid
and send them back if they were unchanged.

Change the encoding to match Parsoid's exactly (by referring to the
Parsoid source code), and then remove 'rawTitle'/'origTitle'.

On a historical note, 'rawTitle'/'origTitle' were originally added to
fix other issues with links, which I hope are long behind us:
* bb45d984ca (T145978)
* fda2e6c1b5 (T44140)

Follow-up to 362df66b47, which removed
some other old stuff from the handling of Parsoid links.

Bug: T325766
Change-Id: I0ad0a655380eb2fb29b5ac01e2e399ac550ce34a
2023-01-07 20:00:42 +00:00
jenkins-bot e603b1b02a Merge "Replace mediawiki.Uri with native URL (easy cases)" 2023-01-04 08:12:11 +00:00
jenkins-bot 8d7c36cfb5 Merge "Allow using native URL (or polyfill)" 2023-01-04 08:12:08 +00:00
jenkins-bot 161a6a0623 Merge "Fix post-edit notification after switching from old wikitext editor" 2023-01-04 08:12:05 +00:00
Bartosz Dziewoński fd80fae57f Replace mediawiki.Uri with native URL (easy cases)
Replacing one-off uses in various auxiliary features: only used
in function scope (or narrower), nothing else depends on them.
Some of them didn't even need to do any URL parsing or formatting.

Bug: T325249
Change-Id: Ia9a18656f67cb0a204c87605459abb9f5bbdc347
2023-01-03 22:18:01 +01:00
Bartosz Dziewoński 8f1e9b6089 Allow using native URL (or polyfill)
Adding the polyfill as dependency to everything using mediawiki.Uri,
so that we can change the code in separate commits without thinking
about this.

Bug: T325249
Change-Id: I8a7d2e6c7f98ed6187a85a88f2b4a0a4a5ecfc56
2023-01-03 22:18:00 +01:00
Bartosz Dziewoński 60b9a71f9b Fix post-edit notification after switching from old wikitext editor
Follow-up to 37b81b5ba4.

Change-Id: I2e61b265822d75cd409d57a4aec7abfbbd4d3fc4
2023-01-03 22:17:56 +01:00
Bartosz Dziewoński 1165a06f47 ve.ui.MWTemplatePage: Use <p> instead of <hr> in the description
I've never liked how this looked, it feels so 1995. Let's just use
multiple paragraphs instead of a <hr> to separate the text, similar to
what we do in ve.ui.MWParameterPage. The second paragraph is already
emphasized with italics.

Change-Id: I324cd1d81e61cf8a23095b4f8aed68040eb1bd8d
2022-12-29 16:14:47 +00:00
Bartosz Dziewoński fe77d35c36 ve.ui.MWTemplatePlaceholderPage: Remove cleanup for old mw.storage entries
Follow-up to 13f5637290.

Change-Id: Iba92f42831839bbf66ecbb8963cbd44e407392db
2022-12-29 16:14:41 +00:00
Bartosz Dziewoński 62d3fc128e Remove unused message 'visualeditor-dialog-transclusion-placeholder'
Unused since e1ea921f76.

Change-Id: I88a51de0ae5583ba52bb3477625879d273150b39
2022-12-29 16:14:35 +00:00
Bartosz Dziewoński 4fb3db27e6 ve.ui.MWTemplatePlaceholderPage: Move label to real label for accessibility
By using OOUI 'label' instead of 'help', the label is associated with
the input using <label for=...> in HTML.

The result looks almost the same, except for font size. I like the
change, and I don't think it was intentional to make the font smaller
here.

Bug: T277028
Change-Id: If178ca8feb9970c9287ab6dfe51fdf0a81df1c45
2022-12-29 12:40:11 +00:00
jenkins-bot d411175cd8 Merge "TemplateDialog: separate “Add template” messages" 2022-12-28 23:46:27 +00:00
jenkins-bot 729eb1a79c Merge "Remove redundant/conflicting ARIA label in template dialog" 2022-12-28 23:45:27 +00:00
Pols12 afca7bf0af TemplateDialog: separate “Add template” messages
Use distinct messages for section heading, button label and input
aria-label, to allow a potentially better localization.

Bug: T304121
Change-Id: I3e3b06a035e2f11f5f32face789b934e22916e49
2022-12-22 15:08:31 +01:00
thiemowmde a8fc627f3c Remove redundant/conflicting ARIA label in template dialog
The ARIA label was added via Ieeb29de. It was reusing an existing
message.

Later we added a placeholder to the same input field via I07c6e60.
Since then screenreaders possibly read two texts: "Find template" and
"Add template".

Bug: T296465
Change-Id: Icb8d5419b4a4e34a224744873c557cb873e17c40
2022-12-22 15:07:24 +01:00
David Lynch e9b2965655 Log bucket/token for the DiscussionTools mobile a/b test
Bug: T321961
Change-Id: I1e809c4405a561b75e59d2c27edbfc8a3e838f09
2022-12-16 14:44:29 -06:00
Thiemo Kreuz 8a42b05622 ve.dm.MWTemplateSpecModel: Document some large params as private class
While at it, also fix a few broken uses of `@see` where `@link` was
intended or for full names, there is no syntax needed, as JSDuck
already links those.

Change-Id: Iaeb46b05c6f2e6f00198bc2ae773c895935b4cea
2022-12-15 23:35:11 +00:00
Bartosz Dziewoński b6929d5be1 Change mw.libs.ve.getTargetDataFromHref to not return bogus data for external links
For external links, `.title` and `.rawTitle` properties previously
contained the external link corrupted with some normalization intended
for MediaWiki titles.

This was useless, and in fact no caller actually uses this value:
they all check `.isInternal` first before accessing `.title` or
`.rawTitle`.

Also, correct other parameter documentation.

Change-Id: Ieeab56548f0a3b2f81a90f0d3ae0f81d744aa67b
2022-12-14 22:57:04 +01:00
jenkins-bot 0c5f131976 Merge "Use new stable API for subtitle modification" 2022-12-14 04:12:38 +00:00
Jon Robson 612a307d68 Use new stable API for subtitle modification
Bug: T324876
Depends-On: Id8436324e2ae2fd9f488b65b3b7bfc19611870d1
Change-Id: I8e538939a6d7d4474f2e96b93040f3c68c2f98ec
2022-12-13 01:13:46 +00:00
Bartosz Dziewoński 133cacc42d Remove obsolete browser support checks for HTML5 History API
It is available in all browsers we support.

Change-Id: I6c860eadd91e6e4061ed0364be0dc8c7b750d3e7
2022-12-12 20:47:32 +01:00
Bartosz Dziewoński 237ffde471 ve.ui.MWPopupTool: Update usage of 'mediawiki.feedback'
* bugsListLink option no longer exists (I0ea65bf97d)
* bugsLink doesn't require mw.Uri

Change-Id: I9ab9d8b096a58fe0c49b296b121e5fe9a8dfd8bd
2022-12-12 19:43:14 +01:00
David Lynch 2b49b3bde7 Try/catch around mw.Uri when decoding parsoid resources
An incorrectly-encoded fragment is allowed-in-wikitext but will make
mw.Uri throw an error. e.g. `[[foo#1%bar]]`

Bug: T324976
Change-Id: I97cb85507d9ae3d648300245dd7e48cc239c4d90
2022-12-12 09:37:30 -06:00
jenkins-bot c4f9513110 Merge "Always sanitize href attribute in UI" 2022-12-09 23:40:22 +00:00
jenkins-bot 2b39fa6246 Merge "Always sanitize href attribute in CE nodes" 2022-12-09 23:38:16 +00:00
Francois Pignon 1b27b12b66 Optimize some jQuery selectors
Bug: T324523
Change-Id: I5d749e222b01a4f6abbc4517a8b568ad3e73e47f
2022-12-06 00:05:06 +00:00
jenkins-bot f6047f8642 Merge "Handle errors when rendering visual diffs" 2022-12-05 23:35:01 +00:00
jenkins-bot 4263eb1786 Merge "Adjust to changes to redlink behavior from parsoid" 2022-12-05 20:26:34 +00:00
David Lynch 83a46a7817 Adjust to changes to redlink behavior from parsoid
Redlinks now come down with a `mw:LocalizedAttrs` typeof, and have the
display URL parameters rather than being bare titles.

Bug: T324352
Change-Id: Ia1776e6e1f171d227c7c402b39ca96d17fb56cdb
2022-12-05 11:55:33 -06:00
Ed Sanders 5e503eb378 Always sanitize href attribute in UI
Bug: T322704
Change-Id: I19f722c40f1f8e5b55e44d9fb11109a6f9951c06
2022-11-30 18:26:37 +00:00
Ed Sanders 7afbe7516d Always sanitize href attribute in CE nodes
Bug: T322704
Change-Id: I0ce6d57adf7c688d11f6fc39af291b44c4b5aeeb
2022-11-30 18:26:37 +00:00
Bartosz Dziewoński 1ea3bf3013 Handle errors when rendering visual diffs
There are some known bugs that we probably will not investigate
(T313809, T317455). Do something better than an infinite loading bar.

Follow-up to ee7c5d9d1a.

Change-Id: I339de7662ff68c2ea9bb1a738bb4207d1c399e59
2022-11-30 18:17:54 +00:00
Bartosz Dziewoński c9a9b619aa Only hide #siteNotice on skins where it's shown in the editable area
Bug: T324055
Change-Id: I07139358d0e20582a53fc6820ae022b9edc0ba95
2022-11-29 21:19:46 +01:00
Bartosz Dziewoński 62d80ff88d ve.init.mw.DesktopArticleTarget.init: Remove redundant selector
Hiding '.ve-init-mw-desktopArticleTarget-editableContent #toc' is not needed
when we already hide '.ve-init-mw-desktopArticleTarget-editableContent'.

Change-Id: I9f7dc5f64be1f392e846da5bcfcd0a5d17a65014
2022-11-29 20:52:03 +01:00
jenkins-bot a4919ff345 Merge "Do not grey out page title while loading NWE on Vector 2022" 2022-11-24 14:00:35 +00:00
Bartosz Dziewoński a7395a04d7 Do not grey out page title while loading NWE on Vector 2022
The "uneditable content" styles should not be applied if the page
title is outside of the editor, like on Vector 2022 since T310839.

Bug: T322725
Change-Id: I212e41e3770807d43b4c58377ce77f4521e6b489
2022-11-24 13:43:45 +00:00
Ed Sanders 4bf8955c18 Link inspector: Avoid focussing a input when it isn't visible
Bug: T321026
Change-Id: I4edcf9c0cbe13eac450bc8e05883c7506b8dbfaf
2022-11-18 13:25:40 +00:00
jenkins-bot 82c845d30d Merge "Always allow switching to visual when using DirectParsoidClient." 2022-11-07 23:04:10 +00:00
daniel ea62ee6b19 Always allow switching to visual when using DirectParsoidClient.
When using DirectParsoidClient, switching should be lossless.

Depends-On: I86c611fa0b717ef619e5ffe550b6c2be49a28c99
Change-Id: Ie30ccbc8c12ce48f481b9f727f28e60d21ee37b9
2022-11-07 21:25:27 +01:00
jenkins-bot 2b5aeaf649 Merge "Improve smooth scroll to section with visual section editing on desktop" 2022-11-06 22:53:44 +00:00
jenkins-bot a46d76bc1e Merge "Platform: Handle invalid JSON in the other path in #getUserConfig" 2022-11-06 22:47:50 +00:00
Bartosz Dziewoński 288159d65c Platform: Handle invalid JSON in the other path in #getUserConfig
I discovered recently that I had 64 KB of text stored in the
'visualeditor-findAndReplace-findText' preference.

I must have accidentally copy-pasted a whole page into the "Find"
field, the JSON that VisualEditor tried to save became invalid after
MySQL chopped off the string after 64 KB, and since then VisualEditor
was unable to update the find-and-replace dialog preferences.

Change-Id: Ib1d853263d873d969c7b015b3842524e1f7fc351
2022-11-06 22:40:40 +01:00
Bartosz Dziewoński d2bbd0ed76 Improve smooth scroll to section with visual section editing on desktop
Follow-up to 8101b6511e.
$toolbarPlaceholder.outerHeight() only needs to be added when not
using visual section editing.

Change-Id: Idc7d9d59dea9eacbb8ee584c69e6bc4798562ea1
2022-11-04 19:53:43 +01:00
Jon Robson 282d075e0c Don't log errors due to missing edit buttons
There's nothing we can do about missing edit buttons - they are likely
being scrubbed by some script or gadget, so let's not report the error.

Bug: T314952
Change-Id: Icf778074026a24561c228cbf11e583062571d0cb
2022-11-03 02:22:54 +00:00
Jon Robson 99f8a7275a wgAction is not a number
Follow up to Icd227fc54f3bc16d5ce84c419b69344ca0d21f28
Currently showing up in logs as "NaN" but logged elsewhere
so not needed.

Bug: T314952
Change-Id: I0bf0d428384aa35bd43be026d451d62a2c237267
2022-10-26 19:39:43 +00:00
jenkins-bot b0cdf612a3 Merge "Allow more 'rel' values on external links in Parsoid output" 2022-10-26 16:44:19 +00:00
jenkins-bot b81e8e3e2e Merge "ve.dm.MWMagicLinkNode: Fix matching RFC magic links" 2022-10-26 16:44:16 +00:00
Bartosz Dziewoński 56195923d8 Allow more 'rel' values on external links in Parsoid output
Follow-up to I4070b3b16c8b2b76a0e7a67599efd914cbde63aa.

Bug: T321437
Change-Id: I4917c208251b4bcf1d31b07e717266970cb1516d
2022-10-26 01:07:08 +02:00
Jon Robson 131d6a247d Add further debugging information
I would really like to get to the bottom of this :)

Bug: T314952
Change-Id: Icd227fc54f3bc16d5ce84c419b69344ca0d21f28
2022-10-25 00:45:44 +00:00
Bartosz Dziewoński 0a2db9c1e9 ve.dm.MWMagicLinkNode: Fix matching RFC magic links
We need to strip the protocol on both sides. This might have been broken
by Ic00b38b04ce78178c64c13bab7f1b2e4b6c5b803 in MediaWiki core.

Bug: T321437
Change-Id: I11903b767aebfdb189a8d54fbf6fb7f8ce9ffb6a
2022-10-24 17:18:05 +00:00
Bartosz Dziewoński fdb7390d27 Allow 'nofollow' on external links in Parsoid output
Bug: T321437
Change-Id: I4070b3b16c8b2b76a0e7a67599efd914cbde63aa
2022-10-24 18:49:58 +02:00
jenkins-bot e115c05504 Merge "logger: Also log VisualEditorFeatureUsage events via Metrics Platform" 2022-10-24 13:07:29 +00:00
Arlo Breault c1afc62040 Bump requested Parsoid HTML version to 2.6.0
Change-Id: I544d31ca6ea6186a4ddaf7ef25fdea899f454c58
2022-10-20 17:01:17 -04:00
Sam Smith ddb5ac3a14 logger: Also log VisualEditorFeatureUsage events via Metrics Platform
The VisualEditorFeatureUsage instrument is a candidate for migration to
the Metrics Platform [0]. The first step of the migration is to log
events both using the Event Platform directly (i.e. via
mw.eventLog.submit()) and using the Metrics Platform client (i.e. via
mw.eventLog.dispatch()).

The Metrics Platform Client can mix in additional information -
so-called context attributes [1] - based on the stream configuration.
The majority of the default values mixed into each event are already
known to the Metrics Platform Client.

Note well that the Metrics Platform client will not log an event without
one or more streams being configured to receive that event. Therefore,
this change is a NOP.

An example stream configuration is given in [2].

[0] https://wikitech.wikimedia.org/wiki/Metrics_Platform
[1] https://gerrit.wikimedia.org/g/mediawiki/libs/metrics-platform/
+/aed6738b845/js/src/StreamConfig.d.ts#31
[2] https://phabricator.wikimedia.org/T309602#7973206

Bug: T309602
Change-Id: If40fcc6cae371788b98365953218300a5c0b3ca1
2022-10-19 22:53:47 +00:00
Sam Smith 75dc014db9 Use wgWMESchemaVisualEditorFeatureUseSamplingRate config variable
... for the sampling rate for the VisualEditorFeatureUse schema.

Bug: T312016
Depends-On: I259757db0c4441a3fcfce505d5bc82dcf2acf58c
Change-Id: I4e03b442568ed695a14d280b0e8dd92e22616426
2022-10-19 07:46:18 -06:00
Ed Sanders 2a4b4f6b96 GalleryContextItem: Only count image node children
Bug: T320874
Change-Id: I524901619820482c7152d7c7b9bc4a2b9f6ee3ca
2022-10-16 00:03:26 +01:00
jenkins-bot 77565dabf3 Merge "De-duplicate replacePageContent methods between desktop and mobile" 2022-09-29 14:00:00 +00:00
jenkins-bot 2cbf2470dd Merge "ve.init.mw.DesktopArticleTarget: Fix double <div class="mw-parser-output"> after saving" 2022-09-29 13:38:40 +00:00
Ed Sanders 1992281c82 De-duplicate replacePageContent methods between desktop and mobile
Change-Id: Icab82207d516843e7f2e4ba93b8ea4ffea7cad1b
2022-09-29 01:20:55 +02:00
Bartosz Dziewoński db82eb0263 ve.init.mw.DesktopArticleTarget: Fix double <div class="mw-parser-output"> after saving
Follow-up to 327bd736c5. .html()
replaces the inner HTML, .replaceWith() replaces the outer HTML.

Change-Id: I3c963c0a54f5aee4179c37a87466dffceb8c6a87
2022-09-29 01:15:13 +02:00
Ed Sanders b8bb53b79d ArticleTarget: Only overwrite title when not loading from view page
The previous implementation tried to do this, but looked
at the query string which can be set to action=edit by VE.

Bug: T318772
Change-Id: I4f0f8d52488a6b259033232afb8ea616458275de
2022-09-28 16:44:35 +01:00
Ed Sanders 596575582c Follow-up Ieba322fd: Don't generate postedit notification now we set config var
Setting the config var then loading mediawiki.action.view.postEdit
will already trigger the notification code, so we can remove this
duplicated code now.

Bug: T240041
Change-Id: If0d1aa4e734dab7cca168e78216f229b9924bab7
2022-09-26 12:08:54 +00:00
daniel 0cd6c90d5a Extract RESTbase client code into VRSParsoidClient.
This makes the "direct" client and the VRS based client
implement the same interface, so the caller doesn't have to know
which one it is using.

It looks like ParsoidHelper will not be needed if we use this approach.

Change-Id: Ib1c1d7355951fc0765227dd01a9edfc554fc448d
2022-09-14 18:20:36 +01:00
Thiemo Kreuz 003f5fc82e Remove redundant/unused CSS for template parameter page
A lot of this just repeats what is already set by some other rule,
e.g. because it is the OOUI default anyway. Warning. This patch is a
little more agressive. I tested it on desktop and mobile, even with
MonoBook, and could not spot a different. Please do some more tests.

Change-Id: I0ee6e70f4f14c20d431643c53031d6d5b8df1aa2
2022-09-12 11:32:39 +00:00
jenkins-bot f153331ee3 Merge "Remove redundant "choose" event handler" 2022-09-12 10:03:52 +00:00
jenkins-bot b3443cd96c Merge "Enable template editor toolbar deeper in the stack" 2022-09-12 09:52:26 +00:00
jenkins-bot 58aacfa046 Merge "Fix parameter labels not being clickable" 2022-09-12 09:50:04 +00:00
jenkins-bot 5d24bea80a Merge "Start with last item when shift+tabbing into parameter list" 2022-09-08 12:40:40 +00:00
jenkins-bot ee9866bfc9 Merge "Make "(undocumented parameter)" part of the parameter label" 2022-09-08 11:52:52 +00:00
jenkins-bot b00c52556b Merge "DesktopArticleTarget.init: Get $targetContainer after jQuery ready" 2022-09-06 22:17:23 +00:00
Jon Robson ecfc3f18e4 DesktopArticleTarget.init: Get $targetContainer after jQuery ready
$targetContainer was calculated at the top of the file,
but it's only guaranteed to be available after jQuery ready event.

Bug: T314952
Change-Id: Id5d0c71433bfc51cb7193ee1b931a7dd8a4324d9
2022-09-04 02:43:19 +02:00
jenkins-bot 4687e27ffa Merge "Fix logic for getting the *available* preferred editor" 2022-09-01 20:41:25 +00:00
Ed Sanders a625d0b7b7 Fix logic for getting the *available* preferred editor
Factor out getAvailableEditPageEditor from getEditModeFromUri
and use instead of getEditPageEditor everywhere.

Bug: T316776
Change-Id: I34bab092b829124c52f8bc0e262a9c3aa17f2c52
2022-09-01 22:25:53 +02:00
Ed Sanders 35138e00be DesktopArticleTarget: Fix popstate handling when action=edit (single edit tab)
This means if you load the editor on a single edit tab wiki,
then press back then forward, the editor will re-open.

Bug: T316869
Change-Id: I1ea33de7d7324a53399be9155c474a14ae21dfe8
2022-09-01 14:56:05 +01:00
Ed Sanders 45b36ad683 Fix broken history management in onEditSectionLinkClick
This code is supposed to be similar to the code in activatePageTarget()
however it was checking if the *link* URL looked like a veaction link,
not the view URL. It also then tried to push this.href as the new state
which was always undefined. This meant:
* If the section edit link was veaction= then nothing happened. The URL
  in the address bar would get updated *after* the editor loaded by code
  in DesktopArticleTarget.
* If the section edit link was edit= (single edit tab wikis) then the
  view URL would get replaced with and edit URL, meaning if you browser-
  backed out of the editor, the URL was stay as the edit URL.

Bug: T316771
Change-Id: Idb5e3c51a22361e0d9916d3c31444daeff310ed2
2022-08-31 13:57:02 +01:00
jenkins-bot 736cca3a18 Merge "DesktopArticleTarget: Set wgPostEdit when redirecting after save" 2022-08-30 22:26:58 +00:00
jenkins-bot 182eb7340e Merge "Fix calling order in template dialog .getSetupProcess()" 2022-08-30 13:28:51 +00:00
Thiemo Kreuz 663936ab6e Fix calling order in template dialog .getSetupProcess()
This fixes two issues:
1. .initializeAllStickyHeaderHeights() is now executed after the
   .ve-ui-mwTransclusionDialog-single-transclusion CSS class is set.
   This is critical because in this mode the sticky header does
   have a different height.
2. We get rid of 2 references to .sidebar that should not have been
   in this class in the first place.

Also bring some more calls in an order that makes sense. This does
not make a difference and is only for readability.

Bug: T315292
Change-Id: I22f6c11de8f693edb03485adcaa186bd4b283b2f
2022-08-30 14:20:42 +02:00
Thiemo Kreuz 337ee1588e Remove redundant "choose" event handler
I'm pretty sure this extra call is just pointless. This "choose"
event is triggered every time a new parameter is added to the list of
parameters. But there is another code path that is triggered in the
exact same situations: the onReplacePart event handler.

As far as I remember this "choose" handler was added very early when
the other events haven't been implemented yet.

This should be fairly easy to test. The only situation where this
could make a difference is:
1. When you have a template with 3 parameters and you add a 4th
   parameter.
2. When you edit an existing multi-part transclusion that contains a
   lot of parameters, but the parameters are initially hidden. The
   widgets are only created when you click "show all" or start
   searching.

Change-Id: I59e3873a4fe6fa5a01d681fce89fbe00756ae815
2022-08-30 12:23:07 +02:00
Thiemo Kreuz e5d6af728e Add missing call to .recalculateStickyHeaderHeight()
This was missing when you:
* Insert a new template and select a template with a lot of
  parameters.
* Same when you edit an existing multi-part template and add a new
  part (Ctrl+D) with many parameters.

Bug: T315292
Change-Id: Icd281c21a1b40d8e29343fa4975e27e8d927cd15
2022-08-30 11:57:23 +02:00
Thiemo Kreuz d92da786a2 Fix parameter labels not being clickable
This is only an issue when a long parameter description is collapsed.
The float is a left over from a time when there was a delete button
on the right side of each parameter label. This is gone.

Bug: T310137
Change-Id: I249f0592de9c73a07af22bd7f86241caf0207770
2022-08-29 17:12:28 +02:00
Thiemo Kreuz 299738307e Make "(undocumented parameter)" part of the parameter label
This makes it possible to click on "(undocumented parameter)"
to focus the input field – the same effect as when clicking the
parameter name.

This also lower-cases the initual "(U…". This is not the beginning of
a sentence.

Change-Id: Ibfa5bbaee39c2b3a4fefbcee33102b85ca3ba9c0
2022-08-29 17:00:23 +02:00
jenkins-bot f606e7c7e3 Merge "Don't focus template input fields (and open keyboard) on mobile" 2022-08-29 07:27:17 +00:00
Thiemo Kreuz d10dd4ded0 Don't focus template input fields (and open keyboard) on mobile
On mobile, tapping anything in the sidebar should only scroll the
corresponding element into view, but not focus the input field. The
reasoning is that an on-screen keyboard should only pop up when the
input field is actually tapped.

By the way, the "jump" issue in T312768 was because of the same
reason. In that case an onFocus happens before we have a chance to
scroll. Unfortunately there is no way to reverse the execution order
of these. Which is why we disabled the animation there.

Bug: T289043
Change-Id: I1c18802b8ff776fa8d9c17e3df8020354690d29f
2022-08-28 14:26:29 +00:00
jenkins-bot ce37169a51 Merge "Don't send missing $wgVisualEditorTabMessages to the browser" 2022-08-26 18:57:07 +00:00
jenkins-bot 5e50db824f Merge "Tweak main toolbar shadow to not leak out from the sides on vector-2022" 2022-08-26 16:49:07 +00:00
jenkins-bot 012458f4ca Merge "Fix a few risky places for a multi-valued rel attributes" 2022-08-25 00:13:22 +00:00
Isabelle Hurbain-Palatin fa58a9e6ec Fix a few risky places for a multi-valued rel attributes
This patch follows the audit made on the extensions to check the usage
of the "rel" attribute and check that it's compatible with multi-values.

Bug: T315209
Change-Id: Ib323736d93ea96c86f9d56599e515c9e6d72a76e
2022-08-23 15:21:41 +02:00
Jon Robson e763f9d2f2 Error logging: Provide additional debugging context
Bug: T314952
Change-Id: Ife8dffd2eb427d60ef4179f382109c7e2a1f0d1e
2022-08-22 11:21:44 +01:00
Thiemo Kreuz c35c1f6813 Dynamically calculate height of toolbar sticky headers
Alternative for Idf4d69d.

Bug: T315292
Change-Id: I15231d66bb832b92d1924881b0df7dbe9f26a921
2022-08-18 17:59:03 +02:00
Thiemo Kreuz e338a3c35d Enable template editor toolbar deeper in the stack
We can do this more in-place instead of reaching into the structure
from the outside.

Change-Id: I1beb5f7dcfef027f811a3bb4d2a2ef323e2535e3
2022-08-17 13:37:48 +02:00
jenkins-bot d81ac62283 Merge "Limit toolbar top border fix to vector-legacy" 2022-08-17 03:39:24 +00:00
jenkins-bot fd71fbe605 Merge "DesktopArticleTarget: Move updateTabs to .init so it can be called sooner" 2022-08-16 23:01:55 +00:00
jenkins-bot f03aa80f95 Merge "ArticleTarget: Move updateTabs implementation to DesktopArticleTarget" 2022-08-16 23:01:53 +00:00
jenkins-bot 16a8dc34a0 Merge "ve.ui.MWTargetWidget: Remove top margin in Vector 2022" 2022-08-16 22:51:35 +00:00
Ed Sanders 0588477b6c DesktopArticleTarget: Set wgPostEdit when redirecting after save
Bug: T240041
Change-Id: Ieba322fd6a33039f6c91868a266b9deefd2e0116
2022-08-16 15:32:45 +01:00
Ed Sanders 1c313eddf1 Follow-up I7fb352fc: Fix scope typo in ArticleTarget
Bug: T315320
Change-Id: Iefbb5ad1cee8069e52f9f62ae2191491e263a73b
2022-08-16 15:13:22 +01:00
Thiemo Kreuz 1926ab7b05 Code cleanup in ExpandableContentElement
This is split off from the unfinished patch I039d6f6. This only moves
existing code around, makes use of chaining and such to make code
more compact and hopefully more readable. Methods are renamed to
reflect better what they actually do. No behavior should change.

Change-Id: I3ba538c8c77ad4455bf0f0aa821ca14feadef7cc
2022-08-15 08:40:11 +00:00
jenkins-bot 254b14f3bf Merge "Chain scroll calls instead of just calling after each other" 2022-08-15 07:50:49 +00:00
jenkins-bot ba00286b13 Merge "Pass empty string to unused argument of pushState/replaceState" 2022-08-12 15:56:24 +00:00
Thiemo Kreuz eb71810b6d Start with last item when shift+tabbing into parameter list
Note this implementation introduces some technical debt: It adds a
little bit of knowledge about what "part widgets" and the toolbar are
to the parameter SelectWidget. I think this is acceptable.
A "cleaner" implementation is probably so complicated that we don't
want it in the code, for such a minor benefit. However, alternative
patches are very much welcome.

Bug: T313703
Change-Id: I957698d58a7622cbe54bcc2ba454388ba9f09537
2022-08-11 18:23:51 +00:00
Thiemo Kreuz 89ace728a4 Chain scroll calls instead of just calling after each other
Change-Id: I420fbd29ab79d6f2e1e9ef02bc3c99050126c3c8
2022-08-11 15:35:45 +00:00
jenkins-bot 54d0268847 Merge "Do not show incompatible skin warning when page is not editable" 2022-08-11 13:43:54 +00:00
Ed Sanders f9ed7066c8 DesktopArticleTarget: Move updateTabs to .init so it can be called sooner
The edit tab should be active as soon as the editor starts loading
(to indicate it doesn't need to be clicked again, and that the read
tab can now be clicked).

Change-Id: I450c53eef64c25e9520d3868b4ecc95204644138
2022-08-11 14:30:48 +01:00
Ed Sanders 9f5944af9e ve.ui.MWTargetWidget: Remove top margin in Vector 2022
Change-Id: I3d079a9e1b44821180c849c2c018a2314b2e089e
2022-08-11 14:27:53 +01:00
Gergő Tisza c697a6d2da
Do not show incompatible skin warning when page is not editable
Bug: T314952
Change-Id: Ie09f2ab5a8ae05cdd95ba1acbe02e978c002f8d6
2022-08-10 23:07:39 -07:00
Bartosz Dziewoński d36d467a82 ve.ui.MWTargetWidget: Suppress the stacking context established by .vector-body
Bug: T314230
Change-Id: I742f0435f279689dbdac8e811a8aeab00cc9086b
2022-08-11 01:47:19 +02:00
Bartosz Dziewoński 4cd18e42ab Tweak main toolbar shadow to not leak out from the sides on vector-2022
Bug: T311311
Change-Id: I847c8b64c5e24e92bf75d206f0815d1be3352292
2022-08-10 20:38:20 +02:00
Ed Sanders 08b3a21b25 Limit toolbar top border fix to vector-legacy
Also move code to .init so it can apply as soon as the
editor starts loading.

Bug: T311311
Change-Id: I87b15a0c56261a9f70291749bdbc37a518506d5d
2022-08-10 20:38:20 +02:00
Ed Sanders 260ee25f3a ArticleTarget: Move updateTabs implementation to DesktopArticleTarget
The .selected class does nothing on mobile, nor are the tabs visible
under the full screen overlay.

Change-Id: I14a6747f4a3274d71b7aa16b2c9b76b62a5253c2
2022-08-10 17:00:17 +01:00
Ed Sanders 686ef07ed3 Pass empty string to unused argument of pushState/replaceState
Per https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
this argument is treated as unused in all the browsers we support.

Change-Id: I83d3e2e8d9d2defa49e7a832f78bfc29f15da719
2022-08-09 13:37:34 +01:00
jenkins-bot 95774e4f2a Merge "Also log EditAttemptStep events via Metrics Platform" 2022-08-06 05:09:24 +00:00
jenkins-bot f842d6fa97 Merge "Rename value state variable" 2022-08-05 09:23:08 +00:00
WMDE-Fisch c66e700469 Rename value state variable
Is more intuitive like that.

Change-Id: Ib36d6fa1bce9a564f5b9a1c027f2573a5775d2c5
2022-08-05 10:07:18 +02:00
WMDE-Fisch 6cfa2e7dd0 Fix typos
Change-Id: Iaa7bf09877f32f7c19217103773657a8d8a81d16
2022-08-05 10:00:54 +02:00
Adam Wight 63c625f261 Remove unused config parameter from forked ControlsWidget
Split from I8eb279f.

Bug: T311296
Change-Id: I1739af4ca3c92a3aab08c61be8f665d2d3997f7c
2022-08-04 20:14:41 +02:00
jenkins-bot e857ded358 Merge "Streamline button margin calculation for outline parts" 2022-08-04 13:05:18 +00:00
WMDE-Fisch 7f4645bbe0 Streamline button margin calculation for outline parts
Generally the default button margin on the parts is 24px. The only
exception are the placeholder and wikitext when they are the last
parts in the outline.

Bug: T312644
Change-Id: Ie513bf1c022b2696cc92aacbbca59ddf6e55043e
2022-08-03 13:09:51 +02:00
jenkins-bot e50c0af860 Merge "Show "no parameters" message only when there are no parameters" 2022-08-03 09:43:50 +00:00
Thiemo Kreuz cdf9a59278 Tweak the hard coded top scroll padding for the parameter list
In Iebfe2e2 we already tweaked this by 1px. Turns out this was not
enough in all relevant situations. I still get random scroll events
just because I move the mouse around. Setting: Firefox, 120% zoom,
multi-part transclusion.

Bug: T312926
Change-Id: I475c1ef029e9721cc663881e40547730389cd26d
2022-08-03 11:15:32 +02:00
jenkins-bot f3f1e9c402 Merge "Tweaks to focus/scrolling code relative to sticky header" 2022-08-03 08:09:47 +00:00
jenkins-bot 13e5ae6997 Merge "Tighten conditions for incompatible skin warnings" 2022-08-02 11:42:24 +00:00
Thiemo Kreuz 5eb1193670 Tweaks to focus/scrolling code relative to sticky header
* Rename method because it turns out it is not only about the sticky
  header, but also relevant when there is no header.
* Move some code to more appropriate places.
* Use 0 as documented in OOUI, not null.
* Set the padding back to 0 when the sticky header is not visible.
  As of now this is an unreachable state because the filters never go
  away after they have been made visible. Still this code was always
  written with this possibility in mind to make it future-proof.
* Performance optimization for the boolean "show filters?" check.

Bug: T312926
Change-Id: Iaba08ccd8bf00360fd26f9268d5be43df4f4fbd8
2022-08-02 11:41:23 +00:00
Thiemo Kreuz 0b28414dff Restore scrolling parameters into view with(out) sticky header
This is a partial revert of Ide45141. Now the scrolling always
happens (again), but properly considers the presence of the sticky
header. It was also not correctly initialized on construction time.

This is a candidate for a backport. The patch is intentionally as
small as possible because of this. Code cleanup will be done in a
later patch.

Bug: T312926
Change-Id: I06425b42566bfb2087846636055ee75e98a05029
2022-08-02 12:29:06 +02:00
Thiemo Kreuz b9376f5990 Show "no parameters" message only when there are no parameters
The message was also shown when a documented template appears as
part of a multi-part transclusion but with zero parameters being
used. You see the filters in this case and can click "show all".
The message is just wrong in this situation.

Bug: T312926
Change-Id: I8d26ceec483e05fd1f69013e506fa1eb4e4c29ed
2022-08-02 11:48:45 +02:00
Thiemo Kreuz 800461efac Scroll below sticky header only if sticky header is present
Bug: T312926
Change-Id: Ide45141f0a21b782f8674ecbed9ee512de985661
2022-08-01 15:37:33 +02:00
jenkins-bot 2f555569ea Merge "Tweak the hard coded top scroll padding for the parameter list" 2022-08-01 13:05:03 +00:00
WMDE-Fisch 8ae4d291df Tweak the hard coded top scroll padding for the parameter list
Currently the sticky size is exactly 114px. With 115px you also can
see an auto scroll effect on multi part transclusions when you hit
that 1px sweat spot at the top of the list.

Bug: T312926
Change-Id: Iebfe2e2c6360c650755cd985157949a26a5287a4
2022-08-01 14:07:31 +02:00