Rosey/markdown-draft-js

Add more parameters to DraftToMarkdownOptions.entityItems.open/close

Closed this issue · 2 comments

Hello @Rosey,

Thanks for this nice module, I am currently enjoying adding it in our project and I am really happy about how we can handle things with it!
I will be happy to contribute to add more attributes to the open/close functions so that we can have the current block of the entity we are processing. The use case is quite simple (but useful):

In a text editor, I want to serialize things differently based on the block type.

If I take the well known Slack as example, when we are in a code block, we can mention someone, but the serialized data will be a simple text like @John Doe. On a quote block, the serialized data will be a more complex object, like [@John:123456789] for example.

If it makes sense, I will send a pull request adding block in the open/close as second argument to not break things, and will also update the DefinitelyTyped definitions.

What do you think about it?

Rosey commented

Thanks! Just merged 🙂

Rosey commented

(Released with 2.4.0)