diff --git a/app/assets/javascripts/discourse/components/quote-button.js.es6 b/app/assets/javascripts/discourse/components/quote-button.js.es6 index 97de8f927d8..a8c8f5cfa57 100644 --- a/app/assets/javascripts/discourse/components/quote-button.js.es6 +++ b/app/assets/javascripts/discourse/components/quote-button.js.es6 @@ -32,6 +32,9 @@ export default Ember.Component.extend({ let firstRange, postId; for (let r = 0; r < selection.rangeCount; r++) { const range = selection.getRangeAt(r); + + if ($(range.endContainer).closest('.cooked').length === 0) return; + const $ancestor = $(range.commonAncestorContainer); firstRange = firstRange || range;