|
1 | 1 | import type { UmbTiptapToolbarValue } from '../../extensions/types.js';
|
2 |
| -import { css, customElement, html, map, property, state } from '@umbraco-cms/backoffice/external/lit'; |
| 2 | +import { css, customElement, html, map, nothing, property, state } from '@umbraco-cms/backoffice/external/lit'; |
3 | 3 | import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
4 | 4 | import { UmbExtensionsElementAndApiInitializer } from '@umbraco-cms/backoffice/extension-api';
|
5 | 5 | import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
@@ -65,14 +65,19 @@ export class UmbTiptapFixedMenuElement extends UmbLitElement {
|
65 | 65 | return html`${map(this.toolbar, (row, rowIndex) =>
|
66 | 66 | map(
|
67 | 67 | row,
|
68 |
| - (group, groupIndex) => |
69 |
| - html`${map(group, (alias, aliasIndex) => { |
70 |
| - const newRow = rowIndex !== 0 && groupIndex === 0 && aliasIndex === 0; |
71 |
| - return html`<div class="item" ?data-new-row=${newRow} style="${newRow ? 'grid-column: 1 / span 3' : ''}"> |
72 |
| - ${this._lookup?.get(alias)} |
73 |
| - </div>`; |
74 |
| - })} |
75 |
| - <div class="separator"></div> `, |
| 68 | + (group, groupIndex) => html` |
| 69 | + ${map(group, (alias, aliasIndex) => { |
| 70 | + const newRow = rowIndex !== 0 && groupIndex === 0 && aliasIndex === 0; |
| 71 | + const component = this._lookup?.get(alias); |
| 72 | + if (!component) return nothing; |
| 73 | + return html` |
| 74 | + <div class="item" ?data-new-row=${newRow} style=${newRow ? 'grid-column: 1 / span 3' : ''}> |
| 75 | + ${component} |
| 76 | + </div> |
| 77 | + `; |
| 78 | + })} |
| 79 | + <div class="separator"></div> |
| 80 | + `, |
76 | 81 | ),
|
77 | 82 | )} `;
|
78 | 83 | }
|
|
0 commit comments