diff --git a/src/libs/context-api/consume/context-consumer.test.ts b/src/libs/context-api/consume/context-consumer.test.ts index e45ea4170a..9ec2e235ee 100644 --- a/src/libs/context-api/consume/context-consumer.test.ts +++ b/src/libs/context-api/consume/context-consumer.test.ts @@ -2,7 +2,7 @@ import { UmbContextProvider } from '../provide/context-provider.js'; import { UmbContextToken } from '../token/context-token.js'; import { UmbContextConsumer } from './context-consumer.js'; import type { UmbContextRequestEventImplementation } from './context-request.event.js'; -import { UMB_CONTENT_REQUEST_EVENT_TYPE } from './context-request.event.js'; +import { UMB_CONTEXT_REQUEST_EVENT_TYPE } from './context-request.event.js'; import { expect, oneEvent } from '@open-wc/testing'; const testContextAlias = 'my-test-context'; @@ -38,13 +38,13 @@ describe('UmbContextConsumer', () => { describe('events', () => { it('dispatches context request event when constructed', async () => { - const listener = oneEvent(window, UMB_CONTENT_REQUEST_EVENT_TYPE); + const listener = oneEvent(window, UMB_CONTEXT_REQUEST_EVENT_TYPE); consumer.hostConnected(); const event = (await listener) as unknown as UmbContextRequestEventImplementation; expect(event).to.exist; - expect(event.type).to.eq(UMB_CONTENT_REQUEST_EVENT_TYPE); + expect(event.type).to.eq(UMB_CONTEXT_REQUEST_EVENT_TYPE); expect(event.contextAlias).to.eq(testContextAlias); consumer.hostDisconnected(); }); diff --git a/src/libs/context-api/consume/context-request.event.ts b/src/libs/context-api/consume/context-request.event.ts index 6371270e93..a2fa4d9975 100644 --- a/src/libs/context-api/consume/context-request.event.ts +++ b/src/libs/context-api/consume/context-request.event.ts @@ -1,4 +1,9 @@ -export const UMB_CONTENT_REQUEST_EVENT_TYPE = 'umb:context-request'; +export const UMB_CONTEXT_REQUEST_EVENT_TYPE = 'umb:context-request'; +/** + * @deprecated use UMB_CONTEXT_REQUEST_EVENT_TYPE + * This will be removed in Umbraco 17 + */ +export const UMB_CONTENT_REQUEST_EVENT_TYPE = UMB_CONTEXT_REQUEST_EVENT_TYPE; export const UMB_DEBUG_CONTEXT_EVENT_TYPE = 'umb:debug-contexts'; export type UmbContextCallback = (instance: T) => void; @@ -29,7 +34,7 @@ export class UmbContextRequestEventImplementation public readonly callback: (context: ResultType) => boolean, public readonly stopAtContextMatch: boolean = true, ) { - super(UMB_CONTENT_REQUEST_EVENT_TYPE, { bubbles: true, composed: true, cancelable: true }); + super(UMB_CONTEXT_REQUEST_EVENT_TYPE, { bubbles: true, composed: true, cancelable: true }); } clone() { diff --git a/src/libs/context-api/provide/context-boundary.ts b/src/libs/context-api/provide/context-boundary.ts index a44f61af62..56244997c6 100644 --- a/src/libs/context-api/provide/context-boundary.ts +++ b/src/libs/context-api/provide/context-boundary.ts @@ -1,6 +1,6 @@ import type { UmbContextRequestEvent } from '../consume/context-request.event.js'; import type { UmbContextToken } from '../token/index.js'; -import { UMB_CONTENT_REQUEST_EVENT_TYPE } from '../consume/context-request.event.js'; +import { UMB_CONTEXT_REQUEST_EVENT_TYPE } from '../consume/context-request.event.js'; import { UmbContextProvideEventImplementation } from './context-provide.event.js'; /** @@ -24,7 +24,7 @@ export class UmbContextBoundary { const idSplit = contextIdentifier.toString().split('#'); this.#contextAlias = idSplit[0]; - this.#eventTarget.addEventListener(UMB_CONTENT_REQUEST_EVENT_TYPE, this.#handleContextRequest); + this.#eventTarget.addEventListener(UMB_CONTEXT_REQUEST_EVENT_TYPE, this.#handleContextRequest); } /** diff --git a/src/libs/context-api/provide/context-provider.ts b/src/libs/context-api/provide/context-provider.ts index 21a8aa9f86..d801d764b6 100644 --- a/src/libs/context-api/provide/context-provider.ts +++ b/src/libs/context-api/provide/context-provider.ts @@ -1,6 +1,6 @@ import type { UmbContextRequestEvent } from '../consume/context-request.event.js'; import type { UmbContextToken } from '../token/index.js'; -import { UMB_CONTENT_REQUEST_EVENT_TYPE, UMB_DEBUG_CONTEXT_EVENT_TYPE } from '../consume/context-request.event.js'; +import { UMB_CONTEXT_REQUEST_EVENT_TYPE, UMB_DEBUG_CONTEXT_EVENT_TYPE } from '../consume/context-request.event.js'; import { UmbContextProvideEventImplementation } from './context-provide.event.js'; /** @@ -41,7 +41,7 @@ export class UmbContextProvider { + this.element.addEventListener(UMB_CONTEXT_REQUEST_EVENT_TYPE, ((event: UmbContextRequestEvent) => { if (!this.#modalContext) return; // Note for this hack (The if-sentence): [NL] // We do not currently have a good enough control to ensure that the proxy is last, meaning if another context is provided at this element, it might respond after the proxy event has been dispatched. diff --git a/src/packages/tiny-mce/components/input-tiny-mce/input-tiny-mce.defaults.ts b/src/packages/tiny-mce/components/input-tiny-mce/input-tiny-mce.defaults.ts index 4526ca07d5..ac1260b8ce 100644 --- a/src/packages/tiny-mce/components/input-tiny-mce/input-tiny-mce.defaults.ts +++ b/src/packages/tiny-mce/components/input-tiny-mce/input-tiny-mce.defaults.ts @@ -1,4 +1,4 @@ -import { UMB_CONTENT_REQUEST_EVENT_TYPE, type UmbContextRequestEvent } from '@umbraco-cms/backoffice/context-api'; +import { UMB_CONTEXT_REQUEST_EVENT_TYPE, type UmbContextRequestEvent } from '@umbraco-cms/backoffice/context-api'; import type { RawEditorOptions } from '@umbraco-cms/backoffice/external/tinymce'; import { UUIIconRequestEvent } from '@umbraco-cms/backoffice/external/uui'; @@ -34,7 +34,7 @@ export const defaultFallbackConfig: RawEditorOptions = { init_instance_callback: function (editor) { // The following code is the context api proxy. [NL] // It re-dispatches the context api request event to the origin target of this modal, in other words the element that initiated the modal. [NL] - editor.dom.doc.addEventListener(UMB_CONTENT_REQUEST_EVENT_TYPE, ((event: UmbContextRequestEvent) => { + editor.dom.doc.addEventListener(UMB_CONTEXT_REQUEST_EVENT_TYPE, ((event: UmbContextRequestEvent) => { if (!editor.iframeElement) return; event.stopImmediatePropagation();