Commit graph

236 commits

Author SHA1 Message Date
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 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
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
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
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
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
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
Arlo Breault c1afc62040 Bump requested Parsoid HTML version to 2.6.0
Change-Id: I544d31ca6ea6186a4ddaf7ef25fdea899f454c58
2022-10-20 17:01:17 -04: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
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
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 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 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
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
Ed Sanders 0588477b6c DesktopArticleTarget: Set wgPostEdit when redirecting after save
Bug: T240041
Change-Id: Ieba322fd6a33039f6c91868a266b9deefd2e0116
2022-08-16 15:32:45 +01:00
jenkins-bot ba00286b13 Merge "Pass empty string to unused argument of pushState/replaceState" 2022-08-12 15:56:24 +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
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 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 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
Bartosz Dziewoński b5cdd70508 Tighten conditions for incompatible skin warnings
Previously we could log a warning if the user had the editor enabled,
but the page did not support being edited as wikitext.

Bug: T312632
Bug: T314171
Change-Id: I647cb057ed44c155b4eba1b728d6908f8a7abb69
2022-07-30 15:35:47 +02:00
Thiemo Kreuz f09f704364 Don't send missing $wgVisualEditorTabMessages to the browser
This is send as an associative array. Instead of adding elements that
are null we can just not add them.

Bug: T291729
Change-Id: I28d847941eec865cb255779534eca14ec88f588f
2022-07-27 09:13:48 +02:00
Gergő Tisza 591796df12
Log incompatible skin warnings
Log a client error when VisualEditor cannot load because of an
incompatible skin (which is not supposed to happen in practice).

Bug: T312632
Change-Id: I2ccfaa584d7a05e10170a66d446bd4e476dcc775
2022-07-26 17:51:30 -07:00
Bartosz Dziewoński c2900af71e Remove temporary compat for $wgVectorTitleAboveTabs = false
The configuration option has been removed in
Ib35c6bfa5493f7dc81b63c42e7fedb8f1e47226b.

Change-Id: I1392cab0f6916c47cade833c10036adec2c9d4dd
2022-07-18 17:41:20 +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
Jan Drewniak d88fd9b6a8 Prevent skinStyles from applying to the Vector 2022 skin.
With related changes to the DOM in the new Vector skin, most skin
styles are no longer necessary for Vector 2022.

This patch also fixes an issue with the font-size of the toolbar
when $wgVectorTitleAboveTabs = true.

Bug: T310197
Depends-On: Idae6755c90eacaab1a9daa88c6e28850d427810c
Change-Id: I6776f08b24f83cf4daeef70bfdeb73dfeafc785a
2022-06-28 19:51:42 +02:00
Bartosz Dziewoński 2239f3cc20 Do not grey out page title while loading on Vector 2022
Follow-up to Idae6755c90eacaab1a9daa88c6e28850d427810c. These styles
still used #content instead of the new way of specifying the target
container.

Extra cleanup:
* Don't apply custom styles to #firstHeading when it's outside of
  the target container
* Remove unnecessary rule (it was added in 6d8fbd8221 to support
  an absolutely-positioned loading toolbar, but it is no longer
  positioned that way)

Bug: T310839
Depends-On: Idb2a743c93316786d6d36e1989cf6620a6092281
Change-Id: Ib5e8f98eacf763e360fae79337d3f2733b1a101b
2022-06-23 17:32:30 +00: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
David Lynch dface70a04 Log if an edit attempt began from the sticky header
Bug: T298634
Depends-On: I871494b6e783018b1433f294e09b0d53dded6c3d
Change-Id: I17991d5a2be128c866b5ec5d802269066da8b106
2022-06-15 02:55:53 -05:00