import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { css, html, customElement, LitElement } from '@umbraco-cms/backoffice/external/lit'; import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'; import { UMB_WORKSPACE_VIEW_CONTEXT } from '@umbraco-cms/backoffice/workspace'; import { UmbVariantId } from '@umbraco-cms/backoffice/variant'; import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/document'; @customElement('example-hint-workspace-view') export class ExampleHintWorkspaceView extends UmbElementMixin(LitElement) { // async onClick() { /* const context = await this.getContext(UMB_WORKSPACE_VIEW_NAVIGATION_CONTEXT); if (!context) { throw new Error('Could not find the context'); } const view = await context.getViewContext('example.workspaceView.hint'); */ /* const view = await this.getContext(UMB_WORKSPACE_VIEW_CONTEXT); if (!view) { throw new Error('Could not find the view'); } if (view.hints.has('exampleHintFromToggleAction')) { view.hints.removeOne('exampleHintFromToggleAction'); } else { view.hints.addOne({ unique: 'exampleHintFromToggleAction', text: 'Hi', color: 'invalid', weight: 100, }); } */ const workspace = await this.getContext(UMB_DOCUMENT_WORKSPACE_CONTEXT); if (!workspace) { throw new Error('Could not find the workspace'); } if (workspace.view.hints.has('exampleHintFromToggleAction')) { workspace.view.hints.removeOne('exampleHintFromToggleAction'); } else { workspace.view.hints.addOne({ unique: 'exampleHintFromToggleAction', path: ['Umb.WorkspaceView.Document.Edit'], text: 'Hi', color: 'invalid', weight: 100, }); } } override render() { return html`

See the hint on this views tab

This is toggle on/off via this button:

Toggle hint
`; } static override styles = [ UmbTextStyles, css` :host { display: block; padding: var(--uui-size-layout-1); } `, ]; } export { ExampleHintWorkspaceView as element }; declare global { interface HTMLElementTagNameMap { 'example-hint-workspace-view': ExampleHintWorkspaceView; } }