Commit graph

139 commits

Author SHA1 Message Date
jenkins-bot 8d119a4356 Merge "Re-duplicate deduplicated TemplateStyles" 2022-01-16 00:24:31 +00:00
Bartosz Dziewoński 005a8d24ef Re-duplicate deduplicated TemplateStyles
Bug: T287675
Bug: T299251
Change-Id: I7711c30131cb441f84b3e2137983f0ba2a50b46f
2022-01-14 21:35:11 +00:00
Ed Sanders c0f3fc3a78 Pass visibleSection & visibleSectionOffset to target
* Find the first section below the top of the viewport
  (usually visible) and measure its offset.
* After loading the editor, ensure this heading is still
  at the same position on the page.

Bug: T296910
Change-Id: I9a05ea74ba3c19a4a91ddc1bc0afe311851c53e6
2022-01-11 20:39:27 +00:00
Ed Sanders 40a50cac4a DiffPage: Only set user pref on 'choose' event
This prevents your preference being changed if you just
followed a link with a diffmode parameter.

Change-Id: I755563bde285e95c0367119d49a40e1dd3c5e178
2022-01-06 16:48:02 +00:00
Ed Sanders 302303de46 DiffPage.init: Move and rename some vars
Change-Id: Ibcef23650e6c77d9142055e9e7357ce095ba3b49
2022-01-06 16:47:35 +00:00
Ed Sanders 1c6dbf433f Remove more DOM garbage introduced by 'Web of Trust' extension
Bug: T297862
Change-Id: Ib6efe0c4ea68a1b17efd37839cec428dc9ebf6b7
2021-12-20 17:54:20 +00:00
Ed Sanders b57fe3e8ba Only set diffmode-historical user option when it has changed
Bug: T290703
Change-Id: I289e0c20db9235a432f7f49a425328ab617d57f3
2021-12-20 14:27:37 +00:00
Ed Sanders 4d13a4f4ed eslint: Enable no-jquery/no-append-html
Prevents accidentally treating plain text or user input
as HTML, which could be an XSS vulnerability.

Change-Id: Id4af48447a0907962a57340cb60aca08df9cc505
2021-12-16 02:04:11 +01:00
jenkins-bot 9853498756 Merge "Update multi-tab code after changes in Minerva" 2021-11-25 11:22:30 +00:00
Bartosz Dziewoński 7fff473cf7 Update multi-tab code after changes in Minerva
Bug: T294192
Change-Id: I20c60711147e36366229b58f481df0508e2278ee
2021-11-16 14:10:56 +01:00
Ed Sanders 86c405a2e1 Prefere ve.extendObject over $.extend
Change-Id: I37fef45701653cef08de9ec699865aa4fdf477bc
2021-11-15 21:30:19 +00:00
Bartosz Dziewoński f5f26d848d ArticleTargetSaver: ve.init may be undefined
Bug: T294981
Change-Id: Ibd1cf9db9ebb58e7b7721e35991dd4027506c0dd
2021-11-03 22:12:33 +01:00
David Lynch 03264d55a5 Pass editingSessionId through to API save requests
Bug: T286076
Change-Id: Iaec4fa50affddf01462156f11236c1210f76cc91
2021-10-28 21:17:55 +02:00
jenkins-bot fed17e94b6 Merge "Give skins/extensions ability to trigger VisualEditor" 2021-10-20 23:45:14 +00:00
jdlrobson d5b3d2bcbe Give skins/extensions ability to trigger VisualEditor
It should be possible for extensions/skins to trigger the click event

It should be possible to do $('#ca-edit').trigger('click') so that
Vector's sticky header can trigger the VisualEditor.

Bug: T293159
Change-Id: I58625ffca982edfbc4cdcb14a666d79093e1b89d
2021-10-20 16:20:02 -07:00
Ed Sanders 789519012e Add mobile 'content' class to visual diff
Bug: T293392
Change-Id: I7d0d6fee5a50fc2d965ebf0ad20c49dd26c70901
2021-10-14 17:26:03 +01:00
David Lynch 760ae6643f Give the categories box a highlight on hover
Most block-level things that can be interacted with by clicking have a
highlight. Categories don't, and that makes it harder to discover that
you can edit them.

Change-Id: I6be3824c34b36bd09bbae8cab9a9f36b6bcdb767
2021-09-22 21:17:40 -05:00
Thiemo Kreuz aa556e3ef8 Update and fix all @param config and @cfg documentation
I tried to review all of them. Some of the changes I did:
* Make sure the `config` parameter is not marked as optional
  when it is not.
* Make sure default values are mentioned.
* List individual `@cfg` options when it makes sense.

Note I don't list all options a class could accept (e.g. via all
its parent classes and mixins). That's too much. Instead I checked
how a class is actually used and list only these options.

Even then I don't list everything, e.g. unspecific options
like "classes" that can be used pretty much everywhere.

Change-Id: Idf4fbe1dc3608ace277df9e385f2f140df3a2f50
2021-09-12 12:35:27 +00:00
Thiemo Kreuz 36bd65dda7 Cleanups and optimizations related to .parseDom()
E.g. avoid calling the rather expensive method multiple times
in a row, if only 1 of the results is needed.

Change-Id: Iff1d2c0892367e927303f6f45d3231e04c045cab
2021-09-02 18:29:09 +00:00
WMDE-Fisch 685bd0b303 Remove some stylelint rules not needed anymore
Got stylelint feedback from local npm test runs about that.

Change-Id: I4e2f1f8baeeac1608f104982c709aaec01e372b5
2021-08-30 17:07:43 +02:00
jwbth 6d7a062dbb Fix history.replaceState call on diff pages
The history.replaceState call in onReviewModeButtonSelectSelect() (1)
ignores any changes to the document URL made by external tools such as
RevisionSlider, (2) replaces with an empty string the history entry
state object if it was set by external tools such as, again,
RevisionSlider. Both 1 and 2 result in a wrong URL ending up in the
address bar at some point. This patch addresses these problems, (1)
creating a new mw.Uri() object every time
onReviewModeButtonSelectSelect() is called, (2) keeping the current
history.state object.

The original variable storing the URI object is renamed to avoid
shadowing (optionally can be replaced with its value as it's used only
once).

Bug: T288636
Change-Id: Ieb97b561a6c076aa28aae231fe286ac4d1051bbd
2021-08-14 10:51:24 +00:00
Bartosz Dziewoński ec3341c9a1 Avoid conflicts between 2017 wikitext editor and DiscussionTools new topic tool
They both want to handle the same URLs. If we detect that
DiscussionTools new topic tool will open, then do not open 2017
wikitext editor.

Bug: T282204
Change-Id: Ic7dd677ea219938969f60bab91387c2e03ebdbe6
2021-07-28 16:10:22 +02:00
Thiemo Kreuz fae6118071 Document and use mw.Api parameter defaults
Reasoning:
* format=json must be the default. Nothing else makes sense in
  the context of this code. This should not be a surprise.
* formatversion=2 is only a default when the custom
  getContentApi() is used, but not when mw.Api is used. One
  might argue that it's safer to always specify formatversion=2.
  However, this is not done in other places in this codebase.
  It should never be done or always.
* I find it confusing when the action=… is missing. Let's not
  rely on this default.

Change-Id: I6ca29f76bffc0849103c5bcff4aaf28fcaaa4c52
2021-07-12 09:13:59 +02:00
Thiemo Kreuz c2017f74b2 Remove @param/@return docs that literally repeat the code
These don't add any knowledge but make the code harder to read
and maintain, and are an additional source of errors.

Change-Id: Ied57741a3f985e355adfddb4e75378d5c497faa9
2021-06-14 15:44:51 +02:00
Thiemo Kreuz 0ad9e90c37 Use term "wikitext" when working with TempWikitextEditorWidget
This reflects better what the widget actually does.

However, the config option `value` as well as the method
`getValue` are not renamed. These intentionally mirror a OOUI
convention.

Change-Id: I26e733b760501e57b3314d5da2d65bfdd4b38346
2021-06-09 10:23:36 +02:00
Ed Sanders 857014fae9 Support watchlist expiry
Bug: T251348
Change-Id: I017a54784c758c5e97fb640721bd456adc0fbab5
2021-06-08 20:14:45 +00:00
jenkins-bot 13f8d7db67 Merge "Remove obsolete vendor prefixed properties" 2021-05-18 01:25:08 +00:00
jenkins-bot 68f8f26fd7 Merge "ArticleTargetLoader/Saver: Move vars inline" 2021-05-06 16:14:13 +00:00
Ed Sanders 2cf163fa23 Move vars inline in preinit code
Change-Id: Ice86931a48b4563a881af16d2fe8e344d49bc73f
2021-05-05 18:06:37 +01:00
Ed Sanders db90e1e610 ArticleTargetLoader/Saver: Move vars inline
Change-Id: I4afe5d0c68cb6284fe5178674e8942afb2b9d5bd
2021-05-05 16:56:49 +01:00
Volker E c468f529fc Remove obsolete vendor prefixed properties
With updated basic support, let's remove obsolete vendor prefixed
properties.

Bug: T278670
Change-Id: I13ceec520559745c877588200024ebce16944da1
2021-05-03 08:09:01 -07:00
Bartosz Dziewoński ee7c5d9d1a Handle errors when fetching revisions for visual diffs
Bug: T171937
Change-Id: Ic300b0b2995ea3f8b93af1557e06503fc8470c7c
2021-02-23 01:21:55 +01:00
Bartosz Dziewoński b91c8647fe Ignore user prefs for enabling/disabling VE which are not settable
We have two preferences used for enabling/disabling VE:
'visualeditor-enable' and 'visualeditor-betatempdisable'.
(And 'visualeditor-autodisable', which sometimes overrides
them both, but it's not relevant here.)

The user can only set 'visualeditor-enable' when VE is Beta Feature,
and they can only set 'visualeditor-betatempdisable' when it is not.

However, when deciding if VE should be loaded, we always checked both
of the preferences. This gives incorrect results when the preference
that is not supposed to be settable actually exists, due to being set
in GlobalPreferences on another wiki where it's settable.

A similar issue could occur if VE configuration is changed from Beta
Feature to a normal preference (or the other way around), and the
preference values for the previous configuration still persist.

Bug: T271434
Change-Id: I7399b3c516f762429050a662ac85d1d392392323
2021-02-05 12:40:51 +00:00
David Lynch 2ee500ed70 Logging init mechanism consistency
Support the `url-new` mechanism so we can distinguish between
new/existing sections in direct navigation.

Also, mechanism will now correctly be `new` when clicking the "create"
tab on a previously empty page.

Bug: T272544
Change-Id: I667a1c45c3948ec6dfed8f348a1327bffaba58a5
Depends-On: I3cee7a3a4c4b646692dce4a1180c4ba18a61f4bc
2021-01-29 20:28:11 -06:00
James D. Forrester cb9a31adac build: Upgrade eslint-config-wikimedia from 0.17.0 to 0.18.0 and make pass
Change-Id: I8c45850965ed5b96a0980de70a25f6d5b355350d
2021-01-25 10:21:32 -08:00
jenkins-bot 187a5fe7ac Merge "Preserve vehidebetadialog URL flag when switching editor mode" 2021-01-13 17:38:22 +00:00
jenkins-bot c4676d025a Merge "Try/catch Uri creation" 2021-01-05 20:11:48 +00:00
jdlrobson b89e97f8d8 Try/catch Uri creation
This is generating hard to filter logspam.

Seen on:
https://no.wikipedia.org/w/index.php?oldid=prev&diff=20998556&title=Uformelt%20spr%E5k

Bug: T270331
Change-Id: I4ba537dbb942e977cb01d5943e83e4646cbccfe0
2021-01-05 19:39:45 +00:00
Gergő Tisza c88ee8cd54
Preserve vehidebetadialog URL flag when switching editor mode
Switching from visual editor to old wikitext editor results in a
page reload and loss of the mw.libs.ve.disableWelcomeDialog()
flag. Use an URL parameter to preserve the flag.

Bug: T235812
Change-Id: I3968e5b7ae536d45fd764a8b7c3ea1f6d616033f
2021-01-04 19:54:32 -08:00
Bartosz Dziewoński 504e47e03a ArticleTargetLoader: Allow customizing 'editintro' parameter
Bug: T269310
Change-Id: Ic77ce84172f114795708f48a4a7457b2965568f9
2020-12-17 02:01:09 +01:00
Ed Sanders 3e6d5c6817 Remove upstreamed clearfix
Change-Id: I9c5c56bd8a30b96b43fe680bcc8a7151de5f78be
Depends-On: I840ecdf2cfd3f4fba51418199346164fd0c439b6
2020-12-02 21:21:49 +00:00
Ed Sanders 6a238b784e stylelint: Remove needless disables
Change-Id: I83c778f1b08b96e6a34068f497c7a72f2887ad4c
2020-11-19 23:38:11 +00:00
jenkins-bot f612cb90d5 Merge "ArticleTargetLoader: Add ve.loadModules hook" 2020-11-11 01:37:37 +00:00
Roan Kattouw 4f5c27be09 ArticleTargetLoader: Add ve.loadModules hook
This provides a consistent entry point for registering plugins on both
desktop and mobile, without needing to do strange things if the right
ResourceLoader module hasn't loaded yet.

Without this, registering a plugin module in JS requires ugly code,
and on mobile it wasn't possible at all.

Bug: T267692
Change-Id: Ie2c320c33ec2b064fba4fb45ba62545b9211439a
2020-11-10 23:31:07 +00:00
jdlrobson 9954dd0bc4 [vector modern] VisualEditor margins are tied to Vector variables.
Bug: T259331
Bug: T259272
Depends-On: Ibbc6f1905ea384a3d159088e3f5eca947eb6ec08
Change-Id: Ic918e9c4ba580ecc54ef51607ce9698e2461c679
2020-10-14 14:52:32 +01:00
Ed Sanders 6c36e403aa Convert ve.init.mw.DesktopArticleTarget.init-vector.css to LESS
Change-Id: I5e7c56ebf9e68706e8fc39b1bd4bf81be878ffe4
2020-10-14 13:11:48 +01:00
Ed Sanders 5c84f0cd88 Rewrite EducationPopup so it isn't a mixin
Reference images are moved to Cite and used by Citoid.

Bug: T170919
Bug: T171292
Depends-On: I02041246dda1b3d3ad1bcc0b014fa022e8259b62
Change-Id: Id97659ed1fa64a1223a8957fefaf2a149edd0e9c
2020-09-24 21:33:50 +01:00
jdlrobson 29efc96cd5 Fixes: Error: Bad constructor arguments
Change-Id: I2f1146946bfb96d50f9580f2f7a9bd5dcb926ef1
2020-09-17 11:00:41 -07:00
jenkins-bot 4e55aa9488 Merge "Disable ArticleTargetLoader on invalid UTF-8 URIs" 2020-09-09 12:17:55 +00:00
jdlrobson 0d64cd8649 Disable ArticleTargetLoader on invalid UTF-8 URIs
Bug: T106244
Change-Id: Ieb2c7610e9f49fd33df63a920ebf871110f0b2e6
2020-09-08 15:57:59 -07:00