From 9dd3daf05d28edb104b209cf6826c56c1dfcf90b Mon Sep 17 00:00:00 2001 From: Florian Dieminger Date: Wed, 17 Jan 2024 17:48:42 +0100 Subject: [PATCH] fix(playground): only show for js,css,html Only add the play and queue button to js, css and html code blocks. --- client/src/document/code/playground.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/document/code/playground.ts b/client/src/document/code/playground.ts index 4f087a7d6ba2..e93d21159895 100644 --- a/client/src/document/code/playground.ts +++ b/client/src/document/code/playground.ts @@ -137,6 +137,13 @@ export function addCollectButton( return; } if (!element || element.querySelector(".play-button")) return; + if ( + [...(element.nextElementSibling?.classList.values() || [])].filter((c) => + ["js", "javascript", "css", "html"].includes(c) + ).length === 0 + ) { + return; + } const checkId = crypto.randomUUID(); const playlist = document.createElement("div"); playlist.classList.add("playlist");