mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
polyfill tripRight for IE11. fix #783
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user