12-19-2019 12:44 PM
Hello community
I need to change the way the <nuxeo-user-avatar>
returns the user's initials, which is a simple javascript function.
The problem is, I would need to override all the references in other components throughout the application as well, like the <nuxeo-user-tag>
component, or the <nuxeo-user-group-formatter>
, which would also have to be overriden and have their references changed in the nuxeo-app.html
file or the elements.html
file, and so on.
It snowballs to a bunch of other components which I'd also have to override just for a simple function!
Since web components cannot be redefined or unregistered, is there any better way to change the behavior of a component without having to override all the other components that use it? How can I keep using the same component and only change the logic I need? Or how to tell the component to use a different function with my custom logic at runtime?
EDIT This is the xml contribution file I would use to override the component:
01-05-2020 04:04 AM
There is no way to do it today (at least not until we have import maps support). This can’t be supported as we might need to break the API and we can’t ensure your override implements the API we need. Solutions to address this that we’d like to propose once we can do so:
12-19-2019 03:31 PM
Have you tried to duplicate the source code of the element (https://github.com/nuxeo/nuxeo-ui-elements/blob/maintenance-2.4.x/widgets/nuxeo-user-avatar.html ) and copy it into your Nuxeo Studio Designer Project, make your updates and reference it in your custom bundle file?
12-19-2019 04:17 PM
You mean the xml contribution file? I edited my question to show my contribution.
12-19-2019 04:42 PM
Hello, I'm making a reference to what is done to extend the user profile for exemple
12-19-2019 05:38 PM
I see in your example that you're replacing the <link> references and the href attribute in nuxeo-layout, but in my case what would I replace? The whole nuxeo-app.html file and add the import there? If I just add the html import in my *custom-bundle.html it will throw the customElementRegistry error
12-24-2019 11:54 AM
I asked the same question a few weeks ago and the answer from the Nuxeo team was that it's not possible without overriding the massive 80k LOC nuxeo-app.html file.
12-24-2019 11:57 AM
I see, it is I as I feared. Could you share a link to the question please?
12-24-2019 12:01 PM
Here it is https
01-05-2020 04:04 AM
There is no way to do it today (at least not until we have import maps support). This can’t be supported as we might need to break the API and we can’t ensure your override implements the API we need. Solutions to address this that we’d like to propose once we can do so:
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.