Hi all,
I’m building a custom property editor inside a block element that’s used within a block list. I can get the block’s own content type ID easily by consuming UMB_BLOCK_WORKSPACE_CONTEXT
like this:
this.consumeContext(UMB_BLOCK_WORKSPACE_CONTEXT, (instance) => {
instance.content.contentTypeId.subscribe((contentTypeId) => {
console.log(contentTypeId);
});
});
However, I’m struggling to figure out how to get the ID of the current document into which the blocks are inserted. I want to run some specific logic in the block editor depending on the type of the parent document.
I’ve also tried consuming UMB_DOCUMENT_WORKSPACE_CONTEXT
and UMB_CONTENT_WORKSPACE_CONTEXT
but the code doesn’t seem to enter those contexts inside the block editor, so I assume those contexts aren’t available there:
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (instance) => {
console.log(instance);
});
this.consumeContext(UMB_CONTENT_WORKSPACE_CONTEXT, (instance) => {
console.log(instance);
});
Has anyone figured out the recommended way to get the current document ID from within a block editor? Is there a proper Umbraco API or context I’m missing?