Overriding Nuxeo WebUI elements

Hello,

I'm wondering if I'm missing some info on how to override existing Web UI elements via Nuxeo Studio. After reading https://doc.nuxeo.com/910/nxdoc/web-ui-deployment/ I tried overriding some Web UI components.

For example I tried to override the nuxeo-document-create-popup element (https://github.com/nuxeo/nuxeo-web-ui/blob/release-9.10-HF01/elements/nuxeo-document-create-popup/nuxeo-document-create-popup.html)

I've defined an XML extension as follows:

<require>org.nuxeo.web.ui.resources</require>
<extension target="org.nuxeo.ecm.platform.WebResources" point="resources">
    <resource name="nuxeo-document-create-popup.html" type="import" shrinkable="false">
        <uri>ui/elements/nuxeo-document-create-popup/nuxeo-document-create-popup.html</uri>
    </resource>
</extension>
<extension target="org.nuxeo.ecm.platform.WebResources" point="bundles">
    <bundle name="web-ui">
        <resources append="true">
            <resource>nuxeo-document-create-popup.html</resource>
        </resources>
    </bundle>
</extension>

And put my customized html in UI/elements/nuxeo-document-create-popup/nuxeo-doucment-create-popup.html :

type an image title

When I am deploying my bundle, there are two problems:

1) If I remove the Polymer script from my custom HTML - the changes of HTML template are not taken into account, which was not the case on Nuxeo 8.10 - we were able to override only the HTML template part of the Web UI element.

2) If I do not remove the Polymer script from the element, the customized element won't be loaded because the native WebUI element with the same ID is already registered. We can observe the following error:

Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry

which is rather logical. What I do not understand - we have a similar extension for nuxeo-browser.html file, in which we forgot to remove the Polymer code, but the extension works perfectly, so now I am confused.

Any suggestions on what did we do wrong ?

1 votes

1 answers

3359 views

ANSWER

a c
Bump this question
11/12/2019



nuxeo-document-create-popup is defined in the nuxeo-app.html file on your deployed server (it's a minified version of all the elements). If you need to override a single element in this file you need to override the whole 80000 LOC file (that's the answer I got from the Nuxeo team).

1 votes