Skip to content

Commit

Permalink
feat: open each module preview in distinct tabs
Browse files Browse the repository at this point in the history
Co-authored-by: Diane Cordier <diane.cordier@pix.fr>
Co-authored-by: Aurélie Crouillebois <aurelie.crouillebois@pix.fr>
  • Loading branch information
3 people committed Oct 8, 2024
1 parent e3f30d5 commit 0aa32b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ <h2>JSON à copier/coller</h2>

const previewButton = document.querySelector('#preview-button');
previewButton.addEventListener('click', () => {
const previewWindow = window.open('https://app.pix.fr/modules/preview', 'modulix-preview');
const moduleContent = editor.getValue();
const windowName = `modulix-preview-${moduleContent.id}`;
const previewWindow = window.open('https://app.dev.pix.fr/modules/preview', windowName);
window.setTimeout(() => {
const moduleContent = editor.getValue();
previewWindow.postMessage({ from: 'modulix-editor', moduleContent }, '*');
}, 1000);
});
Expand Down

0 comments on commit 0aa32b4

Please sign in to comment.