svelte-rtf-editor 1.8.0 → 1.8.1
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/rtf-parser.js +7 -4
- package/package.json +1 -1
package/dist/rtf-parser.js
CHANGED
|
@@ -185,13 +185,16 @@ function tokenize(rtf) {
|
|
|
185
185
|
if (i >= len)
|
|
186
186
|
break;
|
|
187
187
|
const next = rtf[i];
|
|
188
|
-
// Hex escape \'xx
|
|
188
|
+
// Hex escape \'xx. One without two hex digits after it is damaged: it is dropped, and
|
|
189
|
+
// what follows it is read as usual, rather than turned into a NUL or a control character.
|
|
189
190
|
if (next === "'") {
|
|
190
191
|
i++;
|
|
191
192
|
const hex = rtf.substring(i, i + 2);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
if (/^[0-9a-fA-F]{2}$/.test(hex)) {
|
|
194
|
+
i += 2;
|
|
195
|
+
const code = parseInt(hex, 16);
|
|
196
|
+
tokens.push({ type: 'text', value: String.fromCharCode(WINDOWS_1252_C1[code - 0x80] ?? code) });
|
|
197
|
+
}
|
|
195
198
|
}
|
|
196
199
|
// Special escapes
|
|
197
200
|
else if (next === '\\' || next === '{' || next === '}') {
|
package/package.json
CHANGED