Repository navigation
DataSources module #5956
Replies: 2 comments 11 replies
|
Great feature |
|
Hello, I've started trying out this module on the Something that bothers me is the fact you have to hardcode the records' id in your paths: editor.addComponents([
{
type: 'data-variable',
tagName: 'h4',
path: 'comments.c251.name'
}
])This is good as long as I add such components programmatically, so I can parse the data source and create one component per variable per record: editor.DataSources.get('comments').getRecords().forEach(
(record) => {
editor.addComponents([
{
type: 'data-variable',
tagName: 'h4',
path: `comments.${record.id}.name`
}
])
}
)But how should I create some blocks for such components? Also, I found an issue with the grapesjs/packages/core/src/data_sources/index.ts Lines 104 to 105 in 9a6fa0c With the duplicate properties, records with id == 1 can be overriden by records that are second in the array. So if I try to output data from the following endpoint: https://jsonplaceholder.typicode.com/posts/1/comments, I will get a list with:
Should I report it like any regular issue? Should I submit a PR to solve it directly? Thank you for the amazing work so far! |
Uh oh!
There was an error while loading. Please reload this page.
The goal of this new module is to allow loading generic data (eg. from API, DB, etc.) and designing the layout with them.
Some ideas:
Started already something here: https://github.com/GrapesJS/grapesjs/tree/feature/data-sources
All reactions