Commit graph

1725 commits

Author SHA1 Message Date
MusikAnimal
8780b503f6 Refactor preview frontend logic into JavaScript API
This moves the preview logic that was part of
mediawiki.action.edit.preview.js into a dedicated module with a JS
entrypoint so it can be used by other systems such as the upcoming
Real Time Preview.

Bug: T294319
Change-Id: Ifbd57a74375c556bf09d5eee40c2d6396062d1a0
2022-03-09 13:43:47 -05:00
daniel
cf581bb2ca Define MW_INSTALL_PATH constant and BaseDirectory config.
Application logic should use the BaseDirectory config variable.
Framework code should use MW_INSTALL_PATH to locate files should.

NOTE: Update https://www.mediawiki.org/wiki/Manual:$IP

Bug: T300301
Depends-On: I7142af16d692f26e90673b058029f572c1ea3991
Change-Id: Ib4caa80bb7007c4c7960a2fd370cf5da7d9ba344
2022-03-04 14:18:27 +01:00
jenkins-bot
b51d0a16cd Merge "web2017-polyfills: Add WHATWG URL polyfill" 2022-03-01 23:14:48 +00:00
jenkins-bot
47b2981702 Merge "mediawiki.action.styles: Move file out of mediawiki.action/ folder" 2022-02-21 16:23:50 +00:00
jenkins-bot
a953d231d8 Merge "ApiSandbox: Fix case and styling of param flags" 2022-02-21 16:21:30 +00:00
Timo Tijhof
a3063ab3f3 mediawiki.action.styles: Move file out of mediawiki.action/ folder
Bug: T193826
Bug: T278504
Change-Id: Id81b051d6dfa0c195aa4b96d711c62525fdd5017
2022-02-21 13:39:06 +00:00
Ed Sanders
fc3624562e ApiSandbox: Fix case and styling of param flags
* Use lower case without a full stop
* Use standard muted colour for secondary information. The
  red warning colour is still used on the param page itself.

Change-Id: I734a2f31f9139b8415bd61dcbe0561232e2632ee
2022-02-21 12:50:53 +00:00
Roan Kattouw
81e2687fa9 resourceloader: Rename 'codex' to '@wikimedia/codex'
This way code like require( '@wikimedia/codex' ) will work both in
ResourceLoader and in Node.js (needed for local development setups and
unit tests).

Not adding a backwards compatibility alias for 'codex' because nothing
uses this module yet.

Bug: T299148
Change-Id: I50c62397ce61bdda66cdf39506baf19a225eec9c
2022-02-18 15:28:12 -08:00
Ed Sanders
236624509d mw.postEdit: Use mw.notify to display message
Further unifies our message displaying system.

The 'postEdit.afterRemoval' hook is deprecated as it is of little
value, makes less sense when we aren't sure when the notification
will close, and is rarely used.

Bug: T58313
Change-Id: Iec031de7aa8c09091b811530a45758b53638372f
2022-02-16 21:34:09 +00:00
Timo Tijhof
582ebce4d5 web2017-polyfills: Add WHATWG URL polyfill
Sourced from <https://github.com/Financial-Times/polyfill-library>.

Bug: T103379
Change-Id: Ia524d9d5ed884296007dae1caf9599c0c0b45c47
2022-02-16 17:22:49 +00:00
jenkins-bot
cc4a95cc78 Merge "Introduce "web2017-polyfills" module" 2022-02-16 15:19:19 +00:00
James D. Forrester
c4a2018e66 Follow-up d84a3ecbed: Also add Codex to mobile target
Bug: T299148
Change-Id: Iac1053ef19337699e5f092b12d5d9d0393847bb1
2022-02-15 14:36:04 -05:00
Roan Kattouw
d84a3ecbed Add Codex v0.1.0-alpha.2
Bug: T299148
Change-Id: I414698b1c8251a5e873a2b6385b61051f32f54c0
2022-02-14 19:59:53 -08:00
Eric Gardner
a04f25a92a Introduce "web2017-polyfills" module
Creates a new RL module for polyfilling modern Web APIs (as opposed
to modern syntax support / language features).

Moves the recently-created Intersection Observer polyfill module into
a new module, "web2017-polyfills". The fetch polyfill has been retained
as a temporary alias, and can soon be removed in favor of the new
web-2017 module.

Bug: T301489
Change-Id: Ic8a7f4f892722b77252ad6db45c73598833a8c65
2022-02-14 08:27:03 -08:00
jenkins-bot
6fe77549d7 Merge "apisandbox: Mark internal and deprecated modules more prominently" 2022-02-08 20:00:03 +00:00
Sébastien Beyou
1f50a0d75a mediawiki.page.gallery: Replace use of deprecated $.debounce()
Bug: T213426
Change-Id: Ic8a5a6bf6178f7c3c7bdc9980dbd98d1a52f6504
2022-02-08 00:56:50 +00:00
Bartosz Dziewoński
528b739e3a apisandbox: Mark internal and deprecated modules more prominently
Previously they were only marked as such in the detailed descriptions
hidden behind the [Expand] buttons, which no one clicks. (Deprecated
modules were also marked with a line-through in the dropdown list.)

Now they're also marked in the dropdown lists (which you have to
click) and in the descriptions (which you have to see).

Change-Id: Id19f0804c6b2ddf8d507561b5dfa69b15f7fd90f
2022-02-07 22:54:29 +00:00
Eric Gardner
cccfd1190f Add the W3C Intersection Observer to ResourceLoader
Adds the latest version of the W3C Intersection Observer polyfill from
NPM for usage within MediaWiki.

https://www.npmjs.com/package/intersection-observer

Bug: T300912
Change-Id: Ie11d06e977012fb5c3b0b1b6e7c7d3458bf0e409
2022-02-03 14:21:24 -08:00
jenkins-bot
d010074789 Merge "DateTimeInputWidget: Fix field widths" 2022-01-20 20:55:02 +00:00
Bartosz Dziewoński
df69919779 DateTimeInputWidget: Fix field widths
The fields were using `box-sizing: border-box`, which meant that our
carefully calculated width was reduced by the browser-defined padding,
which caused the expected number of digits not to fit.

Also:
* Fix width calculations for digits to not apply the Internet Explorer
  hack to other browsers.
* Fix width calculations for non-digits to make them slightly larger
  (both the `if` and `else` branches were identical in 2 places out of
  3, that was probably a copy-paste mistake).

Bug: T299618
Change-Id: I3aa15ba8ed2380d34051a27daaa4946c8abdf7c6
2022-01-20 02:25:13 +01:00
Siddharth VP
1fa10ef036 resourceloader: Use named constants for groups
Makes the code easier to follow, in particular to identify functionality of the various groups.

Change-Id: Ib2dae5757e9325f9706ff2a9f760f311475fe615
2022-01-19 21:21:00 +00:00
Roan Kattouw
569ba6e2b5 Upgrade Vuex to 4.0.2
Provide backward compatibility in Vue.createMwApp() for the store
option. Vuex 4 expects Vue.createMwApp(...).use(store), but code written
for Vuex 3 will do Vue.createMwApp({..., store: store }) instead.

Unfortunately, it doesn't appear to  be possible to provide backward
compatibiltiy for new Vue( { ..., store: store } ) . I can't find a way
to access the underlying app instance.

Bug: T289102
Change-Id: I21641827780f4a7d8a5196c7dab14fbc3e4f4175
2022-01-18 22:26:29 +00:00
jdlrobson
be86676347 ChangesList: Add .mw-changeslist-time (no date) to output to each row
Bug: T298639
Change-Id: I0cba011f0ab8cb8fd59962b5eafb7650deefe841
2022-01-10 23:19:40 +00:00
jdlrobson
2759159e25 Deprecate mediawiki.pager.tablePager module for more generic module
All pagers sthould share `mediawiki.pager.styles` module

Bug: T298636
Change-Id: Idb0c7017407cee5c6b625d39c12219d6ddc9e2db
2022-01-07 08:26:52 -08:00
Ed Sanders
37513f796b ApiSandbox: Show request data as PHP array
Change-Id: I11aa6037fcc92fd4c1b589f43996b7b2a5b49801
2021-12-22 23:32:56 +00:00
Func
8a6aafc507 Use native method to disable new users checkbox in Special:Preferences
Bug: T272302
Change-Id: I51cf864f27e624c68a0756f09873b115b5608c04
2021-12-13 22:51:34 +00:00
jenkins-bot
5a46f9c44d Merge "Add support for conditional disable fields in HTMLForm" 2021-12-13 22:50:53 +00:00
Func
361954801e Add support for conditional disable fields in HTMLForm
Provide a native method to disable fields in particular condition.

Bug: T272302
Change-Id: I8f46dedc2945cf3b7ef5419b0a54534ded8b6d5b
2021-12-11 01:39:42 +00:00
jenkins-bot
6b6254a646 Merge "Add content-media print styles" 2021-12-09 18:03:43 +00:00
Arlo Breault
28062181f9 Add content-media print styles
* Magnify clip isn't present in print styling
* Print and screen thumbborder are different
* Print thumbinner and thumbimage borders are absent

Bug: T287965
Change-Id: Ie1dac57412da7da3e73eb39ef20a6077923860d6
2021-12-09 11:42:05 -05:00
Roan Kattouw
5bd107c968 Upgrade Vue to the migration build of Vue 3
* Upgrade Vue to @vue/compat version 3.2.23
* Migrate Vue.createMwApp to Vue 3 API
* Add backwards-compatible wrapper emulating Vue 2 behavior for
  new Vue( { el: '#foo', ... } ) and
  new Vue( ... ).$mount( '#foo' )
* Make @vue/composition-api an alias for vue, for b/c
* Convert resources/src/vue/ to ES6
* Ignore resource/src/vue/ for jsduck, since it doesn't support ES6
* VueComponentParser: Remove check for only one root node

Bug: T251974
Co-Authored-By: Lucas Werkmeister <lucas.werkmeister@wikimedia.de>
Depends-On: Ica0c0d0d6247383796d39199e50a9aff917f5b53
Change-Id: Ibd618765f962f57984994604c61b1aff9e6a778d
2021-12-07 19:31:43 +00:00
James D. Forrester
52b0da1ffe resources: Drop jquery.jStorage, deprecated since MW 1.28 and now unused
Deprecated in 9e712c which shipped in MW 1.28.0. The last production use,
from the Collection extension, was removed in f3f4bb4; no non-production
use show in codesearch (except for a copy of the Collection extension).

Bug: T143034
Change-Id: I14cc197be5abcec41cd0905a85236abefc188a66
2021-12-02 13:55:14 -05:00
Volker E
2b35fa4fa1 Update WVUI to v0.3.3
Release notes: https://gerrit.wikimedia.org/r/plugins/gitiles/wvui/+/refs/tags/v0.3.3/CHANGELOG.md#v0_3_3-2021_11_19

Bug: T279674
Bug: T284707
Change-Id: I220016fc07c8265545a7398aa1c45ab52384b57a
2021-11-19 21:38:46 -08:00
jenkins-bot
6dc1855226 Merge "vue: Rename vue-composition-api module to @vue/composition-api" 2021-11-19 05:14:37 +00:00
Timo Tijhof
6f061f4db2 resourceloader: Bundle user.defaults as part of mediawiki.base
== Background ==

The `user.options` module is private, and thus has to be embedded in
the page HTML. This data is quite large. For example, on enwiki the
finalized mw.user.options object is about 3KB serialized/compressed
(7KB uncompressed).

The `user.defaults` module is an implementation detail of
`user.options`, and was created to accomplish mainly two things:

* Save significant data transfers by allowing it to be cached
  client-side without being part of the article.
* Ensure consistency between articles and allow faster deployment of
  changes, by not being part of the cacheable article HTML.

All our pageviews already load `user.defaults`, as a dependency of
the popular `mediawiki.api` and `mediawiki.user` modules. These are
used by `mediawiki.page.ready` (queued on all pages), and on Wikipedia
these are also loaded on all pages by ULS, VisualEditor, EventLogging,
and more.

As such, in practice, bundling "user.defaults" with "mediawiki.base"
will not cause the data to be loaded more often than before.

== What ==

* Add virtual "user.json" package file with the same data that
  was previously exported by ResourceLoaderUserDefaultsModule,
  and pass it to mw.user.options.set() from base module's entry point.

  An alternative way would be to use a "user.js" file, which would
  return a generated "mw.user.options.set()" expression. I went
  for exporting it as JSON for improved maintainability (reducing
  the amount of JS code written in PHP), and because it performs
  slightly better. The JS file would implicitly come with a file
  closure (tiny bit more bytes), and would then be lazy executed
  (tiny bit more time).

  The chosen approach allows the browser to compile the JSON
  off-the-main-thread ahead of time while the module response downloads.
  Then when the module executes, we can reference the JSON object
  and use it directly.

* Update internal dependency from `user.options`.

* Remove `user.defaults` module without deprecation. It is an internal
  module with no direct use anywhere in Git (Codeseach), and no use
  anywhere on-wiki (Global Search).

Change-Id: Id3916f94f75078808951863dea2b3a9c71b0e30c
2021-11-18 04:41:09 +00:00
Roan Kattouw
be9c2612b8 vue: Rename vue-composition-api module to @vue/composition-api
This way the RL module name matches the NPM module name, and code from
NPM that expects to be able to call require( '@vue/composition-api' )
will work.

Backwards compatibility is not needed because codesearch shows zero
instances of this module being used. Its only usage is in a patch in
MediaSearch that hasn't been merged yet.

Bug: T284707
Change-Id: I457dd97f00d3cbf1edb57cf61cf80afd57a1e2a7
2021-11-16 15:36:34 -08:00
Timo Tijhof
a0237b87b1 mediawiki.ui: Organize files by module bundle
Some files are their own module bundle, and some not.

Bug: T193826
Change-Id: I3c3aba0c4c7078173c81102007bb06a9eb3a94a6
2021-11-15 04:10:54 +00:00
Roan Kattouw
10fae048df Add Vue composition API plugin
Feature code that needs the composition API will need this as long as
we're still on Vue 2. This will also help migrate to Vue 3 more
seamlessly, as working around some breaking changes in Vue 3 requires
using the composition API.

Bug: T251974
Change-Id: I8e334ae5f447a8f9b64a7c910b2c1776cef118db
2021-11-03 23:15:57 +00:00
Fomafix
0071df8981 EditPage: Only update title part of firstHeading on live preview
The message wgEditMessage can contain code for the extension
ParserFunctions which is not supported by mediawiki.jqueryMsg.

This change updates only the title in the firstHeading instead of
creating the whole message including the title again. The title gets
identified by a new HTML element with id="firstHeadingTitle".

The title in the HTML title gets not updated anymore. For a preview of
the display title the title in the firstHeading should be enough.

The 6 messages
'creating',
'editconflict',
'editing',
'editingcomment',
'editingsection',
'pagetitle'
are not needed anymore in JavaScript and removed from the module.

The global JavaScript variable 'wgEditMessage' is not needed anymore in
the live preview module. Other user scripts uses this variable and
therefor this variable is kept for compatibility.

Bug: T105214
Change-Id: I8d8dc79c6bf1a94a55f1d0f6b5611ca478fd9e18
2021-10-24 20:52:49 +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
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
jenkins-bot
9730926907 Merge "Move mediawiki.ForeignUpload configuration settings to package files" 2021-10-13 23:18:28 +00: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
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
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
jenkins-bot
05d4865d76 Merge "Drop jQuery migrate" 2021-10-06 00:15:36 +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
Amir Sarabadani
388f098bdd Drop jQuery migrate
Bug: T280944
Change-Id: I3c87b3ef925f942489720fabc6aea2433ca2d1be
2021-09-30 18:29:05 +02:00