FIX: Improve selector for copy codeblock button (#9493)

FIX: Improve selector for copy codeblock button (#9493)

Previous selector implementation was not accounting for codeblocks in nested elements, like lists.

diff --git a/app/assets/javascripts/discourse/initializers/copy-codeblocks.js b/app/assets/javascripts/discourse/initializers/copy-codeblocks.js
index b9aaa32..777400d 100644
--- a/app/assets/javascripts/discourse/initializers/copy-codeblocks.js
+++ b/app/assets/javascripts/discourse/initializers/copy-codeblocks.js
@@ -114,7 +114,7 @@ export default {
         }
 
         const commands = postElements[0].querySelectorAll(
-          ":scope > pre > code"
+          ":scope > pre > code, :scope :not(article) > pre > code"
         );
 
         const post = helper.getModel();

GitHub sha: c9cdd12e

This commit appears in #9493 which was merged by justindirose.