mirror of https://github.com/requarks/wiki
parent
a197cf7ca9
commit
b6c8cdfb0c
@ -0,0 +1,15 @@
|
||||
.ty-anchor-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: visibility .1s ease, opacity .1s ease;
|
||||
color: mc('grey', '700');
|
||||
}
|
||||
|
||||
.toc-header:hover .ty-anchor-button {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
@ -1 +1,2 @@
|
||||
@import "image";
|
||||
@import "anchor-button";
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
function AnchorCopyButton() {
|
||||
return `
|
||||
<button type="button" class="ty-anchor-button v-btn v-btn--flat v-btn--icon v-btn--round v-size--small" aria-label="Link kopieren">
|
||||
<span class="v-btn__content">
|
||||
<i aria-hidden="true" class="v-icon notranslate mdi mdi-link-variant" style="font-size: 16px"></i>
|
||||
<i aria-hidden="true" class="v-icon notranslate mdi mdi-check-circle" style="font-size: 16px; display: none;"></i>
|
||||
</span>
|
||||
</button>
|
||||
`
|
||||
}
|
||||
|
||||
module.exports = AnchorCopyButton
|
||||
@ -1,13 +1,16 @@
|
||||
const ImageOverlay = require('./components/ImageOverlay')
|
||||
const AnchorCopyButton = require('./components/AnchorCopyButton')
|
||||
|
||||
module.exports = {
|
||||
init($, config) {
|
||||
|
||||
// wrap images
|
||||
$('p > img').each((i, element) => {
|
||||
const src = $(element).attr('src');
|
||||
$(element).wrap(`<div class="ty-image-wrapper"></div>`)
|
||||
$(element).parent().append(ImageOverlay(src))
|
||||
})
|
||||
|
||||
// add anchor button to headlines
|
||||
$('h1,h2,h3,h4,h5,h6').append(AnchorCopyButton())
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue