@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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [1.10.0-a]
4
+ - ContentSummary: make image clickable
5
+
3
6
  ## [1.9.0-c]
4
7
  - ContentSummary: make image clickable
5
8
 
@@ -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 = Array.from(strWithTags.matchAll(new RegExp(TEXT_STYLE_HTML_TAGS_REGEXP, 'g')));
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[0], tag.index);
4453
- if (tag.index - tagsLength <= resultLength) tagsLength += tag[0].length;
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,