-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
Separating Schema label from code identifier #304
Conversation
@@ -219,7 +219,7 @@ describe('checkPlugins test', () => { | |||
pdf: async () => {}, | |||
ui: async () => {}, | |||
propPanel: { | |||
propPanelSchema: {}, | |||
schema: {}, |
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.
This fix is not directly related to this PR.
|
||
const pluginsSchemaTypes = Object.keys(plugins); |
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.
Stopped using the 'plugins' key.
@@ -62,7 +55,9 @@ const generate = async (props: GenerateProps) => { | |||
continue; | |||
} | |||
|
|||
const render = rendererRegistry[schema.type]; | |||
const render = Object.values(plugins).find( | |||
(plugin) => plugin.propPanel.defaultSchema.type === schema.type |
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.
There may be users who are only using the generator, but accessing plugin.propPanel.defaultSchema.type
feels a bit awkward. Should it be accessible through plugin.type
instead?
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 might be overthinking this. If it doesn't feel awkward as is, I'd like to keep it that way.
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.
plugin.type
would be syntactically cleaner, but plugin.propPanel.defaultSchema.type
is not a problem to use 👍
@@ -1,11 +1,3 @@ | |||
import type { Schema, PDFRenderProps } from '@pdfme/common'; |
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.
We just use plugin.
This was a welcome side effect.
Thank you for making this proposal.
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.
this is looking a lot cleaner 👍
@@ -62,7 +55,9 @@ const generate = async (props: GenerateProps) => { | |||
continue; | |||
} | |||
|
|||
const render = rendererRegistry[schema.type]; | |||
const render = Object.values(plugins).find( | |||
(plugin) => plugin.propPanel.defaultSchema.type === schema.type |
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.
plugin.type
would be syntactically cleaner, but plugin.propPanel.defaultSchema.type
is not a problem to use 👍
ref: #303