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.
@@ -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 = node.param ?? 0;
335
+ r = value;
334
336
  hasComponents = true;
335
337
  }
336
338
  else if (node.word === 'green') {
337
- g = node.param ?? 0;
339
+ g = value;
338
340
  hasComponents = true;
339
341
  }
340
342
  else if (node.word === 'blue') {
341
- b = node.param ?? 0;
343
+ b = value;
342
344
  hasComponents = true;
343
345
  }
344
346
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-rtf-editor",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "RTF viewer and rich-text editor components for Svelte 5",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/jcelano/svelte-rtf-editor#readme",