From 752d39b2aba9a85de99f9d949b805264866f355f Mon Sep 17 00:00:00 2001 From: simeng-li Date: Tue, 27 Jun 2023 10:00:00 +0800 Subject: [PATCH] fix(ui): fix ui preview critical bug (#4086) * fix(ui): fix ui preview critical bug fix ui switch platform and theme style messed up bug * fix: let helmet manage all body classnames let helmet manage all the body classnames --- .../ui/src/Layout/AppLayout/index.module.scss | 15 --------------- packages/ui/src/Providers/AppBoundary/AppMeta.tsx | 6 +++--- .../src/Providers/AppBoundary/index.module.scss | 15 +++++++++++++++ .../src/Providers/SettingsProvider/use-preview.ts | 5 ----- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/packages/ui/src/Layout/AppLayout/index.module.scss b/packages/ui/src/Layout/AppLayout/index.module.scss index 60ecc7b02..b1209c734 100644 --- a/packages/ui/src/Layout/AppLayout/index.module.scss +++ b/packages/ui/src/Layout/AppLayout/index.module.scss @@ -1,20 +1,5 @@ @use '@/scss/underscore' as _; -/* Preview Settings */ -.preview { - pointer-events: none; - user-select: none; - - .viewBox::-webkit-scrollbar { - display: none; - } - - main { - pointer-events: none; - user-select: none; - } -} - /* Main Layout */ .viewBox { position: absolute; diff --git a/packages/ui/src/Providers/AppBoundary/AppMeta.tsx b/packages/ui/src/Providers/AppBoundary/AppMeta.tsx index 02499806e..8ec7831e4 100644 --- a/packages/ui/src/Providers/AppBoundary/AppMeta.tsx +++ b/packages/ui/src/Providers/AppBoundary/AppMeta.tsx @@ -18,13 +18,14 @@ import * as styles from './index.module.scss'; * - data-theme: set html data-theme attribute * - favicon: set favicon * - apple-touch-icon: set apple touch icon + * - body class: set preview body class * - body class: set platform body class * - body class: set theme body class * - custom css: set custom css style tag */ const AppMeta = () => { - const { experienceSettings, theme, platform } = useContext(PageContext); + const { experienceSettings, theme, platform, isPreview } = useContext(PageContext); return ( @@ -38,8 +39,7 @@ const AppMeta = () => { {experienceSettings?.customCss && } { // Init i18n const i18nInit = initI18n(); - // Block pointer event - document.body.classList.add(conditionalString(styles.preview)); - // Listen to the message from the ancestor window const previewMessageHandler = async (event: MessageEvent) => { // #event.data should be guarded at the provider's side