Obsidian-Code-Styler icon indicating copy to clipboard operation
Obsidian-Code-Styler copied to clipboard

Bug: Add option to disable Copy button, cuz it have conflict with theme and builtin feature

Open Kol9yN opened this issue 1 year ago • 9 comments

Describe the bug

Steps to reproduce

Hover cursor on copy button

Yes

```mysql
select * from user\G
```

Expected behavior

Appears on hover and stay

Current behavior

Glitching

Environment

  • Plugin Version:
  • 1.1.7
  • Obsidian Version:
  • 1.7.7
  • Platform:
  • Desktop
  • OS:
  • Win
  • Theme:
  • Phoenix, Default
  • CSS Snippets:
  • Disabled

Screenshots

https://github.com/user-attachments/assets/79594dbb-e468-477e-b213-139adaa389fc

Additional context

No

Kol9yN avatar Jan 26 '25 18:01 Kol9yN

Currently refactoring the plugin! Nearly done! This should be fixed soon. Sorry for the issue! As a temporary workaround you can find the button in a css selector and add display:none if you are confident.

mayurankv avatar Jan 27 '25 12:01 mayurankv

Please, i propose, if it possible, add option to disable plugin Copy button, cuz Obsidian have own without sliding animation, and i think, it looks more convenient

Kol9yN avatar Jan 27 '25 14:01 Kol9yN

I am currently upgrading the plugin as I mentioned. Obsidian updated the copy button since I last updated this plugin so the styling doesn't appear to work anymore. I will indeed be upgrading it to match the default setting, and will do this through as little markup as possible, but I want the preview and reading mode copy buttons to look the same which they don't at all in default obsidian. I hope that makes sense.

mayurankv avatar Jan 27 '25 21:01 mayurankv

What I mean to say is it's unlikely I'll completely leave the default copy button, but I will try and do as minimal changes to make them appear consistent in both live preview and reading mode. I do plan on removing the sliding feature though!

mayurankv avatar Jan 27 '25 21:01 mayurankv

@mayurankv I'm also waiting for this issue to be resolved. I'm not sure how to temporarily disable this button using CSS. Could you please explain?

MrSergioRodrigo avatar Mar 01 '25 15:03 MrSergioRodrigo

I wrote this CSS code snippet, it's useful for me. Hope it helps you. @Kol9yN @MrSergioRodrigo

/* remove "code-styler" copy button  */
body pre.code-styler-pre:has(.code-styler-header-container-hidden) button.copy-code-button, 
body .markdown-source-view :not(pre.code-styler-pre) > .code-styler-header-container-hidden + .HyperMD-codeblock-begin span.code-block-flair{
  display: none !important; 
}

Obsidian version: 1.8.7 theme: minimal

lasterX avatar Mar 19 '25 09:03 lasterX

@lasterX Thanks, but unfortunately it didn't work for me. If I use this snippet, the copy buttons disappear altogether.

I tried the same version as you have 1.8.7, and even tried to put the theme minimal

MrSergioRodrigo avatar Mar 20 '25 19:03 MrSergioRodrigo

i think just need to wait until project owner rework it

Kol9yN avatar Mar 21 '25 11:03 Kol9yN

Hi sorry, I recently started a new job and haven't had the time to complete the refactor which solves this issue, will try and get back to it soon :((

mayurankv avatar Mar 21 '25 11:03 mayurankv