Skip to content

Export fails when paste with unknown color #2176

@AntoLC

Description

@AntoLC

Describe the bug

When we copy a text that has a style attach, and paste it in the doc, the export will then fails (pdf / odt / docx..).

How to reproduce

  • Copy any text from github
  • Paste it to a doc
  • Export
  • The export fails

Why

A paste color can be in rgb:

Image

Problem location

: this.options.colors[
props.backgroundColor as keyof typeof this.options.colors
].background,

: this.options.colors[
props.textColor as keyof typeof this.options.colors
].text,

The array is possibly undefined, it should be something like:
this.options.colors?.[props.backgroundColor as keyof typeof this.options.colors]?.background

https://github.com/search?q=repo%3ATypeCellOS%2FBlockNote%20props.textColor%20as&type=code

Misc

  • Node version:
  • Package manager:
  • Browser:
  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions