From 5d132bbe3eb58fb799b16cc549327149be0c87b7 Mon Sep 17 00:00:00 2001 From: ZiuChen Date: Tue, 9 May 2023 00:04:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E5=99=A8=E6=A8=A1=E5=BC=8F=E5=88=87=E6=8D=A2=E6=97=B6=20`body`?= =?UTF-8?q?=E7=B1=BB=E5=90=8D=E5=93=8D=E5=BA=94=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整了应用到`body`的类名 在其他commit处理涉及的代码 - `player-mode-webfullscreen` => `player-mode-full` - `player-mode-widescreen` => `player-mode-wide` --- src/components/video/player-adaptor/bpx.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/video/player-adaptor/bpx.ts b/src/components/video/player-adaptor/bpx.ts index 5ba6c5790..d95ff9d4e 100644 --- a/src/components/video/player-adaptor/bpx.ts +++ b/src/components/video/player-adaptor/bpx.ts @@ -11,11 +11,14 @@ const playerModePolyfill = async () => { } attributes(bpxContainer, () => { const dataScreen = bpxContainer.getAttribute('data-screen') - document.body.classList.toggle( - 'player-mode-webfullscreen', - dataScreen === 'full' || dataScreen === 'web', - ) - dataScreen === 'wide' ? document.body.classList.add('player-mode-widescreen') : '' + const prefix = 'player-mode-' + const enumList = ['normal', 'wide', 'web', 'full'].map(it => `${prefix}${it}`) + + // clear all class + document.body.classList.remove(...enumList) + + // add class + document.body.classList.add(dataScreen !== 'normal' ? `${prefix}${dataScreen}` : '') }) } const idPolyfill = async () => { From ac6e0e40f7082633a96180382eada2d34dd20fc3 Mon Sep 17 00:00:00 2001 From: ZiuChen Date: Tue, 9 May 2023 00:06:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E9=80=82=E5=BA=94=20bpx.ts=20?= =?UTF-8?q?=E4=B8=AD=E7=B1=BB=E5=90=8D=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 全局搜索只找到了这一处,不知道还有没有其他地方 --- .../video/player/disable-scroll-volume/index.ts | 8 +++----- src/ui/_common.scss | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/registry/lib/components/video/player/disable-scroll-volume/index.ts b/registry/lib/components/video/player/disable-scroll-volume/index.ts index eb8852216..c653544d8 100644 --- a/registry/lib/components/video/player/disable-scroll-volume/index.ts +++ b/registry/lib/components/video/player/disable-scroll-volume/index.ts @@ -5,11 +5,9 @@ let cancel: () => void const prevent = () => { cancel?.() cancel = preventEvent(unsafeWindow, 'mousewheel', () => { - const isFullscreen = [ - 'player-mode-webfullscreen', - 'player-fullscreen-fix', - 'player-full-win', - ].some(token => document.body.classList.contains(token)) + const isFullscreen = ['player-mode-full', 'player-fullscreen-fix', 'player-full-win'].some( + token => document.body.classList.contains(token), + ) return isFullscreen }) } diff --git a/src/ui/_common.scss b/src/ui/_common.scss index 3e8c19574..9bde89995 100644 --- a/src/ui/_common.scss +++ b/src/ui/_common.scss @@ -145,8 +145,8 @@ left: 50%; transform: translateX(-50%) translateY(-50%); } -@mixin on-fullscreen($bodyClass: "*") { - #{selector-unify("body.player-mode-webfullscreen", $bodyClass)} &, +@mixin on-fullscreen($bodyClass: '*') { + #{selector-unify("body.player-mode-full", $bodyClass)} &, #{selector-unify("body.player-fullscreen-fix", $bodyClass)} &, #{selector-unify("body.player-full-win", $bodyClass)} & { @content;