Ben
10/11/2024, 4:50 PMBen
10/11/2024, 4:50 PMNiels Lyngsø
10/11/2024, 5:21 PM"UmbWorkspaceContext"
then you get the Blocks Workspace? But you would want to consume the Document Workspace... — Lets hope I assumed right.
Then your option is to use a more specific Context Token, there is one specific for Document, called: UMB_DOCUMENT_WORKSPACE_CONTEXT
The technical difference from just using a Context-Alias, to using a Context Token is that it comes with a discriminator, which makes the match more specific.
This makes it only find a workspace context if its of the type Document.
But thats not enough, cause pr. default you can only consume the nearst Workspace Context , like when working in inifinte editors you will only be able to get the nearest Context of that Context-Alias. Our context system is made to stop if there was a match on the Context Alias. But you can opt in to ignorer this and continue the search for a perfect match. — I can explain why we do this if you like.
Here is an example of doing that:
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (context) => {
console.log("got the context", context)
}).passContextAliasMatches();
Ben
10/12/2024, 7:32 AM"UmbWorkspaceContext"
alias, only tokens, but found the call back function in consumeContext
wasn't getting run for UMB_DOCUMENT_WORKSPACE_CONTEXT
. I'm hoping the application of passContextAliasMatches()
will change that. I'm very new to JS/TS web frameworks, been such a steep learning curve 😓Ben
10/13/2024, 12:19 PMpassContextAliasMatches()
did the trick. Thanks very much for your help here. Hopefully this frontend frame work will start to click for me soon.Niels Lyngsø
10/16/2024, 7:25 AM