Commit graph

8918 commits

Author SHA1 Message Date
Volker E
4c47d37688 Update WVUI to v0.3.2
Release notes: https://gerrit.wikimedia.org/r/plugins/gitiles/wvui/+/refs/tags/v0.3.2/CHANGELOG.md#v0_3_2-2021_11_01

Bug: T290392
Change-Id: I8fb7761e60be330e58cd017872318fe3675c0be1
2021-11-01 17:39:44 -07:00
jenkins-bot
50e133a8b2 Merge "Follow-up I86568863: mw-ui-button: Reduce specificity of margin rule" 2021-10-29 17:59:20 +00:00
Nicholas Ray
45c003e1ce Change checkboxHack bindToggleOnSpaceEnter function
This refactors the bindToggleOnSpaceEnter function to use keydown and
keyup listeners to provide the space/enter key functionality. This
provides the following benefits:

* A click event is triggered when pressing the space or enter key on the
passed in "button" element. This simulates native button behavior which
triggers a click event when these keys are pressed.

* Checkboxhack menus will no longer toggle rapidly when holding down the
space/enter keys.

Bug: T291096
Change-Id: I1ea65112fa6b527f1bd9118212838298399996aa
2021-10-27 17:06:17 -06:00
Nicholas Ray
d99dd4040e [BREAKING] Change cleanup API of checkboxHack
Before this commit, each bind function would return an object containing
a reference to the function used in the event listener creation with the
intention that this could later be used to cleanup the event listeners.
This is problematic for the following reasons:

* In order to cleanup the event listener, it forces the client to know
which element the event listener was added to (button, checkbox,
document, window, etc.),. the event type that was used ('click',
'focusin', etc), and whether or not the "useCapture" param was also
used. The `removeEventListener` API won't remove the correct event
listener unless these three pieces of info are known by the client [1].

* Because the above point is tricky to get right, numerous potential
memory leaks were possible with the `unbind` function as the
`useCapture` param wasn't being passed in some cases.

This commit aims to simplify the cleanup API by returning an anonymous
function in each bind function that the client can call to cleanup the
relevant event listeners without knowing any of the implementation
details. This also makes the `unbind` function unnecessary.

** This is a breaking change to the checkboxHack API ** but because
there aren't any known clients of the return values [2], a formal
deprecation process was assumed to be unnecessary. Note gadgets should
not be using the internal function mw.loader.require so these were
not considered.

[1] https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#matching_event_listeners_for_removal
[2] https://codesearch.wmcloud.org/search/?q=checkboxHack&i=nope&files=&excludeFiles=&repos=

Bug: T291096
Change-Id: Ia2d79f27dd81fdc74a44829da3ca472f4c01d4b5
2021-10-27 18:25:49 +00:00
Ed Sanders
e5f26988b1 Follow-up I86568863: mw-ui-button: Reduce specificity of margin rule
This rule can continue to apply to all buttons. Increasing
the specificity caused regressions.

Bug: T294286
Change-Id: I8bf02e81df56cafa221daeeb0f36e0305c6d9816
2021-10-26 23:27:42 +01:00
jenkins-bot
f6f6c748a6 Merge "mediawiki.action.edit, mediawiki.page.watch.ajax: Move var declarations inline" 2021-10-25 17:23:58 +00:00
Ed Sanders
11ed9f9831 mediawiki.action.edit, mediawiki.page.watch.ajax: Move var declarations inline
Change-Id: I2b0a4ce806d0f3354c785d60d0cb596f50e93936
2021-10-25 16:05:56 +01:00
jenkins-bot
ca893ec1c9 Merge "Make live preview work when section=new&nosummary=1" 2021-10-21 16:53:55 +00:00
Nardog
2204a6d01a Make live preview work when section=new&nosummary=1
#wpSummaryWidget does not exist if index.php has
section=new&nosummary=1.

Bug: T293892
Change-Id: Icfff6c70b4967edd4b70affa13b7584ab356bc8b
2021-10-20 19:54:08 +00:00
Alexander Vorwerk
ec2cd3dc37 Hard-deprecate remaining MWNamespace methods
MWNamespace has been deprecated in favor of the NamespaceInfo
service in 1.34 and should no longer be used.

All methods are unused in wikimedia-deployed extensions.

Bug: T291389
Change-Id: Ibe2069dea1af983d8fda53e734396c5a7a8b7321
2021-10-20 21:16:25 +02:00
jenkins-bot
a42e686602 Merge "mediawiki.action.edit.preview: Use same UX as in normal diff" 2021-10-20 16:55:21 +00:00
Fomafix
b4e9c1cdf9 mediawiki.action.edit.preview: Use same UX as in normal diff
This change fixes the following differences and bugs compared to the
normal diff:

* On an empty change the API response contains no `main` in
  `response[ 0 ].compare.bodies`. Remove the previous diff and show a
  'diff-empty' message in this case.
* The header with 'currentrev' and 'yourtext' is missing. Show this
  message similar to the normal diff.

The HTML in the diff of the live preview is not exactly the same as in
the normal diff:
* The live preview has now <thead> and <tbody> elements.
* The live preview has always 4 columns.

Bug: T293307
Bug: T293597
Change-Id: Ibb4fccb74634094ffeabf6fe201257d747bb8a01
2021-10-20 14:24:22 +00:00
jenkins-bot
4454ea3b9c Merge "mediawiki.util: Improve docs with updated examples from wiki page" 2021-10-20 01:54:59 +00:00
jenkins-bot
c0844fae83 Merge "mediawiki.page.ready: Fire hook 'wikipage.indicators' with children" 2021-10-20 00:45:42 +00:00
Fomafix
8bec93a573 mediawiki.page.ready: Fire hook 'wikipage.indicators' with children
The parameter of the hook 'wikipage.indicators' in mediawiki.page.ready
and in mediawiki.action.edit.preview was inconsistent:

* mediawiki.page.ready fired the hook with the root element.
* mediawiki.action.edit.preview fired the hook with the children
  elements.

This should be consistent.

mediawiki.action.edit.preview fires the hook before adding the elements
to the DOM. Therefor it can't fired with the root element before adding
to DOM. To be consistent the behavior in mediawiki.page.ready must
changed to the behavior in mediawiki.action.edit.preview.

Also remove the text nodes with the newline from the value in
mediawiki.action.edit.preview to be consistent with the value in
mediawiki.page.ready.

This change is a follow-up to bea70565d9.

Bug: T293564
Change-Id: Ie8890e6396db071975794655c4e4ec3616891f96
2021-10-20 00:24:24 +00:00
jenkins-bot
ca32b46557 Merge "mediawiki.Title: Regenerate phpCharMappings against plain PHP 7.2" 2021-10-19 21:23:40 +00:00
Petr Pchelko
c7a1e792d0 mediawiki.Title: Regenerate phpCharMappings against plain PHP 7.2
After the unicode migration from HHVM-like to PHP 7.2 (T219279),
MediaWiki is running in production with default PHP 7.2 unicode, so
some of the char mappings overrides for mw.Title are no longer
nesessary, since PHP is now closer to JS.

Bug: T219279
Change-Id: Ic487c55b09ff81c1b7878651342d793982814a3e
2021-10-19 20:59:54 +00:00
Timo Tijhof
8a48323f46 mediawiki.util: Improve docs with updated examples from wiki page
Add some of the hardcoded examples on the [[mw:RL/DM]] wiki page here
and improve the docs a bit overall, in prep for removing those sections
in favour of the API docs link, as we do for most other modules already.

This is quite possibly the most used module, and for some reason we
never integrated it into the rest of the docs :)

Change-Id: I7f255e87e65f11cde25ce4476bb9f25e289cf16c
2021-10-19 21:20:17 +01:00
Nardog
feffc82251 Fix invisible DateTimeInputWidget clear button
mw.widgets.datetime.DateTimeInputWidget() uses the "clear" OOUI icon but
the "interactions" OOUI icon module wasn't declared as a dependency,
leading to an invisible clear button unless the module was loaded
elsewhere.

Bug: T283129
Change-Id: I5aef30a7b5f4f3286e3f5b459b675204b1233fea
2021-10-18 19:28:49 +09:00
Sam Wilson
84ef41addb Improve TitleWidget search results
Add the query value as a redlink in the result list,
as is already done if the query value is *not* a prefix
of some other (existing) title.

Bug: T291056
Change-Id: I1569ad5a57cd98fe7deb034512b46e948a3561e1
2021-10-15 09:47:48 +08:00
Fomafix
bff33f9f48 mediawiki.rcfilters.filters.ui: Simplify ItemMenuOptionWidget
* Remove unnecessary check for an empty array.
* Use .map() instead of .forEach() and .push().
* Combine .addClass() calls.
* Avoid eslint-disable-next-line mediawiki/class-doc.

Change-Id: Ia3c27ff08a5e7148af42d8e67f2ccc586227b6c6
2021-10-14 20:24:33 +00:00
jenkins-bot
b281141368 Merge "Final sync of DeleteAction and FileDeleteAction forms" 2021-10-14 06:24:48 +00:00
jenkins-bot
9730926907 Merge "Move mediawiki.ForeignUpload configuration settings to package files" 2021-10-13 23:18:28 +00:00
Daimona Eaytoy
23ec8052ce Final sync of DeleteAction and FileDeleteAction forms
Fix the last drifts between the two. Custom CSS IDs/names/classes in
FileDeleteForm were replaced with the base one, as I think it's better
to be consistent, and it wouldn't be trivial to allow changing those
values in a clean way. Question for reviewers: should this part be
announced on tech news in case somebody is using those values in a
script?

Move the file delete intro above the form, like we do for normal
deletion.

For normal deletion, use the content of the wpReason field as default
value for that field, not the result of merging the dropdown and the
"other" field, which doesn't seem correct (the file version was already
doing this).

Make the file deletion form use the title as token salt like the base
form -- it shouldn't make any difference AFAICS.

After this patch, it should be possible to make DeleteAction extend
FormAction with low effort.

Bug: T288282
Change-Id: I8b115ecb1c94af63d686a575b18362ac32105ae2
2021-10-13 13:48:24 +00:00
Daimona Eaytoy
d2419a1dda Live preview: use the correct content model
I was under the impression that live preview could only be used on
wikitext pages, but this isn't the case. So pass the proper content
model to the API.

Bug: T293022
Change-Id: Icff5b8b25a4b0df3feda2093d5b9c92e6dd9be3a
2021-10-13 15:35:10 +02:00
DannyS712
8b97d3440c RCFilters: Merge mw.rcfilters.init.js into mw.rcfilters.js
After the mediawiki.rcfilters.filters.(dm|ui) modules were merged,
mw.rcfilters.js was just `require`ing the old init script to run some
extra setup, no need for separate files.

Bug: T256836
Change-Id: I6462151152d075af0ef8bce3a5edf0a0ba48761a
2021-10-13 00:12:06 +00:00
jenkins-bot
dfd0c73975 Merge "RCFilters: Merge mediawiki.rcfilters.filters.dm into ui module" 2021-10-09 02:43:33 +00:00
DannyS712
bad94719a8 RCFilters: Merge mediawiki.rcfilters.filters.dm into ui module
The new module retains the name .ui name so that existing
skin style overrides continue to work. We can consider renaming it
to just "mediawiki.rcfilters.filters" in a future patch.

This does not handle file reorganization, since both of the
modules used package files - instead, in the main script we also
require() the old main script for the .dm module so that its
setup code runs. But, we did need to rename the virtual
config file from the .dm module to not clash with the
virtual config file from the .ui module, since the
latter uses a callback instead of retrieving configuration
variables directly. These can be merged later as well.

Bug: T256836
Change-Id: I5ec0af8b8e6bcdba6b7881f946f777b854a33739
2021-10-09 02:23:13 +00:00
jenkins-bot
0ee5a485a8 Merge "ResourceLoaderContext: Set message 'interface' flag and unique 'title'" 2021-10-08 23:49:52 +00:00
Daimona Eaytoy
bbc5bbe9ac Fix bad calculation in TitleWidget
Follow-up: Ieab0606068a78e5b5e5b9b3337f3a75a0b64adbc

This is concatenating an object and a number, so the index is always
  "[object Object]0.5"

Ops :)

Bug: T292600
Change-Id: Icf9df9a3e1fbbb08f1868131cf3fb740ee3a3e08
2021-10-08 16:34:16 +02:00
Bartosz Dziewoński
2769e5f49b ResourceLoaderContext: Set message 'interface' flag and unique 'title'
Bug: T291601
Change-Id: I6375aa97faa794caad74546ebc5e7040ead38129
2021-10-08 00:15:33 +00:00
jenkins-bot
35098e1763 Merge "Use child combinator to only apply style to gallery for new media dom" 2021-10-07 23:13:30 +00:00
jenkins-bot
af9bbfe40f Merge "mediawiki.String: Add new functions lcFirst and ucFirst" 2021-10-07 22:28:35 +00:00
Fomafix
ee640a6f57 Remove unnecessary spaces in parameters of jQuery calls
Change-Id: Ic5ce3bc2af3499a89df683c4405a52ea464238c7
2021-10-07 21:35:40 +00:00
jenkins-bot
58652c0e3d Merge "Improve side-locking logic for diffs" 2021-10-07 17:25:50 +00:00
jenkins-bot
8bd5a616e1 Merge "upload.js: Remove parameters for message 'largefileserver'" 2021-10-07 15:55:44 +00:00
Fomafix
cc62378b98 upload.js: Remove parameters for message 'largefileserver'
The message texts for 'largefileserver' don't have any parameters.

Also apply https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Creating_elements

Change-Id: Ic86a35067694c5624353918024275e11f9734fa1
2021-10-07 12:40:53 +00:00
Fomafix
f3d33f78fc mediawiki.action.edit.preview: Avoid double escaping of message 'preview'
Change-Id: I0affb120f75cdecdaeb06029118340bc8640db16
2021-10-07 11:20:16 +00:00
Fomafix
e03f565694 Use shortcut mw.msg( ... ) instead of mw.message( ... ).text()
Change-Id: Ide51c960717676adc117823096bfc353e3a6539f
2021-10-07 10:18:20 +00:00
jenkins-bot
6a55ce812e Merge "Correctly use sort index for redirects in TitleWidget" 2021-10-07 00:23:50 +00:00
jenkins-bot
076513776e Merge "jquery.spinner: Fix rendering in RTL interface languages" 2021-10-07 00:01:43 +00:00
jenkins-bot
1bf404e804 Merge "Fix diff align for mixed lang content" 2021-10-06 23:24:20 +00:00
Bartosz Dziewoński
7498be2299 jquery.spinner: Fix rendering in RTL interface languages
Bug: T292673
Change-Id: I14473c2dd7efeaed2179fe2cdaeb29a47071ffe7
2021-10-06 22:41:38 +02:00
James D. Forrester
b4efcdf49a Drop $j alias for $, deprecated since 1.23
Bug: T280944
Change-Id: Ifb41d35d0d08b3c0631040b2f52d856de51adc67
2021-10-06 08:43:40 -07:00
DannyS712
4f1c4618d9 Move mediawiki.ForeignUpload configuration settings to package files
Inject `wgForeignUploadTargets` and `wgEnableUploads` via a
virtual file instead of always adding them to mw.config.

Added a comment about them in the release notes since wgEnableUploads
was used by an (undeployed) extension, but we can make the
breaking change because their inclusion was marked as
@internal.

Bug: T292017
Change-Id: Ib1635b1864963c6c03c4a80e15048a898b8eaf90
2021-10-06 15:28:37 +00:00
Sam Wilson
df3c0d0389 Correctly use sort index for redirects in TitleWidget
The 'index' value for redirects where the target doesn't exist was
not being used.

Bug: T292600
Change-Id: Ieab0606068a78e5b5e5b9b3337f3a75a0b64adbc
2021-10-06 11:07:22 +08:00
jenkins-bot
05d4865d76 Merge "Drop jQuery migrate" 2021-10-06 00:15:36 +00:00
jenkins-bot
e7f4484611 Merge "Make first char of username in ApiQueryAllUsers case-insensitive" 2021-10-05 20:57:54 +00:00
DannyS712
81d7e119bf Remove unused jquery.mw-jump module
Bug: T291720
Follow-up: I84bcd23180b3d1fa541728989f44a376189df95d
Change-Id: I6729822190565b0aa9179ff4a7818f66b9ec3abf
2021-10-05 18:48:33 +00:00
Arlo Breault
5c448e2fd7 Use child combinator to only apply style to gallery for new media dom
Previously, .thumb wouldn't be a direct descendant of .gallerybox
because of the explicit div for padding.  We don't want this rule to
apply to the legacy media dom so use that knowledge as a differentiator.

Follow up to Iff2bdc3aa02f84f0bf4ca55d177706823934cc08

Change-Id: I5ad9bf1913ece4a167fd642b536143695e34d00f
2021-10-05 12:14:06 -04:00