From 6bf1d8fd9dd36792aeabc3df9499c79037831e1c Mon Sep 17 00:00:00 2001 From: Leonardo Giacone Date: Thu, 9 Jan 2025 13:36:03 +0100 Subject: [PATCH] fix(app-headless-cms): various full screen editor (#4480) --- .../src/admin/views/contentEntries/ContentEntriesModule.tsx | 6 +++--- .../FullScreenContentEntry.styled.tsx | 2 +- .../FullScreenContentEntry/FullScreenContentEntry.tsx | 4 ++-- .../RevisionListDrawer/RevisionListDrawer.tsx | 4 ++-- packages/app-headless-cms/src/utils/cmsLegacyEntryEditor.ts | 3 +++ packages/feature-flags/src/index.ts | 2 +- webiny.project.ts | 1 - 7 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 packages/app-headless-cms/src/utils/cmsLegacyEntryEditor.ts diff --git a/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntriesModule.tsx b/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntriesModule.tsx index eac632bf4d1..05465a25dc3 100644 --- a/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntriesModule.tsx +++ b/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntriesModule.tsx @@ -35,7 +35,7 @@ import { ShowConfirmationOnUnpublish } from "~/admin/components/Decorators/ShowC import { ShowConfirmationOnDeleteRevision } from "~/admin/components/Decorators/ShowConfirmationOnDeleteRevision"; import { FullScreenContentEntry } from "~/admin/views/contentEntries/ContentEntry/FullScreenContentEntry"; import { ShowRevisionList } from "~/admin/components/ContentEntryForm/Header/ShowRevisionsList"; -import { featureFlags } from "@webiny/feature-flags"; +import { cmsLegacyEntryEditor } from "~/utils/cmsLegacyEntryEditor"; const { Browser } = ContentEntryListConfig; const { Actions } = ContentEntryEditorConfig; @@ -116,12 +116,12 @@ export const ContentEntriesModule = () => { } /> {/* The following Menu Action registration is needed - only when the 'allowCmsFullScreenEditor' feature is enabled. + only when the 'cmsLegacyEntryEditor' feature is NOT enabled. */} } - remove={!featureFlags.allowCmsFullScreenEditor} + remove={cmsLegacyEntryEditor} /> diff --git a/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.styled.tsx b/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.styled.tsx index 9910f081dca..d1970ef243a 100644 --- a/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.styled.tsx +++ b/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.styled.tsx @@ -108,7 +108,7 @@ export const FullScreenContentEntryContentFormWrapper = styled.div` export const FullScreenContentEntryContentFormInner = styled.div` flex-shrink: 1; - flex-basis: 920px; + flex-basis: 1020px; `; export const FullScreenContentEntryContentFormInnerCss = css` diff --git a/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.tsx b/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.tsx index e0b7a4928ca..511f936fe6a 100644 --- a/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.tsx +++ b/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.tsx @@ -1,6 +1,5 @@ import React, { useState } from "react"; import { createPortal } from "react-dom"; -import { featureFlags } from "@webiny/feature-flags"; import { CircularProgress } from "@webiny/ui/Progress"; import { useContentEntry } from "~/admin/views/contentEntries/hooks"; import { RevisionListDrawer } from "./RevisionListDrawer"; @@ -16,6 +15,7 @@ import { } from "./FullScreenContentEntry.styled"; import { FullScreenContentEntryProvider } from "./useFullScreenContentEntry"; import { ContentEntryEditorConfig } from "~/ContentEntryEditorConfig"; +import { cmsLegacyEntryEditor } from "~/utils/cmsLegacyEntryEditor"; const { ContentEntry } = ContentEntryEditorConfig; @@ -79,7 +79,7 @@ const FullScreenContentEntryFormHeaderDecorator = }); export const FullScreenContentEntry = () => { - if (!featureFlags.allowCmsFullScreenEditor) { + if (cmsLegacyEntryEditor) { return null; } diff --git a/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/RevisionListDrawer/RevisionListDrawer.tsx b/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/RevisionListDrawer/RevisionListDrawer.tsx index 301ae779b22..519a6e09a33 100644 --- a/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/RevisionListDrawer/RevisionListDrawer.tsx +++ b/packages/app-headless-cms/src/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/RevisionListDrawer/RevisionListDrawer.tsx @@ -3,7 +3,7 @@ import React from "react"; import { useHotkeys } from "react-hotkeyz"; import { DrawerContent } from "@webiny/ui/Drawer"; import { RevisionsList } from "~/admin/views/contentEntries/ContentEntry/RevisionsList/RevisionsList"; -import { featureFlags } from "@webiny/feature-flags"; +import { cmsLegacyEntryEditor } from "~/utils/cmsLegacyEntryEditor"; import { useFullScreenContentEntry } from "../useFullScreenContentEntry"; import { Header } from "./Header"; import { Drawer } from "./RevisionListDrawer.styled"; @@ -11,7 +11,7 @@ import { Drawer } from "./RevisionListDrawer.styled"; export const RevisionListDrawer = () => { const { isRevisionListOpen, openRevisionList } = useFullScreenContentEntry(); - if (!featureFlags.allowCmsFullScreenEditor) { + if (cmsLegacyEntryEditor) { return null; } diff --git a/packages/app-headless-cms/src/utils/cmsLegacyEntryEditor.ts b/packages/app-headless-cms/src/utils/cmsLegacyEntryEditor.ts new file mode 100644 index 00000000000..a098f4bb971 --- /dev/null +++ b/packages/app-headless-cms/src/utils/cmsLegacyEntryEditor.ts @@ -0,0 +1,3 @@ +import { featureFlags } from "@webiny/feature-flags"; + +export const cmsLegacyEntryEditor = featureFlags.cmsLegacyEntryEditor === true; diff --git a/packages/feature-flags/src/index.ts b/packages/feature-flags/src/index.ts index 0139bbfcc7f..1a0058ec1ca 100644 --- a/packages/feature-flags/src/index.ts +++ b/packages/feature-flags/src/index.ts @@ -1,7 +1,7 @@ export type FeatureFlags> = { experimentalAdminOmniSearch?: boolean; allowCmsLegacyRichTextInput?: boolean; - allowCmsFullScreenEditor?: boolean; + cmsLegacyEntryEditor?: boolean; experimentalDynamicPages?: boolean; newWatchCommand?: boolean; } & TFeatureFlags; diff --git a/webiny.project.ts b/webiny.project.ts index 4863494874e..5ccd9ed19c9 100644 --- a/webiny.project.ts +++ b/webiny.project.ts @@ -57,7 +57,6 @@ export default { featureFlags: { experimentalAdminOmniSearch: true, newWatchCommand: true, - allowCmsFullScreenEditor: false, experimentalDynamicPages: false } };