Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generator parameter to custom block renderer #174

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alexander-zolotykh
Copy link

It allows to render block inside wrapper without leaving styles (#33).

It allows to render block inside wrapper
@@ -30,7 +30,7 @@ type RenderConfig = {
style?: StyleDescr;
};

type BlockRenderer = (block: ContentBlock) => ?string;
type BlockRenderer = (block: ContentBlock, generator: MarkupGenerator) => ?string;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second parameter should be optional.

Suggested change
type BlockRenderer = (block: ContentBlock, generator: MarkupGenerator) => ?string;
type BlockRenderer = (block: ContentBlock, generator?: MarkupGenerator) => ?string;

type BlockStyleFn = (block: draftjs.ContentBlock) => RenderConfig|undefined;
type EntityStyleFn = (entity: draftjs.EntityInstance) => RenderConfig|undefined;
type BlockRenderer = (block: draftjs.ContentBlock) => string;
type BlockRenderer = (block: draftjs.ContentBlock, generator: MarkupGenerator) => string;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Owner

@sstur sstur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting closer.

@@ -30,7 +30,7 @@ type RenderConfig = {
style?: StyleDescr;
};

type BlockRenderer = (block: ContentBlock) => ?string;
type BlockRenderer = (block: ContentBlock, generator?: MarkupGenerator) => ?string;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you will also need to define a type for MarkupGenerator in this file (not to be confused with the typescript definitions which are totally different).

@botanicus
Copy link

Hey @alexander-zolotykh I wonder whether you'd be finishing the PR? // cc @sstur

I have the same issue and I'm trying to see my options for making it work.

Thanks for the reply :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants