mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
Merge pull request #5915 from jjaffeux/sharing-macos-chrome
FIX: sharing popup not showing on macos/chrome
This commit is contained in:
@ -83,10 +83,7 @@ export default Ember.Component.extend({
|
|||||||
|
|
||||||
_webShare(url) {
|
_webShare(url) {
|
||||||
// We can pass title and text too, but most share targets do their own oneboxing
|
// We can pass title and text too, but most share targets do their own oneboxing
|
||||||
navigator.share({
|
return navigator.share({ url });
|
||||||
url: url
|
|
||||||
})
|
|
||||||
.catch((error) => console.warn('Error sharing', error));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
@ -118,7 +115,13 @@ export default Ember.Component.extend({
|
|||||||
// use native webshare only when the user clicks on the "chain" icon
|
// use native webshare only when the user clicks on the "chain" icon
|
||||||
// navigator.share needs HTTPS, returns undefined on HTTP
|
// navigator.share needs HTTPS, returns undefined on HTTP
|
||||||
if (navigator.share && !$currentTarget.hasClass('post-date')) {
|
if (navigator.share && !$currentTarget.hasClass('post-date')) {
|
||||||
this._webShare(url);
|
this._webShare(url)
|
||||||
|
.catch(error => {
|
||||||
|
console.warn('Error sharing', error);
|
||||||
|
|
||||||
|
// if navigator fails for unexpected reason fallback to popup
|
||||||
|
this._showUrl($currentTarget, url);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this._showUrl($currentTarget, url);
|
this._showUrl($currentTarget, url);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user