polyfill tripRight for IE11. fix #783

This commit is contained in:
Anton Lavrenov
2019-11-08 11:45:17 -05:00
parent bb68b3f1a8
commit 61936af059
4 changed files with 62 additions and 1333 deletions

View File

@@ -94,6 +94,11 @@ function checkDefaultFill(config) {
return config;
}
// polyfill for IE11
const trimRight = String.prototype.trimRight || function polyfill() {
return this.replace(/[\s\xa0]+$/, '');
}
/**
* Text constructor
* @constructor
@@ -461,7 +466,7 @@ export class Text extends Shape<TextConfig> {
}
}
// if (align === 'right') {
match = match.trimRight();
match = trimRight.call(match);
// }
this._addTextLine(match);
textWidth = Math.max(textWidth, matchWidth);