Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Linking to an Image in Edit Mode?



I have a custom field type with a Dojo editor associated with it.  The field revolves around imagery.  I am trying to generate a link to take the content author directly to an image asset for editing, as we have stored Alt Text on image assets.

In a nutshell, I am trying to render this from my dojo editor (where 146 is the ID of a Media asset):

<a href="/EPiServer/Cms/Home/Index/#context=epi.cms.contentdata:///146&viewsetting=viewlanguage:///en">Click Here to Edit Image</a>

However, when following this link by clicking on it, you receive this error when trying to publish changes to the image:

widgets.js:2 Uncaught TypeError: Cannot read property 'contentData' of null
at Object._isOpenSetter (widgets.js:2)
at Object.set (epi.js:2)
at Object.onOpen (widgets.js:2)
at (widgets.js:2)
at Object.advice (dojo.js:15)
at Object._264 [as open] (dojo.js:15)
at Object.openDropDown (widgets.js:2)
at Object.<anonymous> (widgets.js:2)
at dojo.js:15
at Object.loadAndOpenDropDown (widgets.js:2)

However, if I use the Assets gadget and navigate to the image in this way, then everything is fine.

What is the proper way to generate the editing link to a media asset?  Should I be using some epi api to perform the navigation?  I notice when you navigate via the Assets gadget there is no server reload- so something special is happening to perform this navigation correctly.


Sep 23, 2020 20:37

Here's the trick:

dojo.publish("/epi/shell/context/request", [{ uri: "<id-of-asset>" }]);
Sep 29, 2020 14:41
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.