From 6603b9cee9ce4305b13adf7bb9135970b8a1f8ff Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 23 Sep 2024 11:17:19 +0200 Subject: [PATCH] move code editor modal to code-editor module --- .../code-editor-modal}/code-editor-modal.element.ts | 6 ++---- .../code-editor-modal}/code-editor-modal.stories.ts | 2 +- .../code-editor-modal}/code-editor-modal.token.ts | 2 +- src/packages/code-editor/code-editor-modal/index.ts | 1 + src/packages/code-editor/code-editor-modal/manifests.ts | 8 ++++++++ src/packages/code-editor/index.ts | 2 ++ src/packages/code-editor/manifests.ts | 3 ++- src/packages/core/modal/common/manifests.ts | 6 ------ src/packages/core/modal/token/index.ts | 1 - .../tiny-mce/plugins/tiny-mce-code-editor.plugin.ts | 3 ++- 10 files changed, 19 insertions(+), 15 deletions(-) rename src/packages/{core/modal/common/code-editor => code-editor/code-editor-modal}/code-editor-modal.element.ts (91%) rename src/packages/{core/modal/common/code-editor => code-editor/code-editor-modal}/code-editor-modal.stories.ts (91%) rename src/packages/{core/modal/token => code-editor/code-editor-modal}/code-editor-modal.token.ts (91%) create mode 100644 src/packages/code-editor/code-editor-modal/index.ts create mode 100644 src/packages/code-editor/code-editor-modal/manifests.ts diff --git a/src/packages/core/modal/common/code-editor/code-editor-modal.element.ts b/src/packages/code-editor/code-editor-modal/code-editor-modal.element.ts similarity index 91% rename from src/packages/core/modal/common/code-editor/code-editor-modal.element.ts rename to src/packages/code-editor/code-editor-modal/code-editor-modal.element.ts index bb7126baaf..93f4b59add 100644 --- a/src/packages/core/modal/common/code-editor/code-editor-modal.element.ts +++ b/src/packages/code-editor/code-editor-modal/code-editor-modal.element.ts @@ -1,9 +1,7 @@ +import type { UmbCodeEditorElement } from '../components/code-editor.element.js'; +import type { UmbCodeEditorModalData, UmbCodeEditorModalValue } from './code-editor-modal.token.js'; import { css, html, ifDefined, customElement, query } from '@umbraco-cms/backoffice/external/lit'; import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal'; -import type { UmbCodeEditorElement } from '@umbraco-cms/backoffice/code-editor'; -import type { UmbCodeEditorModalData, UmbCodeEditorModalValue } from '@umbraco-cms/backoffice/modal'; - -import '@umbraco-cms/backoffice/code-editor'; const elementName = 'umb-code-editor-modal'; diff --git a/src/packages/core/modal/common/code-editor/code-editor-modal.stories.ts b/src/packages/code-editor/code-editor-modal/code-editor-modal.stories.ts similarity index 91% rename from src/packages/core/modal/common/code-editor/code-editor-modal.stories.ts rename to src/packages/code-editor/code-editor-modal/code-editor-modal.stories.ts index 37dd470a28..cfaaaef4e6 100644 --- a/src/packages/core/modal/common/code-editor/code-editor-modal.stories.ts +++ b/src/packages/code-editor/code-editor-modal/code-editor-modal.stories.ts @@ -1,8 +1,8 @@ import '../confirm/confirm-modal.element.js'; +import type { UmbCodeEditorModalData } from './code-editor-modal.token.js'; import type { Meta, Story } from '@storybook/web-components'; import { html } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbCodeEditorModalData } from '@umbraco-cms/backoffice/modal'; export default { title: 'API/Modals/Layouts/Code Editor', diff --git a/src/packages/core/modal/token/code-editor-modal.token.ts b/src/packages/code-editor/code-editor-modal/code-editor-modal.token.ts similarity index 91% rename from src/packages/core/modal/token/code-editor-modal.token.ts rename to src/packages/code-editor/code-editor-modal/code-editor-modal.token.ts index c62514f2ee..d722df2d8d 100644 --- a/src/packages/core/modal/token/code-editor-modal.token.ts +++ b/src/packages/code-editor/code-editor-modal/code-editor-modal.token.ts @@ -1,4 +1,4 @@ -import { UmbModalToken } from './modal-token.js'; +import { UmbModalToken } from '@umbraco-cms/backoffice/modal'; // TODO => investigate why exporting CodeEditorLanguage in code-editor barrel // causes the schema generation task to fail... For now, language property below diff --git a/src/packages/code-editor/code-editor-modal/index.ts b/src/packages/code-editor/code-editor-modal/index.ts new file mode 100644 index 0000000000..9c91a9f078 --- /dev/null +++ b/src/packages/code-editor/code-editor-modal/index.ts @@ -0,0 +1 @@ +export * from './code-editor-modal.token.js'; diff --git a/src/packages/code-editor/code-editor-modal/manifests.ts b/src/packages/code-editor/code-editor-modal/manifests.ts new file mode 100644 index 0000000000..027627c4a6 --- /dev/null +++ b/src/packages/code-editor/code-editor-modal/manifests.ts @@ -0,0 +1,8 @@ +export const manifests: Array = [ + { + type: 'modal', + alias: 'Umb.Modal.CodeEditor', + name: 'Code Editor Modal', + element: () => import('./code-editor-modal.element.js'), + }, +]; diff --git a/src/packages/code-editor/index.ts b/src/packages/code-editor/index.ts index 60335eb6e1..e3fb6a2f7c 100644 --- a/src/packages/code-editor/index.ts +++ b/src/packages/code-editor/index.ts @@ -1,5 +1,7 @@ export * from './components/index.js'; export * from './models/index.js'; +export * from './code-editor-modal/index.js'; + export type { UmbCodeEditorController } from './code-editor.controller.js'; /** diff --git a/src/packages/code-editor/manifests.ts b/src/packages/code-editor/manifests.ts index 47a0a1f5f3..5992ca6356 100644 --- a/src/packages/code-editor/manifests.ts +++ b/src/packages/code-editor/manifests.ts @@ -1,3 +1,4 @@ import { manifest as propertyEditorManifest } from './property-editor/manifests.js'; +import { manifests as codeEditorModalManifests } from './code-editor-modal/manifests.js'; -export const manifests: Array = [propertyEditorManifest]; +export const manifests: Array = [propertyEditorManifest, ...codeEditorModalManifests]; diff --git a/src/packages/core/modal/common/manifests.ts b/src/packages/core/modal/common/manifests.ts index 151fc68251..606d9bed3d 100644 --- a/src/packages/core/modal/common/manifests.ts +++ b/src/packages/core/modal/common/manifests.ts @@ -5,12 +5,6 @@ export const manifests: Array = [ name: 'Confirm Modal', element: () => import('./confirm/confirm-modal.element.js'), }, - { - type: 'modal', - alias: 'Umb.Modal.CodeEditor', - name: 'Code Editor Modal', - element: () => import('./code-editor/code-editor-modal.element.js'), - }, { type: 'modal', alias: 'Umb.Modal.EmbeddedMedia', diff --git a/src/packages/core/modal/token/index.ts b/src/packages/core/modal/token/index.ts index 541829d3e7..a490c78672 100644 --- a/src/packages/core/modal/token/index.ts +++ b/src/packages/core/modal/token/index.ts @@ -1,5 +1,4 @@ export * from './change-password-modal.token.js'; -export * from './code-editor-modal.token.js'; export * from './confirm-modal.token.js'; export * from './debug-modal.token.js'; export * from './embedded-media-modal.token.js'; diff --git a/src/packages/tiny-mce/plugins/tiny-mce-code-editor.plugin.ts b/src/packages/tiny-mce/plugins/tiny-mce-code-editor.plugin.ts index 9de4e35d0f..54c16a3818 100644 --- a/src/packages/tiny-mce/plugins/tiny-mce-code-editor.plugin.ts +++ b/src/packages/tiny-mce/plugins/tiny-mce-code-editor.plugin.ts @@ -1,6 +1,7 @@ import { type TinyMcePluginArguments, UmbTinyMcePluginBase } from '../components/input-tiny-mce/tiny-mce-plugin.js'; import { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api'; -import { UMB_CODE_EDITOR_MODAL, UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; +import { UMB_CODE_EDITOR_MODAL } from '@umbraco-cms/backoffice/code-editor'; +import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; export default class UmbTinyMceCodeEditorPlugin extends UmbTinyMcePluginBase { constructor(args: TinyMcePluginArguments) {