Skip to content

Commit 0c1b1d4

Browse files
committed
Do not load ol.css via React, but as a regular stylesheet (WordPress style)
1 parent 433ab78 commit 0c1b1d4

9 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ jobs:
2727
NODE_OPTIONS: --openssl-legacy-provider
2828
run: npm run webpack-prod
2929
- name: Build CSS
30-
run: npm run css-prod
30+
run: |
31+
npm run css-prod
32+
npm run css-ol

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
# Fix for ERR_OSSL_EVP_UNSUPPORTED error caused by Webpack
2424
NODE_OPTIONS: --openssl-legacy-provider
2525
run: |
26+
npm run css-ol
2627
npm run css-prod
2728
npm run webpack-prod
2829
- name: Cache Composer packages

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
- Bugfix: Compatibel met WordPress 6.9. Sinds WordPress 6.9 worden stylesheets die tijdens contentgeneratie worden ingeladen alsnog in `<head>` geplaatst. Hierdoor worden stylesheets die door WordPress worden geladen altijd vóór het algemene OpenLayers stylesheet ingeladen, waardoor er een specificity probleem ontstaat. Dit is opgelost door niet langer meer `ol.css` via React in te laden, maar door deze als aparte stylesheet beschikbaar te stellen (`gh-dim-ol-style`). Zie ook `wp_should_output_buffer_template_for_enhancement` om het oude gedrag van WordPress weer in te schakelen (maar is voor deze versie dus niet meer nodig).
2+
13
**1.12.1 (2025-07-30)**
24

35
- Bugfix: Sinds OpenLayers 10 kon het navigeren naar een adres, gevonden met de zoekfunctie, de kaart doen vastlopen en liep het geheugenverbruik van de browser vol waardoor de pagina niet reageerde en uiteindelijk crashte. Dit probleem is opgelost.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ A (Dutch) changelog is being kept at `CHANGELOG.MD`
1515

1616
````
1717
$ npm install
18+
$ npm run css-ol
1819
$ npm run css-prod
1920
$ npm run webpack-prod
2021
$ npm run composer

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8+
"css-ol": "npx sass --style=compressed node_modules/ol/ol.css plugins/gh-datainmap/dist/ol.css",
89
"css-prod": "npx sass --style=compressed src/scss/style.scss plugins/gh-datainmap/dist/style.css",
910
"css-dev": "npx sass --watch src/scss/style.scss plugins/gh-datainmap/dist/style.css",
1011
"webpack-prod": "npx webpack --mode=production",

plugins/gh-datainmap/gh-datainmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function gh_dim_register_scripts() {
6464
wp_register_script( 'gh-dim-locationpicker', plugin_dir_url(GH_DIM_FILE) . 'dist/admin-locationpicker.js' , array('gh-dim-vendors'), GH_DIM_VERSION, true );
6565
wp_register_script( 'gh-dim-location', plugin_dir_url(GH_DIM_FILE) . 'dist/admin-location.js' , array('gh-dim-vendors', 'gh-dim-colorpicker-vendor'), GH_DIM_VERSION, true );
6666
wp_register_style( 'gh-dim-style', plugin_dir_url(GH_DIM_FILE) . 'dist/style.css', array(), GH_DIM_VERSION);
67+
wp_register_style( 'gh-dim-ol-style', plugin_dir_url(GH_DIM_FILE) . 'dist/ol.css', array(), GH_DIM_VERSION);
6768
// Vendor
6869
wp_register_script( 'gh-dim-colorpicker-vendor', plugin_dir_url(GH_DIM_FILE) . 'vendor/wp-color-picker-alpha/dist/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), GH_DIM_VERSION, true );
6970
}

plugins/gh-datainmap/includes/shortcode.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ function($a) {
161161
if($settings['include_default_style']) {
162162
wp_enqueue_style( 'gh-dim-style' );
163163
}
164+
else {
165+
wp_enqueue_style( 'gh-dim-ol-style' );
166+
}
164167

165168
wp_enqueue_script( 'gh-dim-datainmap' );
166169
$security = wp_create_nonce('gh-dim-datainmap');

src/components/map.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Licence for the specific language governing permissions and limitations under the Licence.
1313
*/
14-
import 'ol/ol.css';
1514
import Map from 'ol/Map';
1615
import View from 'ol/View';
1716
import { defaults as defaultInteractions } from 'ol/interaction';

src/scss/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$font-size-base: 14px;
2+
@import '../../node_modules/ol/ol';
23
@import './mixins/mixins';
34
@import './modules/modules';
45
@import './transitions';

0 commit comments

Comments
 (0)