mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
Don't use trimRight since it isn't supported in IE
This commit is contained in:
parent
39ac0a69fe
commit
a6f6f4df8a
@ -141,12 +141,12 @@ class LineWrapper extends EventEmitter
|
||||
lh = @document.currentLineHeight(true)
|
||||
if @height? and @ellipsis and @document.y + lh * 2 > @maxY and @column >= @columns
|
||||
@ellipsis = '…' if @ellipsis is true # map default ellipsis character
|
||||
buffer = buffer.trimRight()
|
||||
buffer = buffer.replace(/\s+$/, '')
|
||||
textWidth = @wordWidth buffer + @ellipsis
|
||||
|
||||
# remove characters from the buffer until the ellipsis fits
|
||||
while textWidth > @lineWidth
|
||||
buffer = buffer.slice(0, -1).trimRight()
|
||||
buffer = buffer.slice(0, -1).replace(/\s+$/, '')
|
||||
textWidth = @wordWidth buffer + @ellipsis
|
||||
|
||||
buffer = buffer + @ellipsis
|
||||
|
||||
@ -182,7 +182,7 @@ module.exports =
|
||||
if options.width
|
||||
switch align
|
||||
when 'right'
|
||||
textWidth = @widthOfString text.trimRight(), options
|
||||
textWidth = @widthOfString text.replace(/\s+$/, ''), options
|
||||
x += options.lineWidth - textWidth
|
||||
|
||||
when 'center'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user