react-show-more-text 1.4.5 → 1.4.6

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [1.4.6] - 2020-11-01
5
+ ### Fixed
6
+ - [#20](https://github.com/devzonetech/react-show-more-text/issues/20) Incorrect appearance
7
+ - [#23](https://github.com/devzonetech/react-show-more-text/issues/23) Show more/less anchor breaks in case of hash routers
8
+
4
9
  ## [1.4.5] - 2020-10-20
5
10
  ### Fixed
6
11
  - [#12](https://github.com/devzonetech/react-show-more-text/issues/12) className prop for the wrapper div of component content
@@ -131,7 +131,7 @@ var ShowMoreText = /*#__PURE__*/function (_Component) {
131
131
  width: width,
132
132
  lines: !expanded && lines,
133
133
  ellipsis: /*#__PURE__*/_react.default.createElement("span", null, "...", ' ', /*#__PURE__*/_react.default.createElement("a", {
134
- href: "#",
134
+ href: "",
135
135
  className: anchorClass,
136
136
  onClick: this.toggleLines
137
137
  }, more)),
@@ -152,7 +152,7 @@ var ShowMoreText = /*#__PURE__*/function (_Component) {
152
152
  })];
153
153
  }
154
154
  }) : children), !truncated && expanded && /*#__PURE__*/_react.default.createElement("span", null, ' ', /*#__PURE__*/_react.default.createElement("a", {
155
- href: "#",
155
+ href: "",
156
156
  className: anchorClass,
157
157
  onClick: this.toggleLines
158
158
  }, less)));
package/lib/Truncate.js CHANGED
@@ -66,7 +66,6 @@ var Truncate = /*#__PURE__*/function (_React$Component) {
66
66
  _this.replacedLinks = [];
67
67
  content.replace(/(<a[\s]+([^>]+)>((?:.(?!\<\/a\>))*.)<\/a>)/g, function () {
68
68
  var item = Array.prototype.slice.call(arguments, 1, 4);
69
- console.log(item[2]);
70
69
  item.key = '[' + '@'.repeat(item[2].length - 1) + '=' + i++ + ']';
71
70
 
72
71
  _self.replacedLinks.push(item);
@@ -245,6 +244,7 @@ var Truncate = /*#__PURE__*/function (_React$Component) {
245
244
  }
246
245
 
247
246
  ;
247
+ lastLineText = lastLineText.replace(/\[(@)\1{2,}$/, '');
248
248
  lastLineText = restoreReplacedLinks(lastLineText);
249
249
  resultLine = /*#__PURE__*/_react.default.createElement("span", null, lastLineText, ellipsis);
250
250
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-show-more-text",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "The text surrounded by the component will be truncated. Anything surrounded by the component could be evaluated as text. The component react-show-more-text/ShowMoreText is fork of react-show-more/ShowMore, applied improvements, works with React 16.x.x, added onClick event.",
5
5
  "main": "lib/ShowMoreText.js",
6
6
  "files": [