From eb0535edcfaa9f68d0fc4c431c93739a43c7b29c Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 13 Jan 2025 22:08:07 +0100 Subject: [PATCH] rename to replace --- .../block/block-grid/clipboard/manifests.ts | 6 +++--- .../context/block-grid-entries.context.ts | 4 ++-- .../block/block-list/clipboard/manifests.ts | 6 +++--- .../context/block-list-entries.context.ts | 4 ++-- .../block-catalogue-modal.element.ts | 2 +- .../block-catalogue-modal.token.ts | 2 +- .../clipboard/property/actions/manifests.ts | 2 +- .../clipboard/property/actions/paste/types.ts | 16 ---------------- .../actions/{paste => replace}/manifests.ts | 10 +++++----- .../replace-from-clipboard.property-action.ts} | 14 +++++++------- .../clipboard/property/actions/replace/types.ts | 16 ++++++++++++++++ .../packages/clipboard/property/actions/types.ts | 2 +- 12 files changed, 42 insertions(+), 42 deletions(-) delete mode 100644 src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/types.ts rename src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/{paste => replace}/manifests.ts (70%) rename src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/{paste/paste-from-clipboard.property-action.ts => replace/replace-from-clipboard.property-action.ts} (83%) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/replace/types.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/clipboard/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/clipboard/manifests.ts index 6546d9da1158..7e6aedf93df9 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/clipboard/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/clipboard/manifests.ts @@ -33,9 +33,9 @@ export const manifests: Array = [ }, { type: 'propertyAction', - kind: 'pasteFromClipboard', - alias: 'Umb.PropertyAction.BlockGrid.Clipboard.Paste', - name: 'Block Grid Paste From Clipboard Property Action', + kind: 'replaceFromClipboard', + alias: 'Umb.PropertyAction.BlockGrid.Clipboard.Replace', + name: 'Block Grid Replace From Clipboard Property Action', forPropertyEditorUis, conditions: [ { diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/context/block-grid-entries.context.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/context/block-grid-entries.context.ts index 4115c8c560c0..eb9223ef2c67 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/context/block-grid-entries.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/context/block-grid-entries.context.ts @@ -201,11 +201,11 @@ export class UmbBlockGridEntriesContext } else { throw new Error('Failed to create block'); } - } else if (value?.pasteFromClipboard && value.pasteFromClipboard.selection?.length && data) { + } else if (value?.clipboard && value.clipboard.selection?.length && data) { const clipboardContext = await this.getContext(UMB_CLIPBOARD_PROPERTY_CONTEXT); const propertyValues = await clipboardContext.readMultiple( - value.pasteFromClipboard.selection, + value.clipboard.selection, UMB_BLOCK_GRID_PROPERTY_EDITOR_UI_ALIAS, ); diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/clipboard/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/clipboard/manifests.ts index d8d73eb55c27..150cc7732f7c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/clipboard/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/clipboard/manifests.ts @@ -33,9 +33,9 @@ export const manifests: Array = [ }, { type: 'propertyAction', - kind: 'pasteFromClipboard', - alias: 'Umb.PropertyAction.BlockList.Clipboard.Paste', - name: 'Block List Paste From Clipboard Property Action', + kind: 'replaceFromClipboard', + alias: 'Umb.PropertyAction.BlockList.Clipboard.Replace', + name: 'Block List Replace From Clipboard Property Action', forPropertyEditorUis, conditions: [ { diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/context/block-list-entries.context.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/context/block-list-entries.context.ts index f94cacb3a595..5dac1698498a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/context/block-list-entries.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/context/block-list-entries.context.ts @@ -72,11 +72,11 @@ export class UmbBlockListEntriesContext extends UmbBlockEntriesContext< } else { throw new Error('Failed to create block'); } - } else if (value?.pasteFromClipboard && value.pasteFromClipboard.selection?.length && data) { + } else if (value?.clipboard && value.clipboard.selection?.length && data) { const clipboardContext = await this.getContext(UMB_CLIPBOARD_PROPERTY_CONTEXT); const propertyValues = await clipboardContext.readMultiple( - value.pasteFromClipboard.selection, + value.clipboard.selection, UMB_BLOCK_LIST_PROPERTY_EDITOR_UI_ALIAS, ); diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.element.ts index 9b43da22ab75..a84f686f14b6 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.element.ts @@ -110,7 +110,7 @@ export class UmbBlockCatalogueModalElement extends UmbModalBaseElement< const target = event.target as any; const selection = target?.selection || []; this.value = { - pasteFromClipboard: { + clipboard: { selection, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.ts index 7e38e2d0e3d5..3917474c76b2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.ts @@ -17,7 +17,7 @@ export type UmbBlockCatalogueModalValue = create?: { contentElementTypeKey: string; }; - pasteFromClipboard?: { + clipboard?: { selection: Array; }; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/manifests.ts index 82301dae9ddf..9544664cc888 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/manifests.ts @@ -1,5 +1,5 @@ import { manifests as copyManifests } from './copy/manifests.js'; -import { manifests as pasteManifests } from './paste/manifests.js'; +import { manifests as pasteManifests } from './replace/manifests.js'; import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry'; export const manifests: Array = [...copyManifests, ...pasteManifests]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/types.ts b/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/types.ts deleted file mode 100644 index 2fbb2310b507..000000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/types.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ManifestPropertyAction, MetaPropertyAction } from '@umbraco-cms/backoffice/property-action'; - -export interface ManifestPropertyActionPasteFromClipboardKind - extends ManifestPropertyAction { - type: 'propertyAction'; - kind: 'pasteFromClipboard'; -} - -// eslint-disable-next-line @typescript-eslint/no-empty-object-type -export interface MetaPropertyActionPasteFromClipboardKind extends MetaPropertyAction {} - -declare global { - interface UmbExtensionManifestMap { - umbManifestPropertyActionPasteFromClipboardKind: ManifestPropertyActionPasteFromClipboardKind; - } -} diff --git a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/replace/manifests.ts similarity index 70% rename from src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/manifests.ts rename to src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/replace/manifests.ts index ebd8efa5eee1..c4f0b0e6a677 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/replace/manifests.ts @@ -4,18 +4,18 @@ import { UMB_PROPERTY_ACTION_DEFAULT_KIND_MANIFEST } from '@umbraco-cms/backoffi export const manifests: Array = [ { type: 'kind', - alias: 'Umb.Kind.PropertyAction.pasteFromClipboard', - matchKind: 'pasteFromClipboard', + alias: 'Umb.Kind.PropertyAction.Clipboard.Replace', + matchKind: 'replaceFromClipboard', matchType: 'propertyAction', manifest: { ...UMB_PROPERTY_ACTION_DEFAULT_KIND_MANIFEST.manifest, type: 'propertyAction', - kind: 'pasteFromClipboard', - api: () => import('./paste-from-clipboard.property-action.js'), + kind: 'replaceFromClipboard', + api: () => import('./replace-from-clipboard.property-action.js'), weight: 1190, meta: { icon: 'icon-clipboard-paste', - label: 'Paste', + label: 'Replace', }, }, }, diff --git a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/paste-from-clipboard.property-action.ts b/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/replace/replace-from-clipboard.property-action.ts similarity index 83% rename from src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/paste-from-clipboard.property-action.ts rename to src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/replace/replace-from-clipboard.property-action.ts index 869b3ad05b76..7efdfb469b8c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/paste/paste-from-clipboard.property-action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/replace/replace-from-clipboard.property-action.ts @@ -1,17 +1,17 @@ import { UmbClipboardEntryItemRepository } from '../../../clipboard-entry/index.js'; import { UMB_CLIPBOARD_PROPERTY_CONTEXT } from '../../context/clipboard.property-context-token.js'; -import type { MetaPropertyActionPasteFromClipboardKind } from './types.js'; +import type { MetaPropertyActionReplaceFromClipboardKind } from './types.js'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { umbConfirmModal } from '@umbraco-cms/backoffice/modal'; import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property'; import { UmbPropertyActionBase, type UmbPropertyActionArgs } from '@umbraco-cms/backoffice/property-action'; -export class UmbPasteFromClipboardPropertyAction extends UmbPropertyActionBase { +export class UmbReplaceFromClipboardPropertyAction extends UmbPropertyActionBase { #init: Promise; #propertyContext?: typeof UMB_PROPERTY_CONTEXT.TYPE; #clipboardContext?: typeof UMB_CLIPBOARD_PROPERTY_CONTEXT.TYPE; - constructor(host: UmbControllerHost, args: UmbPropertyActionArgs) { + constructor(host: UmbControllerHost, args: UmbPropertyActionArgs) { super(host, args); this.#init = Promise.all([ @@ -66,14 +66,14 @@ export class UmbPasteFromClipboardPropertyAction extends UmbPropertyActionBase { + type: 'propertyAction'; + kind: 'replaceFromClipboard'; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface MetaPropertyActionReplaceFromClipboardKind extends MetaPropertyAction {} + +declare global { + interface UmbExtensionManifestMap { + umbManifestPropertyActionReplaceFromClipboardKind: ManifestPropertyActionReplaceFromClipboardKind; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/types.ts b/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/types.ts index 389a6d423d03..ffb1b0309bea 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/clipboard/property/actions/types.ts @@ -1,2 +1,2 @@ export type * from './copy/types.js'; -export type * from './paste/types.js'; +export type * from './replace/types.js';