@selfcommunity/react-ui 0.7.13 → 0.7.14-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -397,11 +397,10 @@ function FeedObject(inProps) {
397
397
  ? (0, contribution_1.getContributionHtml)(obj.html, scRoutingContext.url)
398
398
  : (0, contribution_1.getContributionHtml)(contributionHtml, scRoutingContext.url);
399
399
  if (template === feedObject_1.SCFeedObjectTemplateType.SHARE) {
400
- return (react_1.default.createElement(react_1.default.Fragment, null,
401
- react_1.default.createElement(react_core_1.Link, { to: scRoutingContext.url((0, contribution_1.getContributionRouteName)(obj), (0, contribution_1.getRouteData)(obj)), className: classes.text },
402
- react_1.default.createElement(material_1.Typography, { component: "div", className: classes.text, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: {
403
- __html: summaryHtml
404
- } })),
400
+ return (react_1.default.createElement(react_core_1.Link, { to: scRoutingContext.url((0, contribution_1.getContributionRouteName)(obj), (0, contribution_1.getRouteData)(obj)), className: classes.text },
401
+ react_1.default.createElement(material_1.Typography, { component: "span", className: classes.text, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: {
402
+ __html: summaryHtml
403
+ } }),
405
404
  !expanded && summaryHtmlTruncated && (react_1.default.createElement(material_1.Button, { size: "small", variant: "text", color: "inherit", className: classes.showMore, onClick: handleToggleSummary },
406
405
  react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feedObject.content.showMore", defaultMessage: "ui.feedObject.content.showMore" })))));
407
406
  }
@@ -58,8 +58,9 @@ exports.getContributionSnippet = getContributionSnippet;
58
58
  * @param handleUrl Func that handle urls
59
59
  */
60
60
  function getContributionHtml(html, handleUrl) {
61
- return html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_]+)<\/mention>/gi, (match, id, username) => {
62
- return `<a href='${handleUrl(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, { id, username })}'>@${username}</a>`;
61
+ const _html = html.replace(/<p\b[^>]*>(.*?)<\/p>/g, (match, content) => content);
62
+ return _html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_]+)<\/mention>/gi, (match, id, username) => {
63
+ return `<a href='${handleUrl(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, { id, username })}'>@${username}</a><button>Altro</button>`;
63
64
  });
64
65
  }
65
66
  exports.getContributionHtml = getContributionHtml;
@@ -395,11 +395,10 @@ export default function FeedObject(inProps) {
395
395
  ? getContributionHtml(obj.html, scRoutingContext.url)
396
396
  : getContributionHtml(contributionHtml, scRoutingContext.url);
397
397
  if (template === SCFeedObjectTemplateType.SHARE) {
398
- return (React.createElement(React.Fragment, null,
399
- React.createElement(Link, { to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)), className: classes.text },
400
- React.createElement(Typography, { component: "div", className: classes.text, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: {
401
- __html: summaryHtml
402
- } })),
398
+ return (React.createElement(Link, { to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)), className: classes.text },
399
+ React.createElement(Typography, { component: "span", className: classes.text, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: {
400
+ __html: summaryHtml
401
+ } }),
403
402
  !expanded && summaryHtmlTruncated && (React.createElement(Button, { size: "small", variant: "text", color: "inherit", className: classes.showMore, onClick: handleToggleSummary },
404
403
  React.createElement(FormattedMessage, { id: "ui.feedObject.content.showMore", defaultMessage: "ui.feedObject.content.showMore" })))));
405
404
  }
@@ -51,8 +51,9 @@ export function getContributionSnippet(obj) {
51
51
  * @param handleUrl Func that handle urls
52
52
  */
53
53
  export function getContributionHtml(html, handleUrl) {
54
- return html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_]+)<\/mention>/gi, (match, id, username) => {
55
- return `<a href='${handleUrl(SCRoutes.USER_PROFILE_ROUTE_NAME, { id, username })}'>@${username}</a>`;
54
+ const _html = html.replace(/<p\b[^>]*>(.*?)<\/p>/g, (match, content) => content);
55
+ return _html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_]+)<\/mention>/gi, (match, id, username) => {
56
+ return `<a href='${handleUrl(SCRoutes.USER_PROFILE_ROUTE_NAME, { id, username })}'>@${username}</a><button>Altro</button>`;
56
57
  });
57
58
  }
58
59
  /**