svelte-rtf-editor 1.8.2 → 1.8.3
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 +5 -3
- package/package.json +1 -1
package/dist/rtf-parser.js
CHANGED
|
@@ -329,16 +329,18 @@ function parseColorTable(group) {
|
|
|
329
329
|
}
|
|
330
330
|
for (const node of group.children) {
|
|
331
331
|
if (node.type === 'control') {
|
|
332
|
+
// A component outside 0 to 255 is damaged: it is held to the nearest end of the range.
|
|
333
|
+
const value = Math.min(255, Math.max(0, node.param ?? 0));
|
|
332
334
|
if (node.word === 'red') {
|
|
333
|
-
r =
|
|
335
|
+
r = value;
|
|
334
336
|
hasComponents = true;
|
|
335
337
|
}
|
|
336
338
|
else if (node.word === 'green') {
|
|
337
|
-
g =
|
|
339
|
+
g = value;
|
|
338
340
|
hasComponents = true;
|
|
339
341
|
}
|
|
340
342
|
else if (node.word === 'blue') {
|
|
341
|
-
b =
|
|
343
|
+
b = value;
|
|
342
344
|
hasComponents = true;
|
|
343
345
|
}
|
|
344
346
|
}
|
package/package.json
CHANGED