diff --git a/src/Umbraco.Web.UI.Client/.vscode/settings.json b/src/Umbraco.Web.UI.Client/.vscode/settings.json index 2b3d645ee9f2..8fc1bce8e6c8 100644 --- a/src/Umbraco.Web.UI.Client/.vscode/settings.json +++ b/src/Umbraco.Web.UI.Client/.vscode/settings.json @@ -4,6 +4,7 @@ "backoffice", "Backoffice", "combobox", + "contenteditable", "ctrls", "devs", "Dropcursor", diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts index e291af4aeb2a..b8f573a23544 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts @@ -404,7 +404,16 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper if (ext.component) { ext.component.classList.add('umb-block-grid__block--view'); } - return ext.component; + if (this._exposed) { + return ext.component; + } else { + return html`
+ ${ext.component} + +
`; + } }; #renderInlineEditBlock() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts index d3b58036f7ee..ddc71ecaf1c7 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts @@ -13,6 +13,7 @@ import type { ManifestBlockEditorCustomView, UmbBlockEditorCustomViewProperties, } from '@umbraco-cms/backoffice/block-custom-view'; +import type { UmbExtensionElementInitializer } from '@umbraco-cms/backoffice/extension-api'; /** * @element umb-block-list-entry @@ -277,6 +278,19 @@ export class UmbBlockListEntryElement extends UmbLitElement implements UmbProper return true; }; + #extensionSlotRenderMethod = (ext: UmbExtensionElementInitializer) => { + if (this._exposed) { + return ext.component; + } else { + return html`
+ ${ext.component} + +
`; + } + }; + #renderRefBlock() { return html`) => { + if (this._exposed) { + return ext.component; + } else { + return html`
+ ${ext.component} + +
`; + } + }; + #renderBlock() { return html`
diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block/components/block-overlay-expose-button/block-overlay-expose-button.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block/components/block-overlay-expose-button/block-overlay-expose-button.element.ts new file mode 100644 index 000000000000..0c255badf332 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block/components/block-overlay-expose-button/block-overlay-expose-button.element.ts @@ -0,0 +1,48 @@ +import { css, customElement, html, nothing, property } from '@umbraco-cms/backoffice/external/lit'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; + +/** + * @description + * This element is used to render a expose button that goes on top of a block. + */ +@customElement('umb-block-overlay-expose-button') +export class UmbBlockOverlayExposeButtonElement extends UmbLitElement { + @property({ attribute: false }) + contentTypeName?: string; + + override render() { + return this.contentTypeName + ? html` + ` + : nothing; + } + + static override styles = [ + css` + :host { + position: absolute; + inset: 0; + } + + uui-button { + position: absolute; + inset: 0; + opacity: 0.8; + } + + :host:hover uui-button { + opacity: 1; + } + `, + ]; +} + +export default UmbBlockOverlayExposeButtonElement; + +declare global { + interface HTMLElementTagNameMap { + 'umb-block-overlay-expose-button': UmbBlockOverlayExposeButtonElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block/components/index.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block/components/index.ts new file mode 100644 index 000000000000..bf8ce8160386 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block/components/index.ts @@ -0,0 +1 @@ +export * from './block-overlay-expose-button/block-overlay-expose-button.element.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block/index.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block/index.ts index 216c98bbe6c1..fd6ca0502c2a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block/index.ts @@ -1,3 +1,4 @@ +export * from './components/index.js'; export * from './context/index.js'; export * from './modals/index.js'; export * from './property-value-resolver/index.js';