I have a case where I need to conditionally skip the custom render when using a custom block renderer map. The code already supports the ability to skip if null is returned but this is blocked by type linting. Can we make changes to the TypeScript and Flow definitions to allow BlockRenderer to be string or null. This is my sample code:
blockRenderers: {
unstyled: (block: Draft.ContentBlock): string | null => {
if (block.getText().trim() === '') {
return '';
}
return null;
}
}
I can open a PR to do this but wanted to see if there were any arguments against this first.
The change would be to
|
type BlockRenderer = (block: draftjs.ContentBlock) => string; |
and
|
type BlockRenderer = (block: ContentBlock) => ?string; |
I have a case where I need to conditionally skip the custom render when using a custom block renderer map. The code already supports the ability to skip if
nullis returned but this is blocked by type linting. Can we make changes to the TypeScript and Flow definitions to allowBlockRendererto bestringornull. This is my sample code:I can open a PR to do this but wanted to see if there were any arguments against this first.
The change would be to
draft-js-utils/packages/draft-js-export-html/typings/index.d.ts
Line 8 in 7174891
draft-js-utils/packages/draft-js-export-html/src/stateToHTML.js
Line 33 in 0ff3a0c