mirror of
https://github.com/ozavodny/obsidian-copy-inline-code-plugin.git
synced 2026-07-22 08:10:25 +00:00
fix: click triggering other events
This commit is contained in:
parent
e3cca040c7
commit
8e9ef31e4f
1 changed files with 2 additions and 1 deletions
|
|
@ -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!`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue