Closed ca-d closed 1 year ago
@ca-d how did you found this bug?
@ca-d how did you found this bug?
This fix was basically needed for the scenario where open-scd.js
is imported from a different place than the distribution, which is the case in the current open-scd/next
"live" distribution which uses
import 'https://openscd.github.io/open-scd-core/open-scd.js';
in one of its script tags. In this scenario, when we import plugins with relative URLs like in the case of plugins included in a distribution, we want all "path only" plugin src URLs to resolve relative to the distribution's URL, not relative to the URL of whatever server and path I happened to load open-scd.js
from. In our "live" distribution example, we want the AddPlugins.js
plugin to be loaded from the openscd.github.io/open-scd/
directory rather than from the openscd.github.io/open-scd-core/
directory.
In my view, a regression test for this would ideally go into a distribution that hosts some local plugin.
Now I got it, thank you :)
Resolve
src
URLs for plugins relative towindow.location.host
to make the editor work as expected when a bundledopen-scd.js
is imported from a remote host.