diff --git a/script.js b/script.js index 562d8bc..52327eb 100644 --- a/script.js +++ b/script.js @@ -1678,8 +1678,13 @@ This is a fully client-side application. Your content never leaves your browser exportMd.click(); } if ((e.ctrlKey || e.metaKey) && e.key === "c") { - e.preventDefault(); - copyMarkdownButton.click(); + const activeEl = document.activeElement; + const isTextControl = activeEl && (activeEl.tagName === "TEXTAREA" || activeEl.tagName === "INPUT"); + const hasSelection = window.getSelection && window.getSelection().toString().trim().length > 0; + if (!isTextControl && !hasSelection) { + e.preventDefault(); + copyMarkdownButton.click(); + } } // Story 1.2: Only allow sync toggle shortcut when in split view if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === "S") {