Represents a single selected asset entry, pairing an asset reference with its file path.
// Register a context action that accesses AssetContext.Item properties. const registry = this.pluginSystem.findInterface( Editor.IContextActionRegistry.interfaceId ) as Editor.IContextActionRegistry; if (Editor.isNull(registry)) { console.log('IContextActionRegistry not available'); return; } const guard = registry.registerAction((ctx: Editor.IContext) => { const assetCtx = ctx as Editor.Model.AssetContext; for (const item of assetCtx.selection) { // Each Item has readonly asset and path properties const asset: Editor.Assets.Asset = item.asset; const path: Editor.Path = item.path; console.log('Asset name:', asset.name); console.log('Asset path:', path.toString()); } return undefined as unknown as Editor; }); this.guards.push(guard); console.log('Asset context item action registered'); Copy
// Register a context action that accesses AssetContext.Item properties. const registry = this.pluginSystem.findInterface( Editor.IContextActionRegistry.interfaceId ) as Editor.IContextActionRegistry; if (Editor.isNull(registry)) { console.log('IContextActionRegistry not available'); return; } const guard = registry.registerAction((ctx: Editor.IContext) => { const assetCtx = ctx as Editor.Model.AssetContext; for (const item of assetCtx.selection) { // Each Item has readonly asset and path properties const asset: Editor.Assets.Asset = item.asset; const path: Editor.Path = item.path; console.log('Asset name:', asset.name); console.log('Asset path:', path.toString()); } return undefined as unknown as Editor; }); this.guards.push(guard); console.log('Asset context item action registered');
Protected
Snap Hidden
Readonly
The asset associated with this context item.
The path of the asset within the context.
Represents a single selected asset entry, pairing an asset reference with its file path.
Example