@royaloperahouse/chord 1.9.0-c-chord-development → 1.10.0-a-chord-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/dist/chord.cjs.development.js +17 -3
- package/dist/chord.cjs.development.js.map +1 -1
- package/dist/chord.cjs.production.min.js +1 -1
- package/dist/chord.cjs.production.min.js.map +1 -1
- package/dist/chord.esm.js +17 -3
- package/dist/chord.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4440,17 +4440,31 @@ var stripAllHtmlTags = function stripAllHtmlTags(htmlString) {
|
|
|
4440
4440
|
return htmlString.replace(/<[^>]*>/g, '');
|
|
4441
4441
|
};
|
|
4442
4442
|
|
|
4443
|
+
var getAllMatches = function getAllMatches(str, regExp) {
|
|
4444
|
+
var allMatches = [];
|
|
4445
|
+
var match;
|
|
4446
|
+
|
|
4447
|
+
while (match = regExp.exec(str)) {
|
|
4448
|
+
allMatches.push({
|
|
4449
|
+
value: match[0],
|
|
4450
|
+
index: match.index
|
|
4451
|
+
});
|
|
4452
|
+
}
|
|
4453
|
+
|
|
4454
|
+
return allMatches;
|
|
4455
|
+
};
|
|
4456
|
+
|
|
4443
4457
|
var insertString = function insertString(mainString, str, position) {
|
|
4444
4458
|
return "" + mainString.substring(0, position) + str + mainString.substring(position);
|
|
4445
4459
|
};
|
|
4446
4460
|
|
|
4447
4461
|
var insertHtmlTags = function insertHtmlTags(strWithTags, strWithoutTags, resultLength) {
|
|
4448
|
-
var htmlTagPositions =
|
|
4462
|
+
var htmlTagPositions = getAllMatches(strWithTags, new RegExp(TEXT_STYLE_HTML_TAGS_REGEXP, 'g'));
|
|
4449
4463
|
var tagsLength = 0;
|
|
4450
4464
|
var resultString = strWithoutTags;
|
|
4451
4465
|
htmlTagPositions.forEach(function (tag) {
|
|
4452
|
-
resultString = insertString(resultString, tag
|
|
4453
|
-
if (tag.index - tagsLength <= resultLength) tagsLength += tag
|
|
4466
|
+
resultString = insertString(resultString, tag.value, tag.index);
|
|
4467
|
+
if (tag.index - tagsLength <= resultLength) tagsLength += tag.value.length;
|
|
4454
4468
|
});
|
|
4455
4469
|
return {
|
|
4456
4470
|
stringWithInsertedTags: resultString,
|