Commit graph

2571 commits

Author SHA1 Message Date
Francois Pignon 1b27b12b66 Optimize some jQuery selectors
Bug: T324523
Change-Id: I5d749e222b01a4f6abbc4517a8b568ad3e73e47f
2022-12-06 00:05:06 +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
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
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
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 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
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
Ed Sanders 1c313eddf1 Follow-up I7fb352fc: Fix scope typo in ArticleTarget
Bug: T315320
Change-Id: Iefbb5ad1cee8069e52f9f62ae2191491e263a73b
2022-08-16 15:13:22 +01: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 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 1d34b069ad Merge "ve.init.mw.Target: Use mw.libs.ve.targetSaver.getHtml in getWikitextFragment" 2022-07-27 00:07:35 +00:00
Bartosz Dziewoński 43ce20b726 Remove "unrecoverable" errors from the save dialog
There are many errors that are temporary in some way, and treating
them as unrecoverable is a poor experience.

Even for errors that really are unrecoverable, our interface works
poorly, because you need to hide the error message first to do
anything else, and you need to close the dialog to see it again.

This distinction is not really helpful, let's get rid of it.

Bug: T307330
Change-Id: I9680cc416da5b27881aeb3502f506dcb5d4bb71f
2022-07-19 21:46:30 +02:00
jenkins-bot 6f16d02c0c Merge "Wikitext mode: Use action=parse for preview" 2022-07-16 16:54:30 +00:00
Ed Sanders 3148e28f69 Wikitext mode: Use action=parse for preview
Using Parsoid HTML in the 2017WTE has enabled us to iron
out lots of rendering bugs over the past few years.

In that time Parsoid has been moved into PHP, and at some point
we also become the default parser.

Also more extensions have started to use content transform hooks,
which are only supported by the action API.

As a result it now seems like a good time to migrate back to the
content API instead of building the preview from Parsoid HTML.

Bug: T154844
Change-Id: I90d775dd71d5f5a61d651b63d946ab60a27e2ca3
2022-07-12 17:12:06 +01:00
Thiemo Kreuz 6d41da0de7 Use short syntax for transforming one event into another
Change-Id: Id794f2b620edebd6eab71e3380ce1eeffcdc95ef
2022-07-12 11:54:04 +02:00
jenkins-bot 1e094a8868 Merge "Fix broken error message 'visualeditor-saveerror'" 2022-06-27 19:07:18 +00:00
Ed Sanders 327bd736c5 Use $.html to refresh page after save
Pre-parsing with $.parseHTML is not required as we
1) no longer modified the DOM before appending
2) trust the HTML coming from the API

Change-Id: If549a0e647ce830d4f5de2bb94c08a895e460667
2022-06-27 17:34:19 +01:00
Jan Drewniak a3e28fa0bf Rename data-ve-target-container attribute to data-mw-ve-target-container
This data attribute, used to give skins the ability to position VE on the
page, should be prefixed with `data-mw` to prevent it being inserted on
the page by user generated content.

Bug: T310197
Change-Id: Ia6f87535f11ccc7aadb26b7dd9e1ac8a867c377c
2022-06-23 10:49:07 -04:00
Jan Drewniak 2e42a46654 Introduce data-ve-target-container as a skin-customizable VE target
Defines an HTML attribute, `data-ve-target-container` that gives skins
the ability to choose which element they want to act as VE's target.

This attribute addresses a need in the Vector 2022 skin, where the
default selector, `#content` was no longer suitable to act as VE's
content container and more flexible approach was needed, so that the
skin itself could define which element VE should use.

This selector falls back to `#content` as was the case previously.

Additional change:
Update modules/ve-mw/preinit/styles/ve.init.mw.DesktopArticleTarget.init-vector.less
to account for the planned change to retain line between tabs and
toolbar in new layout.

Bug: T310197
Change-Id: Idae6755c90eacaab1a9daa88c6e28850d427810c
2022-06-22 20:18:12 +00:00
jenkins-bot 579b9896ae Merge "DesktopArticleTarget: Fix fade-in of toolbar tools" 2022-06-20 12:32:10 +00:00
Ed Sanders dcab210581 DesktopArticleTarget: Fix fade-in of toolbar tools
Bug: T310711
Change-Id: Icf76e8d4d743e3b43ab0d250c7a57c4ad4ce53d8
2022-06-17 23:21:32 +02:00
jenkins-bot e2a3629aa8 Merge "Remove redundant error message used sometimes when switching" 2022-06-17 13:24:10 +00:00
jenkins-bot 1119d52cd8 Merge "Fire new 'wikipage.tableOfContents' hook to update TOC after save" 2022-06-16 17:28:50 +00:00
Bartosz Dziewoński 5622576ef9 Fix broken error message 'visualeditor-saveerror'
The message 'visualeditor-error-invalidresponse' doesn't exist,
it has been removed in 5f1c68945d.
MediaWiki API methods can return an error message for this case.

The message 'visualeditor-saveerror' is not used anywhere else.

Change-Id: I3f5617b94135fa602b714aafc0eb6b16f2cd77df
2022-06-16 00:35:13 +00:00
Ed Sanders 841dd49da0 mw.Target: Allow more options to be passed to auto-save
Instead of just suppressNotifications, also include:
* Document ID
* Storage interface

Depends-On: Id7ca1dcf84a82b8e16109659b8f0f0d9a5d064fb
Change-Id: I6ab00c089c9ae1a8bb05ce9405f1f1f2fd0915ca
2022-06-15 23:48:51 +00:00
Bartosz Dziewoński 559d85f0f4 Remove redundant error message used sometimes when switching
The API error messages already explain everything well enough,
we pass them directly into a very similar popup in #loadFail.
This message is older than the pretty API error responses,
and didn't work with them well.

Bug: T306763
Change-Id: Ie0d8dc24c967cce02579d6c0539a55ba14372f84
2022-06-16 01:28:19 +02:00
Ed Sanders bd128f1b10 ArticleTarget: Restore 'commandHelp' to documentCommands
Was removed upstream in I42e32bd88a.

Bug: T154626
Change-Id: I390b706f19d479e0bd98ba6207cece661135676c
2022-06-15 22:46:15 +00:00
Jon Robson d8be7091a6 Ensure the edit/view tabs are never marked as "uneditable"
Since VisualEditor cannot be sure about how skins have marked up the
page, the code that marks content as uneditable (not clickable) can
be tightened further to make sure the edit and view tabs are not
marked.

This fixes the issue where the tabs are part of the content area

Bug: T162503
Bug: T310197
Change-Id: I4e7388c2e3b681b766068639ab9325bb6289562d
2022-06-15 22:27:53 +00:00
Ed Sanders 44f4068ecb Use surface's cancel command to close the editor
As this is a surface command, rather than a documentTrigger, pressing
escape will not close the editor if done elsewhere on the page, e.g.
in the site search bar, or an unrelated modal.

Move the logic to ArticleTarget as this could theoretically work
on the mobile site with a keyboard.

Allows us to remove some hacks around the ToolbarDialog that are no
longer necessary.

The command can also be used by the MWBackTool (which should be renamed)
and allows us to remove some custom logic from it.

Bug: T310694
Bug: T310695
Bug: T306763
Change-Id: I91ee6916a91d80d9872b3b44dad7eca55ad1acc4
Depends-On: I29f6af4cc7c71a63a6d1bafc53d16b9abd1b60ec
2022-06-15 19:24:21 +00:00
Ed Sanders 987d6f5ea2 mw.Platform: Fix parent constructor call
Change-Id: I4a2197d07a4e2ac576116310d09e8b2236430a34
2022-06-15 16:46:09 +01:00
Bartosz Dziewoński d6b5001580 Fire new 'wikipage.tableOfContents' hook to update TOC after save
Bug: T294950
Bug: T307480
Depends-On: I6cf76c870124c162dc1bcbc2f7e9ca0c5fdcd10e
Change-Id: Icaeda68ded94a04edef7a3629385eeb232048684
2022-06-09 11:31:50 -04:00
Sam Smith d1c8a6b1be Also log EditAttemptStep events via Metrics Platform
The EditAttemptStep 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 (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 via the
mw.eventLog.Schema defaults mechanism 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/T309013#7953227

Bug: T309013
Change-Id: I7627f116cf32ceb3455a33f4f7bb55208ba92671
2022-06-08 11:57:14 +01:00
Ed Sanders e4171b944b MobileArticleTarget: Update contentSub
Change-Id: I10db861531bd706e6b93aed3cbc501e5d717572f
2022-06-07 18:47:28 +01:00
Ed Sanders 6adeae03ed MobileArticleTarget: Update categories list if present
This only happens in AMC. Currently it is also not possible
to update categories in VE, but this may become possible if
we enable 2017WTE on mobile.

Change-Id: Ifeb6cc18910ce2fca634bc3e2245aac7e5c37e52
2022-06-07 18:45:56 +01:00
Bartosz Dziewoński 1cfef4232d MobileArticleTarget: Avoid jittering while scrolling
Needed after Ia18f31a299338f94e69f1882e6e477f3a22ae905 in VE core.

Bug: T307849
Depends-On: Ia18f31a299338f94e69f1882e6e477f3a22ae905
Change-Id: I87f3ac0974702ecaf7f5459604371de06f4a5756
2022-05-21 13:43:20 +00:00
Bartosz Dziewoński e84718d2b1 ve.init.mw.MobileArticleTarget: Remove hiding keyboard shortcut hints
Now done in VE core since Ie86217ba5651df8c427464e460ed836903834a3c.

Bug: T308200
Depends-On: Ie86217ba5651df8c427464e460ed836903834a3c
Change-Id: I3f65b0bc100895f7bd2262c3cbb5231fb055758b
2022-05-21 13:24:09 +00:00
David Lynch b59625158d Update schema logging of bucket for new DiscussionTools A/B test
Bug: T304030
Depends-On: I5e57bb9b7958576f3a04373748331a86f4626fb5
Change-Id: I2ef4c64a55eebc0d2eeca7a57b84b8ba0ded1499
2022-05-19 01:20:33 -05:00
Ed Sanders c877dc47fc Implement replacePageContent in MobileArticleTarget
Change-Id: I5b31bb9406bea15c5473363ba8fcda4c14f90994
Depends-On: Ifeb7c71e053501bc2c9448459c68895cb11368bd
Bug: T219420
2022-05-13 22:53:02 +01:00
Ed Sanders 37b81b5ba4 ArticleTarget: Always reload the page after save on non-view page
This is currently only handled in DesktopArticleTarget in teardown,
which happens after we've wasted time trying to update the page.

Also ensure we always reload on non-view pages on MobileArticleTarget
for other types of teardown (e.g. quitting the editor).

Change-Id: I7fb352fcacc8727bb113115e98af38a3940a8f9c
2022-05-13 22:53:02 +01:00
Ed Sanders ae58439c41 Upstream teardown of saveDialog from DesktopArticleTarget to ArticleTarget
Change-Id: I2e28f604d7e34fed15d9b74b6723347e3a17ce9e
2022-05-13 22:52:40 +01:00
Ed Sanders be2fc6c814 Upstream isViewPage from DesktopArticleTarget to ArticleTarget
Change-Id: Ic3839d9d70d6d4127fe2cd9bc01da799027fed3c
2022-05-13 22:47:06 +01:00
Ed Sanders 6e647b4858 Follow-up I420bfcac8: Fix typo in loop
Bug: T298147
Change-Id: Ia725709e221994737f393791de914994dbf415dd
2022-05-12 00:20:54 +01:00
jenkins-bot 1ed40a266e Merge "Filter <script> tags during parse, instead of save" 2022-05-11 21:52:47 +00:00
Ed Sanders 4dd590432e Filter <script> tags during parse, instead of save
This is a test to identify the soruce of stray <script> tags.

Bug: T298147
Change-Id: I420bfcac89528f3a11742214dd51fadd6281fd91
2022-05-10 17:31:22 +01:00
jenkins-bot d411579917 Merge "ArticleTarget: Ensure dataPromise rejects when switching fails" 2022-05-09 23:31:42 +00:00
Ed Sanders ab3b068671 build: Update stylelint-config-wikimedia to 0.13.0
Change-Id: I94a18ebc57ea04fe6246b63f6c9b5d5d8718dd4d
2022-05-04 22:54:48 +01:00
Ed Sanders b428b296e5 ArticleTarget: Ensure dataPromise rejects when switching fails
Requires switchToFallbackWikitextEditor to return a promise.

We can now pass dataPromise to the progress bar shown when
switching editors, so it hides if the switch fails.

Also fix logic for when a failed load is not retried.

Bug: T306763
Change-Id: I752ca505e7957b392202d44455b1e21b6e50fa63
2022-04-26 16:32:52 +01:00
jenkins-bot d1e777afcd Merge "Simplify ve-mw/init/styles LESS files" 2022-04-08 22:37:10 +00:00
jenkins-bot 82051a35d3 Merge "DesktopArticleTarget.init: Wait for deactivating to finish before activating" 2022-04-08 08:49:55 +00:00
Bartosz Dziewoński c8b0f17ce6 Store copyright message in auto-save data
Bug: T305225
Change-Id: Ie70587393715a461509dac6192d033a05c894f96
2022-04-07 23:03:37 +00:00
Bartosz Dziewoński bda0f44666 DesktopArticleTarget.init: Wait for deactivating to finish before activating
Bug: T305449
Change-Id: Ic2170450c851a10d01ef88c0b1de11d1d573acea
2022-04-07 23:26:58 +02:00
Ed Sanders be2a1ccf62 Respect useeditwarning user option when tearing down target
Also invert logic and rename variables to make tests in tryTeardown
and switchToWikitextSection identical.

Bug: T294463
Change-Id: Icb86a676c3f315e4a3d229f46eb383dcd7959973
2022-03-23 14:55:13 +00:00
Ed Sanders 8c36a630db Set desktop context / inspector padding to -10px in vector-2022
Bug: T258501
Depends-On: Ifaaa0dad4ecda3ff25d5fac54ccd2c95087d6f50
Change-Id: Id1f0a6d74740cf979de2b4a7f2a9f2e197615a13
2022-03-19 13:47:39 +00:00
Ed Sanders fc8d96d8b5 ve.init.mw.Target: Use mw.libs.ve.targetSaver.getHtml in getWikitextFragment
All HTML which we send to Parsoid should go through this function.

Change-Id: Ibfda5ac877326e65464fd1c28c1e050ebb09a6a5
2022-03-16 15:42:43 +00:00
Ed Sanders 38dfa608f8 Simplify ve-mw/init/styles LESS files
Change-Id: I49e05c9680e1fe7db8e01df627a6d5fa2836aac8
2022-03-15 23:10:34 +00:00
Ed Sanders 627bbc4aaf Rename ve-mw/init/styles to LESS
Change-Id: I50969b8798637368942b2d9315e7290f2c579f77
2022-03-15 22:16:59 +00:00
Ed Sanders 1fdda82b58 Remove Apex skin files
The Apex skin (not to be confused with the Apex OOUI theme)
is abandonware. Keeping files around that pretend to support it
is just maintenance debt.

Change-Id: I176e4e25307ab8ca4166a6e9b55e3bec4f058d05
2022-03-12 14:23:23 +00:00
jenkins-bot 96c32dcfb7 Merge "Allow auto-save recovery notifications to be suppressed" 2022-03-03 23:25:41 +00:00
Ed Sanders 4f578c269c Allow auto-save recovery notifications to be suppressed
Bug: T302327
Change-Id: If94e603458a385ba6eb15c4e29144f72e3ad12ca
2022-03-03 23:09:25 +00:00
Ed Sanders 1b5550f485 Move var declarations inline
Mostly ve-mw/ui and a few left overs.

Change-Id: Idea0c94d974e661c49af8ad4545cd8fd98179ca8
2022-03-01 17:50:24 +00:00
David Lynch 5012d2fa93 Make sure postEdit hook doesn't fire until after saveComplete is done
Follow-up to c8072f1af2

Bug: T302746
Change-Id: Iac76ac69a62b38282ae5aa6194a89ab9110b0954
2022-02-28 20:59:44 +00:00
David Lynch a6d11f5334 Don't let MobileFrontend show abandonedit after saveComplete
Follow-up to c8072f1af2

Bug: T302746
Change-Id: Id1ef6a02cde7a30eae7b36f1d10f07e9a363e974
2022-02-28 20:56:09 +00:00
jenkins-bot 839a62829d Merge "Add and fix default values in parameter documentation" 2022-02-21 13:41:51 +00:00
jenkins-bot d79527e1f2 Merge "Always scroll to top when loading VE source mode" 2022-02-21 13:23:28 +00:00
Thiemo Kreuz bc0a34b0ed Add and fix default values in parameter documentation
Same random finds while working on something else. I carefully
checked and made sure these methods are actually called without the
optional parameter.

Change-Id: Iab36fd130258322985b5d6e7f8e1f7b4ee235ba2
2022-02-21 13:19:21 +00:00
jenkins-bot aa8b08bd1a Merge "DesktopArticleTarget.init: Handle popState target reactivation properly" 2022-02-21 13:14:38 +00:00
Thiemo Kreuz 58e27f56d6 Remove not needed self = this indirections
These are only needed when we need to access a specific `this` from
within another `function () {}` context. This is not the case in the
situations here.

This is split from Ibf25d7e to make it smaller and easier to argue
about.

Change-Id: Ide1476de91fc343aa992ad92a1321d3a38b06dd0
2022-02-21 10:52:24 +01:00
Ed Sanders e4c22ec0d6 Don't suppress teardown prompt when pressing escape
Follow-up to If9e5d1fbf00f8359.

Bug: T302096
Change-Id: I60fcddee7bf0dfb3a39e92d26898da2963861c19
2022-02-18 18:15:40 +00:00
Ed Sanders c8072f1af2 Move methods from DesktopArticleTraget to ArticleTarget
To allow them to be used by MobileArticleTarget.

Change-Id: I33e8b3c2361c2dfd0fae8aa41eacf993c93c9c48
2022-02-18 17:04:04 +00:00
Ed Sanders 54cd911db0 DesktopArticleTarget.init: Handle popState target reactivation properly
This ensures the full loading sequence is shown when the
user opens VE using history navigation.

Bug: T301843
Change-Id: Ia7a641c8bd5a036f23c9da94bc539d8cf66c5021
2022-02-16 15:56:24 +00:00
Ed Sanders ca6ed21835 Always scroll to top when loading VE source mode
Change-Id: Ibfbb241f523fbdfcf6eb9fd1aeaa0e13782586aa
2022-02-16 15:17:19 +00:00
jenkins-bot b7a0a690fb Merge "Desktop: Always show loading progress in a toolbar placeholder" 2022-02-14 17:00:08 +00:00
jenkins-bot 23e9f189d6 Merge "Smooth scroll the heading to the right place while target is loading" 2022-02-14 16:59:49 +00:00
Ed Sanders 78decedd47 Desktop: Always show loading progress in a toolbar placeholder
Bug: T299907
Change-Id: I0eaeb98719bf7a43e4a87366cfcd204f35b74650
2022-02-14 16:17:48 +00:00
Bartosz Dziewoński 28c9a47164 Hide the edit notices tool earlier if there aren't any
Previously, a toolbar with the extra tool could be shown for a moment
while the editor was loading.

Bug: T301626
Change-Id: I7f5d01ef6e64ef85141a38a236fe2a1d1ada00e8
2022-02-14 15:48:55 +00:00
Bartosz Dziewoński efd1b3ab95 Fix narrow toolbar jumping during loading
When the editor is loading, and the browser window is narrow enough
that we should use the narrow toolbar, the wide toolbar would appear
for a moment. It was particularly jarring when it caused it to wrap
over two lines.

Bug: T301626
Change-Id: I551a66edab40235c4a26751eed163b5b30ef698f
2022-02-14 15:48:46 +00:00
David Lynch d984bf2246 Misnamed field on a/b test logging
Bug: T301497
Change-Id: Ibbcb23fc3a1d4b89b2cae49fb56901b91be2b3a1
2022-02-11 19:58:36 -06:00
Ed Sanders 38bdb0f87a Smooth scroll the heading to the right place while target is loading
This avoids a sudden scroll jump when the editor finally loads.

Bug: T299773
Change-Id: Ia2d56f7898d8e4c886297807954604ad5a8e8c38
2022-02-11 23:24:00 +00:00
David Lynch 5ccf0324f0 Improve DiscussionTools a/b test bucket logging
Make sure it works on pages which don't trigger DT, such as full-page
wikitext editing.

Bug: T301497
Change-Id: Id3d46eef319f278ee71fbbedbddd16d5ffd540d8
2022-02-11 15:58:25 -06:00
Ed Sanders fb8815f658 Fix some behaviour when user aborts VE loading with escape
* Pass 'noPrompt' to #tryTeardown
* #loadFail gets triggered by the data promise being aborted,
  so if 'activating' has been cleared at this point, don't
  prompt about there being load error.
* Retry/cancel dialog assumed you were coming from a wikitext
  editor. Rewrite the logic to handle teardown the target if
  the user is coming from read mode.

Change-Id: If9e5d1fbf00f8359f4d06fe7fc3064cc7e349bc9
2022-02-11 00:15:35 +01:00
David Lynch 9707d5e686 New bucket for abtest data
Bug: T291308
Change-Id: I20fb26fe5e294f6c117038bcef6f5ba92b01340b
2022-02-02 15:54:23 -06:00
Bartosz Dziewoński a2390efbf4 Re-apply "Re-duplicate deduplicated TemplateStyles"
Previous attempt in 005a8d24ef,
reverted in 3c1d167b33.

The deduplicateStyles() function lacked a check for fosterable
positions, which caused T299767. This is now fixed.

Also added tests.

Bug: T287675
Bug: T299251
Change-Id: I0d22be9b66d26d09373cee63dd6ce52c1659e62d
2022-01-28 02:08:09 +01:00
jenkins-bot 1f8e56a333 Merge "Move copyright warning message parsing from RL module to API" 2022-01-26 11:07:03 +00:00
Ed Sanders 312c35077f VE-MW: Consistently use target/surface $scrollContainer to set/get scrollTop
As in Idd97d9e6d3 in ve-core.

Bug: T299841
Change-Id: I728a723cbbb1d992e0e573800298784ba385882e
2022-01-25 22:28:10 +00:00
Ed Sanders d1aaf3d451 Include heading margin when running scrollToHeading
This avoids the heading text ending up uncomfortably close
to the toolbar.

Change-Id: Iddd5fea5d75902ed093d3e9839b63a2a3c480775
2022-01-25 16:04:12 +00:00
Ed Sanders c8c9424888 Use new *SelectableContentOffset method when setting section selection
We introduced these methods in Idc0cccbe but didn't update this
logic in MW.

This prevents focus being put inside an image caption if the section
starts with a block image.

Change-Id: I4cc1a116c1dcc8e1c642359ea768b6f5265a061b
2022-01-25 16:04:12 +00:00
Bartosz Dziewoński 8080bd2f5d Move copyright warning message parsing from RL module to API
Parsing it in the RL module caused the module cache key to depend
on the parse, which is slow and makes ResourceLoader sad. The usual
approach for solving this (I206bb05d28) can't be used, because of
how EditPage generates this message.

Bonus #1:
Generate the message for the correct page title. MediaWiki allows
customizing it per-namespace or even per-title, which we haven't
supported before.

Bonus #2:
Pass the context for message localisation (depends on I5f7c77970d).
EditPage::getCopyrightWarning() was parsing messages without the
interface flag, causing some needless processing elsewhere.

Depends-On: I5f7c77970d0525c0ff394f8bd72c69dcb5d00623
Bug: T298822
Change-Id: Iaa626f0e6379a5a370f9c465cea8528bb5bde7f7
2022-01-24 22:19:04 +00:00
jenkins-bot 43b2b3de95 Merge "Revert "Re-duplicate deduplicated TemplateStyles"" 2022-01-21 21:29:41 +00:00
Bartosz Dziewoński 3c1d167b33 Revert "Re-duplicate deduplicated TemplateStyles"
This reverts commit 005a8d24ef.

Reason for revert: Causes page corruption

Bug: T287675
Bug: T299251
Bug: T299767
Change-Id: Ib6b88114f6bdcd11ada0daf8ef6ec088569c88a6
2022-01-21 21:10:27 +00:00