feat(core): add config var 'wgCitizenTableNowrapClasses' (#621)

* add config var 'wgCitizenTableNowrapClasses'
* refactor: load config via require
This commit is contained in:
Simon Stier 2023-05-18 19:53:58 +02:00 committed by GitHub
parent 0fb2738d96
commit a7b99d11f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 10 deletions

View file

@ -112,6 +112,7 @@ Name | Description | Values | Default
`$wgCitizenThemeColor` | The color defined in the `theme-color` meta tag | Hex color code | `#131a21`
`$wgCitizenEnableCJKFonts` | Enable included Noto Sans CJK for wikis that serves CJK languages | `true` - enable; `false` - disable | `false`
`$wgCitizenEnablePreferences` | Enable the preferences menu | `true` - enable; `false` - disable | `true`
`$wgCitizenTableNowrapClasses` | Defines table css classes ignored by citizen table wrapper | List of css classes. Extend with `$wgCitizenTableNowrapClasses[] = 'my_class';` | `["citizen-table-nowrap", "mw-changeslist-line", "infobox", "cargoDynamicTable", "dataTable"]`
### Search suggestions
Name | Description | Values | Default

View file

@ -47,6 +47,7 @@ class ResourceLoaderHooks {
return [
'wgCitizenEnablePreferences' => $config->get( 'CitizenEnablePreferences' ),
'wgCitizenSearchModule' => $config->get( 'CitizenSearchModule' ),
'wgCitizenTableNowrapClasses' => $config->get( 'CitizenTableNowrapClasses' ),
];
}

View file

@ -1,3 +1,5 @@
const config = require( './config.json' );
/**
* Set up scroll affordance for an overflowed element
* TODO: Move this out of tables when this is used by more stuff
@ -60,16 +62,8 @@ function setupOverflowState( element ) {
* @return {void}
*/
function wrapTable( table ) {
// TODO: Make this a config flag
const ignoredClasses = [
'citizen-table-nowrap',
'mw-changeslist-line',
'infobox',
// Extension:Cargo
// dataTable from Extension:Cargo and some other has issue with the wrapper
'cargoDynamicTable',
'dataTable'
];
// Load ignored classes from config
const ignoredClasses = config.wgCitizenTableNowrapClasses;
// Check table and parent for ignored classes
const hasIgnoredClass = ( ignoreClass ) => {

View file

@ -604,6 +604,18 @@
"description": "Enables or disable preferences module",
"descriptionmsg": "citizen-config-enablepreferences",
"public": true
},
"TableNowrapClasses": {
"value": [
"citizen-table-nowrap",
"mw-changeslist-line",
"infobox",
"cargoDynamicTable",
"dataTable"
],
"description": "Defines table css classes ignored by citizen table wrapper",
"descriptionmsg": "citizen-config-tablenowrapclasses",
"public": true
}
},
"manifest_version": 2