mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
fix(ui): update share feature to correctly select title element and handle empty title
This commit is contained in:
parent
87fccfee3a
commit
969efd2af7
1 changed files with 2 additions and 2 deletions
|
@ -721,7 +721,7 @@ function isPlayerPlaying(element) {
|
||||||
*/
|
*/
|
||||||
function handleShare() {
|
function handleShare() {
|
||||||
const link = document.querySelector(':is(a, button)[data-share-status]');
|
const link = document.querySelector(':is(a, button)[data-share-status]');
|
||||||
const title = document.querySelector("body > main > section > header > h1 > a");
|
const title = document.querySelector(".entry-header > h1 > a");
|
||||||
if (link.dataset.shareStatus === "shared") {
|
if (link.dataset.shareStatus === "shared") {
|
||||||
checkShareAPI(title, link.href);
|
checkShareAPI(title, link.href);
|
||||||
}
|
}
|
||||||
|
@ -746,7 +746,7 @@ function checkShareAPI(title, url) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
navigator.share({
|
navigator.share({
|
||||||
title: title,
|
title: title ? title.textContent : url,
|
||||||
url: url
|
url: url
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue