Comparing version
@@ -19,3 +19,3 @@ "use strict"; | ||
_global: exports.glob, | ||
version: '9.3.17', | ||
version: '9.3.18', | ||
isBrowser: detectBrowser(), | ||
@@ -22,0 +22,0 @@ isUnminified: /param/.test(function (param) { }.toString()), |
@@ -14,4 +14,6 @@ "use strict"; | ||
if (/\p{Emoji}/u.test(char)) { | ||
if (acc.length > 0 && /\p{Emoji}/u.test(acc[acc.length - 1])) { | ||
acc[acc.length - 1] += char; | ||
const nextChar = array[index + 1]; | ||
if (nextChar && /\p{Emoji_Modifier}|\u200D/u.test(nextChar)) { | ||
acc.push(char + nextChar); | ||
array[index + 1] = ''; | ||
} | ||
@@ -28,3 +30,3 @@ else { | ||
} | ||
else { | ||
else if (char) { | ||
acc.push(char); | ||
@@ -303,5 +305,5 @@ } | ||
while (line.length > 0) { | ||
let low = 0, high = line.length, match = '', matchWidth = 0; | ||
let low = 0, high = stringToArray(line).length, match = '', matchWidth = 0; | ||
while (low < high) { | ||
const mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth; | ||
const mid = (low + high) >>> 1, lineArray = stringToArray(line), substr = lineArray.slice(0, mid + 1).join(''), substrWidth = this._getTextWidth(substr) + additionalWidth; | ||
if (substrWidth <= maxWidth) { | ||
@@ -318,16 +320,18 @@ low = mid + 1; | ||
if (wrapAtWord) { | ||
var wrapIndex; | ||
const nextChar = line[match.length]; | ||
const lineArray = stringToArray(line); | ||
const matchArray = stringToArray(match); | ||
const nextChar = lineArray[matchArray.length]; | ||
const nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH; | ||
let wrapIndex; | ||
if (nextIsSpaceOrDash && matchWidth <= maxWidth) { | ||
wrapIndex = match.length; | ||
wrapIndex = matchArray.length; | ||
} | ||
else { | ||
wrapIndex = | ||
Math.max(match.lastIndexOf(SPACE), match.lastIndexOf(DASH)) + | ||
1; | ||
const lastSpaceIndex = matchArray.lastIndexOf(SPACE); | ||
const lastDashIndex = matchArray.lastIndexOf(DASH); | ||
wrapIndex = Math.max(lastSpaceIndex, lastDashIndex) + 1; | ||
} | ||
if (wrapIndex > 0) { | ||
low = wrapIndex; | ||
match = match.slice(0, low); | ||
match = lineArray.slice(0, low).join(''); | ||
matchWidth = this._getTextWidth(match); | ||
@@ -345,4 +349,4 @@ } | ||
} | ||
line = line.slice(low); | ||
line = line.trimLeft(); | ||
const lineArray = stringToArray(line); | ||
line = lineArray.slice(low).join('').trimLeft(); | ||
if (line.length > 0) { | ||
@@ -349,0 +353,0 @@ lineWidth = this._getTextWidth(line); |
{ | ||
"name": "konva", | ||
"version": "9.3.17", | ||
"version": "9.3.18", | ||
"description": "HTML5 2d canvas library.", | ||
@@ -5,0 +5,0 @@ "author": "Anton Lavrenov", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1416203
0.09%32787
0.04%