AI OnAI Off
Nikola, actually yes :) Optimizely released some web components that you can use
<optimizely-content-tree id="content-tree"></optimizely-content-tree> <optimizely-button id="generate" buttonStyle="highlight" text="Generate"></optimizely-button>
let selectedNode = null;
document.getElementById("content-tree").addEventListener("onNodeSelected", (event) = {
selectedNode = event.detail.contentLink;
});
document.getElementById("generate").addEventListener("onClick", () = {
alert('sending contentLink with id = ' + selectedNode;
});
https://support.optimizely.com/hc/en-us/articles/23946044789901-2024-CMS-release-notes
Could you please provide some short example how to get those new web components work in MVC? I have exactly the same problem that Christian described in the first post.
Hi Aleksander Rajca,
You probably need to include the @Html.RegisterOptimizelyWebComponents()
helper in order for those web components to be loaded.
Thanks Karol! It was a piece that I was missing. Everything works perfectly now.
I am converting a CMS 11 to CMS 12 and there is a custom admin tool that had a content picker enabling the user to select a page or starting node. In CMS 11 that was pretty easy, but in CMS 12 I have not seen so many working examples :) Is the a MVC example out there? :)
I had a look at https://world.optimizely.com/forum/developer-forum/cms-12/thread-container/2023/6/contentselector-in-custom-page-in-admin/ but I could not get that to work.
I have also looked at https://docs.developers.optimizely.com/content-management-system/docs/creating-a-react-component but I would rather not go the react way, the guide also mentions
"Something else that maybe worth looking at is the @episerver/amd-proxy-loader I mentioned previously (https://www.npmjs.com/package/@episerver/amd-loader-proxy). With this it is possible to dynamically require AMD modules from Episerver CMS from your JavaScript application. This is framework agnostic so it can be used with whichever JavaScript framework you prefer."
But https://github.com/episerver/amd-loader-proxy now does not seems to be maintained any longer.