From 8e9ef31e4fbaa5e071b67af0738a53628bec9332 Mon Sep 17 00:00:00 2001 From: Michal Vavra Date: Sun, 27 Aug 2023 01:42:44 +0200 Subject: [PATCH] fix: click triggering other events --- src/main.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 7f0bd08..7207006 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,8 +16,9 @@ export default class CopyInlineCodePlugin extends Plugin { const icon = createSpan({cls: "copy-to-clipboard-icon", text: "\xa0📋"}) const textToCopy = code.textContent - icon.onclick = () => { + icon.onclick = (event) => { if(textToCopy) { + event.stopPropagation(); navigator.clipboard.writeText(textToCopy) new Notice(`Copied '${textToCopy}' to clipboard!`); }