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 ( -
+