eat-js-sdk 2.5.7 → 2.5.8

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.
@@ -20002,22 +20002,15 @@ const parseSentences = (rawText) => {
20002
20002
  const segments = [];
20003
20003
  let posIndex = 0;
20004
20004
  for (let pIdx = 0; pIdx < paragraphs.length; pIdx++) {
20005
- const decoded = decodeAuthored(paragraphs[pIdx]).replace(/&lt;eat-sentence&gt;/g, "<eat-sentence>").replace(/&lt;\/eat-sentence&gt;/g, "</eat-sentence>");
20006
- const chunks = decoded.split("<eat-sentence>").map((chunk) => chunk.replace(/<\/eat-sentence>/g, ""));
20005
+ const decoded = decodeAuthored(paragraphs[pIdx]).replace(/&lt;eat-sentence&gt;/g, "<eat-sentence>");
20006
+ const chunks = decoded.split("<eat-sentence>");
20007
20007
  for (const chunk of chunks) {
20008
- const contentfulRe = /((?:<(?!\/?eat-)[^>]+>)*)<eat-contentful>(.*?)<\/eat-contentful>([\s\S]*)/;
20008
+ const contentfulRe = /((?:<(?!\/?eat-)[^>]+>)*)<eat-contentful>([\s\S]*?)<\/eat-contentful>((?:<\/(?!eat-)[^>]+>)*)/;
20009
20009
  const contentfulMatch = contentfulRe.exec(chunk);
20010
20010
  if (contentfulMatch) {
20011
- const beforeRaw = chunk.slice(0, contentfulMatch.index).trim();
20012
- const beforeContentful = decodeNbsp(beforeRaw);
20013
- if (beforeContentful) {
20014
- const processedSentence = hasMathJax(beforeContentful) ? processMathJax(beforeContentful) : beforeContentful;
20015
- segments.push({ id: String(posIndex), text: processedSentence, rawText: beforeRaw, isContentful: void 0 });
20016
- posIndex++;
20017
- }
20018
20011
  const outerOpen = contentfulMatch[1];
20019
20012
  const outerClose = contentfulMatch[3];
20020
- const rawChunk = contentfulMatch[2].trim();
20013
+ const rawChunk = decodeHtmlEntities(contentfulMatch[2].trim());
20021
20014
  const displayText = decodeNbsp(rawChunk);
20022
20015
  if (displayText) {
20023
20016
  const text2 = outerOpen + displayText + outerClose;
@@ -20031,10 +20024,9 @@ const parseSentences = (rawText) => {
20031
20024
  posIndex++;
20032
20025
  }
20033
20026
  } else {
20034
- const rawChunk = chunk.trim();
20035
- const displayText = decodeNbsp(rawChunk);
20036
- if (displayText) {
20037
- const processedText = hasMathJax(displayText) ? processMathJax(displayText) : displayText;
20027
+ const rawChunk = decodeNbsp(decodeHtmlEntities(chunk.trim()));
20028
+ if (rawChunk) {
20029
+ const processedText = hasMathJax(rawChunk) ? processMathJax(rawChunk) : rawChunk;
20038
20030
  segments.push({ id: String(posIndex), text: processedText, rawText: rawChunk, isContentful: void 0 });
20039
20031
  posIndex++;
20040
20032
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eat-js-sdk",
3
- "version": "2.5.7",
3
+ "version": "2.5.8",
4
4
  "change version": "2.5.0",
5
5
  "description": "Authoring tool frontend SDK",
6
6
  "contributors": [