FIX: Apply code quoting with no syntax highlighting (#9784)

FIX: Apply code quoting with no syntax highlighting (#9784)

diff --git a/app/assets/javascripts/discourse/app/lib/utilities.js b/app/assets/javascripts/discourse/app/lib/utilities.js
index cb80520..688aa53 100644
--- a/app/assets/javascripts/discourse/app/lib/utilities.js
+++ b/app/assets/javascripts/discourse/app/lib/utilities.js
@@ -137,7 +137,6 @@ export function selectedText() {
   for (let r = 0; r < selection.rangeCount; r++) {
     const range = selection.getRangeAt(r);
     const $ancestor = $(range.commonAncestorContainer);
-    const $codeBlockTest = $ancestor.parent("pre");
 
     // ensure we never quote text in the post menu area
     const $postMenuArea = $ancestor.find(".post-menu-area")[0];
@@ -145,6 +144,7 @@ export function selectedText() {
       range.setEndBefore($postMenuArea);
     }
 
+    const $codeBlockTest = $ancestor.parents("pre");
     if ($codeBlockTest.length) {
       const $code = $("<code>");
       $code.append(range.cloneContents());

GitHub sha: e0e967ac

This commit appears in #9784 which was approved by eviltrout. It was merged by riking.