Details
Description
When implementing an OpenUI document field extension [1], our internal product or solution module might want to configure an internal, relative URLs such as angular/starterstore-frontend-ng/assets/product-field-view.html or angular/universal-pixel-integration/new-picker/index.html.
However, the relative path doesn't seem to work in the current version (v13.3.0). So, you have to set either an absolute URL (e.g, http://localhost:8080/cms/angular/starterstore-frontend-ng/assets/product-field-view.html) or a relative path with the context path, that is, /cms/angular/starterstore-frontend-ng/assets/product-field-view.html.
This makes it harder to make the deployment because the context path is environment specific - '/cms' in dev mode, '' in production, etc.
Therefore, it would be nice to allow to set it to a relative path without context path for this kind of internal modules. e.g, angular/starterstore-frontend-ng/assets/product-field-view.html.
By the way, I took a quick glance to the source at editor/frontend/src/main/java/org/hippoecm/frontend/editor/plugins/openui/OpenUiBehavior.js, which has two variables: this.cmsOrigin (e.g, http://localhost:8080/) and this.cmsBaseUrl (e.g, http://localhost:8080/cms/). But when it determines the IFrame URL for the OpenUI field extension, it uses the former one like this:
// ... _getIframeUrl(extensionUrl, extensionDialogUrl) { extensionUrl = this._getExtensionUrl(extensionUrl, this.cmsOrigin); return extensionDialogUrl ? this._getExtensionUrl(extensionDialogUrl, extensionUrl.href) : extensionUrl; } // ... _getExtensionUrl(url, base) { const absUrl = new URL(url, base); this._addQueryParameters(absUrl); return absUrl; } // ...
, where the base is the same as this.cms.Origin.
It could have used the latter, this.cmsBaseUrl for this kind of use cases.
[1] https://documentation.bloomreach.com/library/concepts/open-ui/open-ui-document-field-extensions.html