eat-js-sdk 2.2.9 → 2.2.10
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/dist/interaction-builder.mjs +39 -5
- package/package.json +1 -1
|
@@ -19114,24 +19114,38 @@ const extractHtmlWords = (htmlText) => {
|
|
|
19114
19114
|
}
|
|
19115
19115
|
const words = [];
|
|
19116
19116
|
const openStack = [];
|
|
19117
|
+
const pendingMergeStack = [];
|
|
19117
19118
|
let lastWasSpace = true;
|
|
19118
19119
|
let mergingIntoLast = false;
|
|
19119
19120
|
let mergeDepth = 0;
|
|
19120
19121
|
for (let i = 0; i < tokens.length; i++) {
|
|
19121
19122
|
const tok = tokens[i];
|
|
19122
19123
|
if (tok.type === "space") {
|
|
19124
|
+
for (const t2 of pendingMergeStack) openStack.push(t2);
|
|
19125
|
+
pendingMergeStack.length = 0;
|
|
19123
19126
|
lastWasSpace = true;
|
|
19124
19127
|
continue;
|
|
19125
19128
|
}
|
|
19126
19129
|
if (tok.type === "open") {
|
|
19127
|
-
if (
|
|
19128
|
-
mergingIntoLast = true;
|
|
19129
|
-
mergeDepth = 1;
|
|
19130
|
-
words[words.length - 1].value += tok.value;
|
|
19131
|
-
} else if (mergingIntoLast) {
|
|
19130
|
+
if (mergingIntoLast) {
|
|
19132
19131
|
mergeDepth++;
|
|
19133
19132
|
words[words.length - 1].value += tok.value;
|
|
19133
|
+
} else if (!lastWasSpace && words.length > 0) {
|
|
19134
|
+
if (isSuperSubTag(tok.value)) {
|
|
19135
|
+
const pendingDepth = pendingMergeStack.length;
|
|
19136
|
+
for (const t2 of pendingMergeStack) {
|
|
19137
|
+
words[words.length - 1].value += t2;
|
|
19138
|
+
}
|
|
19139
|
+
pendingMergeStack.length = 0;
|
|
19140
|
+
mergingIntoLast = true;
|
|
19141
|
+
mergeDepth = pendingDepth + 1;
|
|
19142
|
+
words[words.length - 1].value += tok.value;
|
|
19143
|
+
} else {
|
|
19144
|
+
pendingMergeStack.push(tok.value);
|
|
19145
|
+
}
|
|
19134
19146
|
} else {
|
|
19147
|
+
for (const t2 of pendingMergeStack) openStack.push(t2);
|
|
19148
|
+
pendingMergeStack.length = 0;
|
|
19135
19149
|
openStack.push(tok.value);
|
|
19136
19150
|
}
|
|
19137
19151
|
continue;
|
|
@@ -19144,6 +19158,24 @@ const extractHtmlWords = (htmlText) => {
|
|
|
19144
19158
|
mergingIntoLast = false;
|
|
19145
19159
|
mergeDepth = 0;
|
|
19146
19160
|
}
|
|
19161
|
+
} else if (pendingMergeStack.length > 0) {
|
|
19162
|
+
const closingName = getTagName(tok.value);
|
|
19163
|
+
let found = false;
|
|
19164
|
+
for (let j = pendingMergeStack.length - 1; j >= 0; j--) {
|
|
19165
|
+
if (getTagName(pendingMergeStack[j]) === closingName) {
|
|
19166
|
+
pendingMergeStack.splice(j, 1);
|
|
19167
|
+
found = true;
|
|
19168
|
+
break;
|
|
19169
|
+
}
|
|
19170
|
+
}
|
|
19171
|
+
if (!found) {
|
|
19172
|
+
for (let j = openStack.length - 1; j >= 0; j--) {
|
|
19173
|
+
if (getTagName(openStack[j]) === closingName) {
|
|
19174
|
+
openStack.splice(j, 1);
|
|
19175
|
+
break;
|
|
19176
|
+
}
|
|
19177
|
+
}
|
|
19178
|
+
}
|
|
19147
19179
|
} else {
|
|
19148
19180
|
const closingName = getTagName(tok.value);
|
|
19149
19181
|
for (let j = openStack.length - 1; j >= 0; j--) {
|
|
@@ -19158,6 +19190,8 @@ const extractHtmlWords = (htmlText) => {
|
|
|
19158
19190
|
if (mergingIntoLast) {
|
|
19159
19191
|
words[words.length - 1].value += tok.value;
|
|
19160
19192
|
} else {
|
|
19193
|
+
for (const t2 of pendingMergeStack) openStack.push(t2);
|
|
19194
|
+
pendingMergeStack.length = 0;
|
|
19161
19195
|
words.push({ value: tok.value, openStack: [...openStack] });
|
|
19162
19196
|
}
|
|
19163
19197
|
lastWasSpace = false;
|