Merge branch 'hotfix/v0.1.9' of https://github.com/ONLYOFFICE/AppServer into hotfix/v0.1.9
This commit is contained in:
commit
eb76b43464
@ -213,3 +213,14 @@ export function clickBackdrop() {
|
||||
elms[0].click();
|
||||
}
|
||||
}
|
||||
|
||||
export default function objectToGetParams(object) {
|
||||
const params = Object.entries(object)
|
||||
.filter(([, value]) => value !== undefined && value !== null)
|
||||
.map(
|
||||
([key, value]) =>
|
||||
`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`
|
||||
);
|
||||
|
||||
return params.length > 0 ? `?${params.join("&")}` : "";
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import AccessComboBox from "./AccessComboBox";
|
||||
//import equal from "fast-deep-equal/react";
|
||||
import { getAccessIcon } from "../../../helpers/files-helpers";
|
||||
import { ReactSVG } from "react-svg";
|
||||
import objectToGetParams from "@appserver/common/utils";
|
||||
|
||||
class SharingRow extends React.Component {
|
||||
constructor(props) {
|
||||
@ -49,19 +50,42 @@ class SharingRow extends React.Component {
|
||||
const subject = t("ShareEmailSubject", { itemName });
|
||||
const body = t("ShareEmailBody", { itemName, shareLink });
|
||||
|
||||
window.open(`mailto:?subject=${subject}&body=${body}`);
|
||||
const mailtoLink =
|
||||
"mailto:" +
|
||||
objectToGetParams({
|
||||
subject,
|
||||
body,
|
||||
});
|
||||
|
||||
window.open(mailtoLink);
|
||||
};
|
||||
|
||||
onShareTwitter = () => {
|
||||
const encodedLink = encodeURIComponent(this.props.item.sharedTo.shareLink);
|
||||
window.open(`https://twitter.com/intent/tweet?text=${encodedLink}`);
|
||||
const { item } = this.props;
|
||||
const { shareLink } = item.sharedTo;
|
||||
|
||||
const twitterLink =
|
||||
"https://twitter.com/intent/tweet" +
|
||||
objectToGetParams({
|
||||
text: shareLink,
|
||||
});
|
||||
|
||||
window.open(twitterLink);
|
||||
};
|
||||
|
||||
onShareFacebook = () => {
|
||||
window.open(
|
||||
`https://www.facebook.com/sharer/sharer.php?u=${this.props.item.sharedTo.shareLink}`
|
||||
);
|
||||
};
|
||||
// onShareFacebook = () => {
|
||||
// const { item, selection } = this.props;
|
||||
// const { shareLink } = item.sharedTo;
|
||||
|
||||
// const facebookLink =
|
||||
// "https://www.facebook.com/sharer/sharer.php" +
|
||||
// objectToGetParams({
|
||||
// u: shareLink,
|
||||
// t: selection.title ? selection.title : selection[0].title,
|
||||
// });
|
||||
|
||||
// window.open(facebookLink);
|
||||
// };
|
||||
|
||||
render() {
|
||||
//console.log("SharingRow render");
|
||||
@ -120,11 +144,11 @@ class SharingRow extends React.Component {
|
||||
label: `${t("ShareVia")} e-mail`,
|
||||
onClick: this.onShareEmail,
|
||||
},
|
||||
{
|
||||
key: "linkItem_3",
|
||||
label: `${t("ShareVia")} Facebook`,
|
||||
onClick: this.onShareFacebook,
|
||||
},
|
||||
// {
|
||||
// key: "linkItem_3",
|
||||
// label: `${t("ShareVia")} Facebook`,
|
||||
// onClick: this.onShareFacebook,
|
||||
// },
|
||||
{
|
||||
key: "linkItem_4",
|
||||
label: `${t("ShareVia")} Twitter`,
|
||||
|
Loading…
Reference in New Issue
Block a user