From 09422eac3935cfedd9a97e008a71eb9bfebfc97b Mon Sep 17 00:00:00 2001 From: Cezary Daniel Nowak Date: Wed, 10 Jul 2019 13:54:40 +0200 Subject: [PATCH] 1.3.1 release --- README.md | 4 ++++ demo/dist/index.dist.js | 26 +++++++++++++++++--------- package.json | 2 +- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b8c44e8..0742abd 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/demo/dist/index.dist.js b/demo/dist/index.dist.js index b4be4b7..ea9341e 100644 --- a/demo/dist/index.dist.js +++ b/demo/dist/index.dist.js @@ -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)); } @@ -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) { @@ -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'); @@ -23503,7 +23511,7 @@ Dotdotdot.propTypes = { Dotdotdot.defaultProps = { truncationChar: '\u2026', - useNativeClamp: true, + useNativeClamp: false, tagName: 'div' }; diff --git a/package.json b/package.json index 9e11bd7..365575b 100644 --- a/package.json +++ b/package.json @@ -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",