feat: add code block copy feature
This commit is contained in:
parent
b46e1edb90
commit
5ec1f7c8fb
|
@ -0,0 +1,74 @@
|
|||
disable-user-select() {
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.highlight-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.highlight-container:hover .copy-btn, .highlight-container .copy-btn:focus {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
color: #333;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
line-height: 1.6;
|
||||
opacity: 0;
|
||||
outline: 0;
|
||||
padding: 2px 6px;
|
||||
position: absolute;
|
||||
vertical-align: middle;
|
||||
white-space: nowrap;
|
||||
disable-user-select();
|
||||
the-transition();
|
||||
|
||||
if (hexo-config('codeblock.style') == 'flat') {
|
||||
background: white;
|
||||
border: 0;
|
||||
font-size: 0.8em;
|
||||
right: 0;
|
||||
top: 0;
|
||||
} else if (hexo-config('codeblock.style') == 'mac') {
|
||||
color: white;
|
||||
font-size: 1em;
|
||||
right: 2px;
|
||||
top: 2px;
|
||||
} else {
|
||||
background-color: #eee;
|
||||
background-image: linear-gradient(#fcfcfc, #eee);
|
||||
border: 1px solid #d5d5d5;
|
||||
border-radius: 3px;
|
||||
font-size: 0.8em;
|
||||
right: 6px;
|
||||
top: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (hexo-config('codeblock.style') == 'mac') {
|
||||
.highlight-container {
|
||||
background: #21252b;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 10px 30px 0 rgba(0, 0, 0, .4);
|
||||
padding-top: 20px;
|
||||
margin-top: 10px;
|
||||
|
||||
&::before {
|
||||
background: #fc625d;
|
||||
border-radius: 50%;
|
||||
box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
|
||||
content: ' ';
|
||||
height: 12px;
|
||||
left: 12px;
|
||||
margin-top: -10px;
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue