Skip to content

Commit

Permalink
Merge pull request #25 from SimplyEdit/feature/preview-component-css
Browse files Browse the repository at this point in the history
Feature/preview component css
  • Loading branch information
ylebre authored Mar 13, 2024
2 parents 045936d + a5dd48a commit f2c8526
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
var componentNameField = simplyApp.actions.getComponentNameField(component);
editor.pageData.component.parts[component].forEach(function(part) {
var found = false;
editor.pageData.app[component].forEach(function(appPart) {
editor.pageData.app[component].forEach(function(appPart, appIndex) {
if (part[componentNameField] && (appPart[componentNameField] == part[componentNameField])) {
appPart = JSON.parse(JSON.stringify(part));
for (i in part) {
editor.pageData.app[component][appIndex][i] = part[i];
}
found = true;
}
});
Expand All @@ -43,6 +45,10 @@
});
}

document.querySelectorAll("[data-simply-transformer=simplyPreviewComponent]").forEach(function(element) {
element.innerHTML = editor.transformers.simplyPreviewComponent.render.call(element, element.dataBinding.get());
});

simplyApp.commands.autoRunPreviews()
}, 500);
}
Expand Down
10 changes: 8 additions & 2 deletions www/api/data/generated.html
Original file line number Diff line number Diff line change
Expand Up @@ -3837,9 +3837,11 @@ <h1>App preview</h1>
var componentNameField = simplyApp.actions.getComponentNameField(component);
editor.pageData.component.parts[component].forEach(function(part) {
var found = false;
editor.pageData.app[component].forEach(function(appPart) {
editor.pageData.app[component].forEach(function(appPart, appIndex) {
if (part[componentNameField] && (appPart[componentNameField] == part[componentNameField])) {
appPart = JSON.parse(JSON.stringify(part));
for (i in part) {
editor.pageData.app[component][appIndex][i] = part[i];
}
found = true;
}
});
Expand All @@ -3849,6 +3851,10 @@ <h1>App preview</h1>
});
}

document.querySelectorAll("[data-simply-transformer=simplyPreviewComponent]").forEach(function(element) {
element.innerHTML = editor.transformers.simplyPreviewComponent.render.call(element, element.dataBinding.get());
});

simplyApp.commands.autoRunPreviews()
}, 500);
}
Expand Down
10 changes: 8 additions & 2 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3837,9 +3837,11 @@ <h1>App preview</h1>
var componentNameField = simplyApp.actions.getComponentNameField(component);
editor.pageData.component.parts[component].forEach(function(part) {
var found = false;
editor.pageData.app[component].forEach(function(appPart) {
editor.pageData.app[component].forEach(function(appPart, appIndex) {
if (part[componentNameField] && (appPart[componentNameField] == part[componentNameField])) {
appPart = JSON.parse(JSON.stringify(part));
for (i in part) {
editor.pageData.app[component][appIndex][i] = part[i];
}
found = true;
}
});
Expand All @@ -3849,6 +3851,10 @@ <h1>App preview</h1>
});
}

document.querySelectorAll("[data-simply-transformer=simplyPreviewComponent]").forEach(function(element) {
element.innerHTML = editor.transformers.simplyPreviewComponent.render.call(element, element.dataBinding.get());
});

simplyApp.commands.autoRunPreviews()
}, 500);
}
Expand Down

0 comments on commit f2c8526

Please sign in to comment.