diff options
Diffstat (limited to 'app/assets/javascripts/behaviors/copy_code.js')
-rw-r--r-- | app/assets/javascripts/behaviors/copy_code.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/assets/javascripts/behaviors/copy_code.js b/app/assets/javascripts/behaviors/copy_code.js index a653769b60f..ae186aba32d 100644 --- a/app/assets/javascripts/behaviors/copy_code.js +++ b/app/assets/javascripts/behaviors/copy_code.js @@ -53,9 +53,10 @@ export const initCopyCodeButton = (selector = '#content-body') => { customElements.define('copy-code', CopyCodeButton); } + const exclude = document.querySelector('.file-content.code'); // this behavior is not needed when viewing raw file content, so excluding it as the unnecessary dom lookups can become expensive const el = document.querySelector(selector); - if (!el) return () => {}; + if (!el || exclude) return () => {}; const observer = new MutationObserver(() => addCodeButton()); |