A small library to split text and add additional words under the condition of Specified lines
npm install text-overflowA small library to split text and add additional html under the condition of Specified lines
javascript
const textOverflow = require('text-overflow')
textOverflow(node, options)
`
demo website
演示网址
node
容器节点,需要被文本截断的元素
a container node which the html will be cutted
options
$3
容器节点中应该被插入的html文本
the html which should be inserted to the container node
$3
需要被补全的html文本
the html which should be added to the origin html
$3
容器节点的最大宽度
the max width of the container node
$3
允许的最大行数
the max line number
$3
是否允许有空行
is empty line should be allowed
caution
容器节点的css样式必须设置以下属性
the css of the container node must have following props
` css
.container-node {
white-space: pre-wrap;
word-break: break-all;
word-wrap: break-word;
// you alse should to set an accuralte width
}
``