Hi there,
I’m migrating a custom property editor, from Umbraco 12 (AngularJS) to Umbraco 15+.
Background info: wrapping AngularJS (please, don’t shoot me)
I’ve created a wrapper, which loads AngularJS inside of the web component. That actually works pretty well. Saved me a lot of time, too.
To access Umbraco functions, I bubble events back to the WebComponent, which calls imported Umbraco components (see an example below).
Legacy solution
In AngularJS (U12), the editorService can be used to open a sidebar / modal to edit a particular node. I’m looking for an alternative for Umbraco 15+.
Content picker (but not editor!)
In my property editor script file, I can open a Content Picker with this function:
import { UMB_MODAL_MANAGER_CONTEXT as mm } from '@umbraco-cms/backoffice/modal';
import { UMB_DOCUMENT_PICKER_MODAL } from '@umbraco-cms/backoffice/document';
async openContentPicker(options) {
// get context and open modal
const modalContext = await this.getContext(mm);
const modalHandler = modalContext?.open(this, UMB_DOCUMENT_PICKER_MODAL, {
data: {
modal: {
type: "sidebar",
size: "small"
},
hideTreeRoot: true,
multiple: options.multiPicker,
filter: options.filter,
filterExclude: false,
startNodeId: options.startNodeId
}
});
// modal event handlers (submit / cancel)
modalHandler.onSubmit().then((selection) => {
if (options.submitCallback) {
options.submitCallback?.(selection);
}
}).catch(() => {
if (options.closeCallback) {
options.closeCallback?.();
}
});
}
Is there a way to open a ‘content editor’ in a similar way? Or do I have to navigate to a particular route by using UMB_ROUTE_CONTEXT?
Example
An example of what I’m trying to accomplish, can be found in the Media-section:
- Open a media item
- Click the ‘Info’ tab
- Find the ’ Referenced by the following items’ panel
- Click one of the references, so a sidebar / modal opens where you can edit the node
It’s a built in function of Umbraco, so I assume it’s possible…
Please help!
I’ve spent quite some time sniffing the network tab in Chrome and scrolling through the documentation and source code, but can’t find a solution so far.
Would be nice if somebody could help!
Best wishes,
Koopa