react-line-clamp
Advanced tools
Comparing version 1.2.5 to 1.2.6
13
Clamp.js
@@ -61,3 +61,3 @@ 'use strict'; | ||
key: 'adjustContext', | ||
value: function adjustContext() { | ||
value: function adjustContext(callback) { | ||
var _this2 = this; | ||
@@ -100,2 +100,3 @@ | ||
_this2.refs.context.innerHTML = _text.slice(0, mid - 1) + ellipsis; | ||
typeof callback === 'function' && callback(); | ||
} | ||
@@ -117,8 +118,12 @@ }; | ||
var prevWidthOfWrap = null; | ||
var prevHeightOfWrap = null; | ||
this.adjustIntervalHandler = setInterval(function () { | ||
var widthOfWrap = _this3._getWrapRect_().width; | ||
var heightOfWrap = _this3._getWrapRect_().height; | ||
if (prevWidthOfWrap !== widthOfWrap) { | ||
_this3.adjustContext(); | ||
prevWidthOfWrap = widthOfWrap; | ||
if (prevWidthOfWrap !== widthOfWrap || prevHeightOfWrap !== heightOfWrap) { | ||
_this3.adjustContext(function () { | ||
prevWidthOfWrap = widthOfWrap; | ||
prevHeightOfWrap = heightOfWrap; | ||
}); | ||
} | ||
@@ -125,0 +130,0 @@ }, this.autoAdjustInterval); |
{ | ||
"name": "react-line-clamp", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "A react component which can help you implememt line-clamp automatically", | ||
@@ -5,0 +5,0 @@ "main": "Clamp.js", |
@@ -27,3 +27,3 @@ import React from 'react'; | ||
<div className="column"> | ||
<Clamp className="card" ref="bCard"> | ||
<Clamp className="card" ref="bCard" ellipsis="***"> | ||
Brisbane’s Waterfront Place and theBrisbane’s Waterfront Place and theBrisbane’s Waterfront Place and theBrisbane’s Waterfront Place and theBrisbane’s Waterfront Place and theBrisbane’s Waterfront Place and the | ||
@@ -56,2 +56,62 @@ </Clamp> | ||
</div> | ||
<div> | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
</div> | ||
<div> | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
</div> | ||
<div> | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
“Waterfront Place complements our ownership of 480 Queen Street in Brisbane and reinforces our role as a workspace partner for our customers.” | ||
</div> | ||
</div> | ||
@@ -58,0 +118,0 @@ </Clamp> |
@@ -28,3 +28,3 @@ import React from 'react'; | ||
adjustContext() { | ||
adjustContext(callback) { | ||
this.refs.context.innerHTML = this.rawContextText; | ||
@@ -63,2 +63,3 @@ | ||
this.refs.context.innerHTML = _text.slice(0, mid - 1) + ellipsis; | ||
typeof callback === 'function' && callback(); | ||
} | ||
@@ -77,8 +78,12 @@ }; | ||
let prevWidthOfWrap = null; | ||
let prevHeightOfWrap = null; | ||
this.adjustIntervalHandler = setInterval(() => { | ||
const widthOfWrap = this._getWrapRect_().width; | ||
const heightOfWrap = this._getWrapRect_().height; | ||
if (prevWidthOfWrap !== widthOfWrap) { | ||
this.adjustContext(); | ||
prevWidthOfWrap = widthOfWrap; | ||
if (prevWidthOfWrap !== widthOfWrap || prevHeightOfWrap !== heightOfWrap) { | ||
this.adjustContext(() => { | ||
prevWidthOfWrap = widthOfWrap; | ||
prevHeightOfWrap = heightOfWrap; | ||
}); | ||
} | ||
@@ -85,0 +90,0 @@ |
160886
397