mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-29 08:21:30 +00:00
Merge pull request #165 from lbryio/fix-clamp-js-firefox
Fix line clamping on Firefox
This commit is contained in:
commit
227e23653d
3 changed files with 12 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import lbry from '../lbry.js';
|
import lbry from '../lbry.js';
|
||||||
import $clamp from 'clamp-js';
|
import $clamp from 'clamp-js-main';
|
||||||
|
|
||||||
//component/icon.js
|
//component/icon.js
|
||||||
export let Icon = React.createClass({
|
export let Icon = React.createClass({
|
||||||
|
@ -31,13 +31,17 @@ export let TruncatedText = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
// Manually round up the line height, because clamp.js doesn't like fractional-pixel line heights.
|
||||||
|
|
||||||
|
// Need to work directly on the style object because setting the style prop doesn't update internal styles right away.
|
||||||
|
this.refs.span.style.lineHeight = Math.ceil(parseFloat(getComputedStyle(this.refs.span).lineHeight)) + 'px';
|
||||||
|
|
||||||
$clamp(this.refs.span, {
|
$clamp(this.refs.span, {
|
||||||
clamp: this.props.lines || this.props.height || 'auto',
|
clamp: this.props.lines || this.props.height || 'auto',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var text = this.props.children;
|
return <span ref="span" className="truncated-text">{this.props.children}</span>;
|
||||||
return <span ref="span">{text}</span>;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
"babel-cli": "^6.11.4",
|
"babel-cli": "^6.11.4",
|
||||||
"babel-preset-es2015": "^6.13.2",
|
"babel-preset-es2015": "^6.13.2",
|
||||||
"babel-preset-react": "^6.11.1",
|
"babel-preset-react": "^6.11.1",
|
||||||
"clamp-js": "^0.7.0",
|
"clamp-js-main": "^0.11.1",
|
||||||
"mediaelement": "^2.23.4",
|
"mediaelement": "^2.23.4",
|
||||||
"node-sass": "^3.8.0",
|
"node-sass": "^3.8.0",
|
||||||
"react": "^15.4.0",
|
"react": "^15.4.0",
|
||||||
|
|
|
@ -121,6 +121,10 @@ input[type="text"], input[type="search"]
|
||||||
height: $spacing-vertical * 1.5;
|
height: $spacing-vertical * 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.truncated-text {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
.busy-indicator
|
.busy-indicator
|
||||||
{
|
{
|
||||||
background: url('../img/busy.gif') no-repeat center center;
|
background: url('../img/busy.gif') no-repeat center center;
|
||||||
|
|
Loading…
Add table
Reference in a new issue