Skip to content

Commit

Permalink
🐛 Fix: 分享按钮只能复制uri
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhuz committed Aug 28, 2022
1 parent e696553 commit f9a9470
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion post.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>
<#if settings.allow_share!true>
<div class="share-items">
<a class="share-link" href="javascript:;" data-clipboard-text="${post.fullPath!}"
<a class="share-link share-item" href="javascript:;" data-clipboard-text="${post.fullPath!}"
rel="noopener noreferrer" title="复制文章链接">
<span class="iconfont icon-round_link_fill text-3xl"></span>
</a>
Expand Down
7 changes: 7 additions & 0 deletions source/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ const xueContext = {
shareBtn: function () {
var clipboard = new ClipboardJS('.share-link');
clipboard.on('success', function (e) {
console.log(111)
Qmsg.success('Copy article link success.');
e.clearSelection();
});
Expand All @@ -379,6 +380,12 @@ const xueContext = {
var $e = $(e)
var href = $e.attr('href')
$e.attr('href', href.replace('{url}', url))

var text = $e.attr('data-clipboard-text')

if (text) {
$e.attr('data-clipboard-text', url)
}
});

},
Expand Down
12 changes: 4 additions & 8 deletions src/styles/photos.less
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
position: relative;
display: block;
width: auto;
cursor: pointer;
}

.masonry-gallery .gallery-item {
Expand All @@ -51,12 +52,6 @@
margin-bottom: 10px;
}


//.gallery-icon img {
// width: 100%;
// height: auto;
//}

.gallery-caption {
position: absolute;
left: 0;
Expand All @@ -80,9 +75,10 @@
.masonry-gallery .gallery-caption .entry-summary {
text-align: center;
bottom: 0;
padding: 1em;
padding: .8rem;
font-size: .8em;
color: #f7f6f5;
background-color: #ffffff;
}

.gallery-caption h3, .gallery-caption p {
Expand All @@ -105,7 +101,7 @@
}

.masonry-gallery .gallery-item:hover .gallery-icon {
opacity: .3;
opacity: .7;
}

.gallery-item:hover .gallery-caption h3, .gallery-item:hover .gallery-caption p {
Expand Down

0 comments on commit f9a9470

Please sign in to comment.