diff --git a/README.md b/README.md index 9362bc1b..6576d19a 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ Name | Description | Values | Default `$wgCitizenEnableARFonts` | Enable included Noto Naskh Arabic for wikis that serve Arabic | `true` - enable; `false` - disable | `false` `$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", "diff", "mw-changeslist-line", "mw-recentchanges-table", "infobox", "cargoDynamicTable", "dataTable", "srf-datatable", "smw-datatable", "mw-capiunto-infobox" ]` +`$wgCitizenOverflowNowrapClasses` | Defines css classes ignored by the overflow wrapper | List of css classes. Extend with `$wgCitizenOverflowNowrapClasses[] = 'my_class';` | `["citizen-table-nowrap", "diff", "mw-changeslist-line", "mw-recentchanges-table", "infobox", "cargoDynamicTable", "dataTable", "srf-datatable", "smw-datatable", "mw-capiunto-infobox" ]` ### Search suggestions Name | Description | Values | Default diff --git a/includes/Hooks/ResourceLoaderHooks.php b/includes/Hooks/ResourceLoaderHooks.php index 1c9ad6e3..0a70b57c 100644 --- a/includes/Hooks/ResourceLoaderHooks.php +++ b/includes/Hooks/ResourceLoaderHooks.php @@ -47,8 +47,8 @@ class ResourceLoaderHooks { ) { return [ 'wgCitizenEnablePreferences' => $config->get( 'CitizenEnablePreferences' ), - 'wgCitizenSearchModule' => $config->get( 'CitizenSearchModule' ), - 'wgCitizenTableNowrapClasses' => $config->get( 'CitizenTableNowrapClasses' ), + 'wgCitizenOverflowNowrapClasses' => $config->get( 'CitizenOverflowNowrapClasses' ), + 'wgCitizenSearchModule' => $config->get( 'CitizenSearchModule' ) ]; } diff --git a/resources/skins.citizen.scripts/overflowElements.js b/resources/skins.citizen.scripts/overflowElements.js index f4392cbe..622e492c 100644 --- a/resources/skins.citizen.scripts/overflowElements.js +++ b/resources/skins.citizen.scripts/overflowElements.js @@ -78,8 +78,8 @@ class OverflowElement { /** * Wraps the element in a div container with the class 'citizen-table-wrapper'. * Checks if the element or its parent node is null or undefined, logs an error if so. - * Verifies the existence of $wgCitizenTableNowrapClasses in the config and if it is an array, logs an error if not. - * Skips wrapping if the element contains any of the ignored classes specified in $wgCitizenTableNowrapClasses. + * Verifies the existence of $wgCitizenOverflowNowrapClasses in the config and if it is an array, logs an error if not. + * Skips wrapping if the element contains any of the ignored classes specified in $wgCitizenOverflowNowrapClasses. * Creates a wrapper div element, adds the class 'citizen-table-wrapper' to it. * Filters and adds inherited classes ('floatleft', 'floatright') from the element to the wrapper. * Inserts the wrapper before the element in the DOM and appends the element to the wrapper. @@ -95,16 +95,16 @@ class OverflowElement { } try { if ( - !config.wgCitizenTableNowrapClasses || - !Array.isArray( config.wgCitizenTableNowrapClasses ) + !config.wgCitizenOverflowNowrapClasses || + !Array.isArray( config.wgCitizenOverflowNowrapClasses ) ) { - mw.log.error( '[Citizen] Invalid or missing $wgCitizenTableNowrapClasses. Cannot proceed with wrapping table.' ); + mw.log.error( '[Citizen] Invalid or missing $wgCitizenOverflowNowrapClasses. Cannot proceed with wrapping table.' ); return; } const parentNode = this.element.parentNode; - const ignoredClasses = config.wgCitizenTableNowrapClasses; + const ignoredClasses = config.wgCitizenOverflowNowrapClasses; if ( ignoredClasses.some( ( cls ) => this.element.classList.contains( cls ) ) ) { return; diff --git a/tests/phpunit/integration/Hooks/ResourceLoaderHooksTest.php b/tests/phpunit/integration/Hooks/ResourceLoaderHooksTest.php index f0e10dbf..cfb0350b 100644 --- a/tests/phpunit/integration/Hooks/ResourceLoaderHooksTest.php +++ b/tests/phpunit/integration/Hooks/ResourceLoaderHooksTest.php @@ -19,8 +19,8 @@ class ResourceLoaderHooksTest extends MediaWikiIntegrationTestCase { public function testCitizenResourceLoaderConfig() { $this->overrideConfigValues( [ 'CitizenEnablePreferences' => false, + 'CitizenOverflowNowrapClasses' => false, 'CitizenSearchModule' => false, - 'CitizenTableNowrapClasses' => false, ] ); $rlCtxMock = $this->getMockBuilder( Context::class )->disableOriginalConstructor()->getMock(); @@ -33,7 +33,7 @@ class ResourceLoaderHooksTest extends MediaWikiIntegrationTestCase { $this->assertArraySubmapSame( [ 'wgCitizenEnablePreferences' => false, 'wgCitizenSearchModule' => false, - 'wgCitizenTableNowrapClasses' => false, + 'wgCitizenOverflowNowrapClasses' => false, ], $config ); } @@ -44,8 +44,8 @@ class ResourceLoaderHooksTest extends MediaWikiIntegrationTestCase { public function testCitizenResourceLoaderConfigAllTrue() { $this->overrideConfigValues( [ 'CitizenEnablePreferences' => true, + 'CitizenOverflowNowrapClasses' => true, 'CitizenSearchModule' => true, - 'CitizenTableNowrapClasses' => true, ] ); $rlCtxMock = $this->getMockBuilder( Context::class )->disableOriginalConstructor()->getMock(); @@ -57,8 +57,8 @@ class ResourceLoaderHooksTest extends MediaWikiIntegrationTestCase { $this->assertArraySubmapSame( [ 'wgCitizenEnablePreferences' => true, + 'wgCitizenOverflowNowrapClasses' => true, 'wgCitizenSearchModule' => true, - 'wgCitizenTableNowrapClasses' => true, ], $config ); }