Merge pull request #19687 from liviuconcioiu/19685

Fixes #19685 - Prevent ol.css being added multiple times
This commit is contained in:
Maurício Meneghini Fauth 2025-05-05 16:33:54 -03:00 committed by GitHub
commit 70fee214cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -434,7 +434,13 @@ class GisVisualization
$output = 'function drawOpenLayers() {'
. 'if (typeof ol !== "undefined") {'
. 'var olCss = "js/vendor/openlayers/theme/ol.css";'
. '$(\'head\').append(\'<link rel="stylesheet" type="text/css" href=\'+olCss+\'>\');'
. 'if (!document.querySelector(\'link[rel="stylesheet"][href="\' + olCss + \'"]\')) {'
. 'var link = document.createElement(\'link\');'
. 'link.rel = \'stylesheet\';'
. 'link.type = \'text/css\';'
. 'link.href = olCss;'
. 'document.head.appendChild(link);'
. '}'
. 'var vectorLayer = new ol.source.Vector({});'
. 'var map = new ol.Map({'
. 'target: \'openlayersmap\','