From c1e82d4718fc98d20cf51b4bd2e3f40c4a6e735b Mon Sep 17 00:00:00 2001 From: bigcode Date: Tue, 3 Nov 2026 23:32:26 +0800 Subject: [PATCH] =?UTF-8?q?v0.10.31:=20video=20widget=20=E7=94=BB=E5=B9=85?= =?UTF-8?q?=E6=A1=A3=E4=BD=8D=EF=BC=88aspect=5Fratio=20219=3D21:9=EF=BC=89?= =?UTF-8?q?+=20slim=20=E7=99=BD=E5=90=8D=E5=8D=95=E8=A1=A5=20key=20+=20Ele?= =?UTF-8?q?mentor=20kit=20=E5=85=A8=E5=B1=80=E8=89=B2/=E6=8E=92=E7=89=88?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E8=A1=A5=E5=85=A8=EF=BC=88a:hover=3Dsecondar?= =?UTF-8?q?y=20#FFA11B=E3=80=814d5c430=3D#fff=20=E7=99=BD=E5=AD=97?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bun.lock | 3 +++ package.json | 3 ++- src/components/elementor/Renderer.tsx | 16 ++++++++++++++-- src/components/elementor/slim.ts | 2 ++ src/styles/app.css | 26 +++++++++++++++++++++++--- 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/bun.lock b/bun.lock index 60cddc2a7..b35c07dd2 100644 --- a/bun.lock +++ b/bun.lock @@ -36,6 +36,7 @@ "vite": "^8.3.5", }, "devDependencies": { + "playwright-core": "^1.64.1", "vite-tsconfig-paths": "^6.1.1", }, }, @@ -633,6 +634,8 @@ "picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], + "playwright-core": ["playwright-core@1.64.1", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ=="], + "postcss": ["postcss@8.5.32", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g=="], "prettier": ["prettier@3.9.10", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA=="], diff --git a/package.json b/package.json index d06f39e8d..4a8602ea3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dusuniot-rebuild", - "version": "0.10.30", + "version": "0.10.31", "private": true, "type": "module", "scripts": { @@ -45,6 +45,7 @@ "vite": "^8.3.5" }, "devDependencies": { + "playwright-core": "^1.64.1", "vite-tsconfig-paths": "^6.1.1" } } diff --git a/src/components/elementor/Renderer.tsx b/src/components/elementor/Renderer.tsx index 950cb7cb8..464827b5a 100644 --- a/src/components/elementor/Renderer.tsx +++ b/src/components/elementor/Renderer.tsx @@ -2056,15 +2056,27 @@ function TabsWidget({ settings }: { settings: Record }) { ); } -/** # 组件 video widget:YouTube iframe 嵌入 */ +/** # 常量 Elementor 视频 aspect_ratio 选项 → 高宽比(原站 --video-aspect-ratio 取证) **/ +const VIDEO_RATIO: Record = { + "11": 1, + "169": 16 / 9, + "43": 4 / 3, + "32": 3 / 2, + "219": 21 / 9, + "439": 43 / 9, + "916": 9 / 16, +}; + +/** # 组件 video widget:YouTube iframe 嵌入(aspect_ratio 决定占位比,缺省 16:9) */ function VideoWidget({ settings }: { settings: Record }) { let raw = s((settings.youtube_url as { url?: string } | undefined)?.url) || s(settings.youtube_url) || s(settings.video_url) || s((settings as Record).url); if (!raw) return null; // 把 youtube watch 链接转为 embed const m = raw.match(/[?&]v=([\w-]{6,})/) || raw.match(/youtu\.be\/([\w-]{6,})/); const src = m ? `https://www.youtube.com/embed/${m[1]}` : raw; + const ratio = VIDEO_RATIO[s(settings.aspect_ratio)] ?? 16 / 9; return ( -
+