Skip to content

Commit

Permalink
1.3.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
CezaryDanielNowak committed Jul 10, 2019
1 parent aff0f17 commit 09422ea
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Known issues:

Changelog
-----------------
1.3.1
- Update TypeScript definition to add missing props (thanks @tuxracer)
- round line-height value from computed float value - IE11 fix (thanks @YoonjiJang)

1.3.0
- `useNativeClamp` prop is set to false by default, it was causing some issues.
- Comments are not counted as a text anymore
Expand Down
26 changes: 17 additions & 9 deletions demo/dist/index.dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -23237,9 +23237,9 @@ module.exports = function pick(obj, keys) {
if (lh == 'normal') {
// Normal line heights vary from browser to browser. The spec recommends
// a value between 1.0 and 1.2 of the font size. Using 1.1 to split the diff.
lh = parseInt(computeStyle(elem, 'font-size'), 10) * 1.2;
lh = parseFloat(computeStyle(elem, 'font-size')) * 1.2;
}
return parseInt(lh, 10);
return Math.round(parseFloat(lh));
}


Expand All @@ -23259,16 +23259,24 @@ module.exports = function pick(obj, keys) {
//Current element has children, need to go deeper and get last child as a text node
if (elem.lastChild.children && elem.lastChild.children.length > 0) {
return getLastChild(Array.prototype.slice.call(elem.children).pop());
}
//Handle scenario where the last child is white-space node
else if (!elem.lastChild || !elem.lastChild.nodeValue || elem.lastChild.nodeValue === '' || elem.lastChild.nodeValue == opt.truncationChar) {
} else if (
!elem.lastChild
|| !elem.lastChild.nodeValue
|| elem.lastChild.nodeValue == opt.truncationChar
|| elem.lastChild.nodeType === Node.COMMENT_NODE
) {
// Handle scenario where the last child is white-space node
var sibling = elem.lastChild;
do {
if (!sibling) {
return;
}
//TEXT_NODE
if (sibling.nodeType === 3 && ['', opt.truncationChar].indexOf(sibling.nodeValue) === -1) {
// TEXT_NODE
if (
sibling.nodeType === 3
&& ['', opt.truncationChar].indexOf(sibling.nodeValue) === -1
&& elem.lastChild.nodeType !== Node.COMMENT_NODE
) {
return sibling;
}
if (sibling.lastChild) {
Expand Down Expand Up @@ -23457,7 +23465,7 @@ Dotdotdot.prototype.dotdotdot = function(container) {
if (!container) {
return;
}

if (this.props.clamp) {
if (container.length) {
throw new Error('Please provide exacly one child to dotdotdot');
Expand Down Expand Up @@ -23503,7 +23511,7 @@ Dotdotdot.propTypes = {

Dotdotdot.defaultProps = {
truncationChar: '\u2026',
useNativeClamp: true,
useNativeClamp: false,
tagName: 'div'
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-dotdotdot",
"version": "1.3.0",
"version": "1.3.1",
"description": "Multiline text ellipsis for react",
"main": "src/index.js",
"typings": "src/index.d.ts",
Expand Down

0 comments on commit 09422ea

Please sign in to comment.