-
Notifications
You must be signed in to change notification settings - Fork 233
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
base: master
Are you sure you want to change the base?
Conversation
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; |
There was a problem hiding this comment.
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.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this 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; |
There was a problem hiding this comment.
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).
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 :) |
It allows to render block inside wrapper without leaving styles (#33).