Set text and URL separately for `navigator.share`
Apparently for most mobile OSses `url` is a required share option
This commit is contained in:
parent
dc8c5fbf82
commit
8b86e2f123
|
@ -3,9 +3,7 @@
|
|||
require "cgi"
|
||||
|
||||
class Ajax::AnswerController < AjaxController
|
||||
include SocialHelper::TwitterMethods
|
||||
include SocialHelper::TumblrMethods
|
||||
include SocialHelper::TelegramMethods
|
||||
include SocialHelper
|
||||
|
||||
def create
|
||||
params.require :id
|
||||
|
@ -73,6 +71,8 @@ class Ajax::AnswerController < AjaxController
|
|||
private
|
||||
|
||||
def sharing_hash(answer) = {
|
||||
url: answer_share_url(answer),
|
||||
text: prepare_tweet(answer, nil, true),
|
||||
twitter: twitter_share_url(answer),
|
||||
tumblr: tumblr_share_url(answer),
|
||||
telegram: telegram_share_url(answer),
|
||||
|
|
|
@ -32,7 +32,8 @@ export function answerEntryHandler(event: Event): void {
|
|||
|
||||
const shareButton = inboxEntry.querySelector<HTMLButtonElement>('[data-controller="share"]');
|
||||
if (shareButton != null) {
|
||||
shareButton.dataset.shareTextValue = decodeURIComponent(data.sharing.custom).replaceAll('+', ' ');
|
||||
shareButton.dataset.shareUrlValue = data.sharing.url;
|
||||
shareButton.dataset.shareTextValue = data.sharing.text;
|
||||
}
|
||||
|
||||
const sharing = inboxEntry.querySelector<HTMLElement>('.inbox-entry__sharing');
|
||||
|
|
Loading…
Reference in New Issue