Code Monkey home page Code Monkey logo

Comments (10)

valentine195 avatar valentine195 commented on June 22, 2024 2

4.1.0

Added a copy content setting. This setting adds a "copy" button to all admonitions.

from admonitions.

valentine195 avatar valentine195 commented on June 22, 2024 2

Should be fixed in 4.1.4

from admonitions.

valentine195 avatar valentine195 commented on June 22, 2024 1

4.1.3

  • Trims whitespace from content when copied to clipboard

from admonitions.

valentine195 avatar valentine195 commented on June 22, 2024 1

Oh no! Obsidian v0.12.3 released with an updated chromium that deprecated that selector, so I updated it to the correct one. Guess I shouldn't have removed the old one, oops 😳

from admonitions.

MartynKeigher avatar MartynKeigher commented on June 22, 2024

Hey @valentine195 - Thank you so much for adding this feature... and wow.. quick turnaround!! :)

Amazing time save for me and it works great!

I was playing around with some CSS and I was looking to have the icon appear only when it's hovered over, but as the icon is small... I was wanting the 'content' area to trigger the opacity change... Here is my current code, that while it works.. only 'reveal's the icon when hover over IT, what addition do I need to the make to the following code snippet so that when I hover over the content area... it then shows the copy icon?

/*********************/
/* Admonition tweak  */
/*********************/

.admonition-content {
  padding-top: 15px;
}

.admonition-content-copy {
  margin: 15px 0px;
  opacity: 0;
  transition: 0.2s all ease-in;
}

.admonition-content-copy:hover {
  opacity: 1;
}

You can ignore the 'padding-top', that was just to add a little space between the content and the title border. (Makes the text appear more 'centrally' (vertically) in its area.

image

Thanks so much!

from admonitions.

valentine195 avatar valentine195 commented on June 22, 2024
.admonition-content:hover > .admonition-content-copy,
.admonition-content-copy:hover {
    opacity: 1;
}

Will show the admonition when hovering over the admonition-content div.

However: The admonition content div is not the entire box at the bottom, due to a quirk with how the admonition is built. What you would probably want is something more like this:

.admonition:hover  .admonition-content-copy,
.admonition-content-copy:hover {
    opacity: 1;
}

from admonitions.

valentine195 avatar valentine195 commented on June 22, 2024

Also, the margin you have set on the .admonition-content-copy class will cause it to render 15px from the top of block. Not sure if that's what you were intending.

If you want it centered on the content box, try this:

.admonition-content-copy {
    margin: 0px;
    top: 50%;
    transform: translateY(-50%);
    /* ... */
}

from admonitions.

MartynKeigher avatar MartynKeigher commented on June 22, 2024

hmm.. still not quite how i intended it, but.. I'm ok leaving this snippet as is for now (for the padding!)

Your note on the 'on-hover' though.. worked like a charm!! :)

/********************/
/* Admonition tweak */
/********************/

.admonition-content {
  padding-top: 15px;
}

.admonition-content-copy {
  margin: 15px 10px;
  opacity: 0;
  transition: 0.4s all ease-in;
}

.admonition-content:hover > .admonition-content-copy,
.admonition-content-copy:hover {
  opacity: 1;
}

As for the COPY function, I'm noticing that there is a trailing 'line-break' taken as part of the copy.. can this be removed? or a setting to trim that?

Reason: A lot of my code in my notes are examples, and I'd like to copy my example to cmd\powershell terminal, and then edit them before I execute them. By taking the trailing 'line-break' that actually executes the command as soon as I paste, as it sees the 'line-break' ... as if I'm pressing the ENTER key! ;p

from admonitions.

MartynKeigher avatar MartynKeigher commented on June 22, 2024

Worked liked a charm.. Thank you again! :)

PS: Where did this icon come from ?? ;p
image

from admonitions.

MartynKeigher avatar MartynKeigher commented on June 22, 2024

Confirmed!!

4.1.4
πŸ‘πŸΌ Random icon in top left is GONE!
πŸ‘πŸΌ πŸ‘πŸΌ Copy selection does NOT include the 'line-break', threfore... when pasting into the cmd\powershll terminal, it does not immediately execute when content is pasted!!

You are the man!!! Thank you so so much!! :)

://mk

from admonitions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.