From e0e967ac46a15bf56df3f0eb1723f4c89bfdeadc Mon Sep 17 00:00:00 2001 From: Kane York Date: Thu, 14 May 2020 13:03:42 -0700 Subject: [PATCH] FIX: Apply code quoting with no syntax highlighting (#9784) --- app/assets/javascripts/discourse/app/lib/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/lib/utilities.js b/app/assets/javascripts/discourse/app/lib/utilities.js index cb805206a37..688aa53929c 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.append(range.cloneContents());