diff --git a/_layouts/embed-preview.html b/_layouts/embed-preview.html index ed906ed..0fdc3f2 100644 --- a/_layouts/embed-preview.html +++ b/_layouts/embed-preview.html @@ -30,8 +30,19 @@
- -
+ +
+ +
+ + + +
diff --git a/_site/embed-preview-script.js b/_site/embed-preview-script.js index 08c6a33..3d9dd76 100644 --- a/_site/embed-preview-script.js +++ b/_site/embed-preview-script.js @@ -177,6 +177,11 @@ class EmbedPreview { if (copyButton) { copyButton.addEventListener('click', () => this.handleCopy()); } + + const editButton = document.getElementById('edit-button'); + if (editButton) { + editButton.addEventListener('click', () => this.handleEdit()); + } } render() { @@ -353,6 +358,30 @@ class EmbedPreview { this.showNotification('Prompt copied to clipboard!'); } + handleEdit() { + // Get current query string + const queryString = window.location.search; + + // Get current URL path parts + const pathParts = window.location.pathname.split('/'); + + // Find index of 'embed-preview' and replace with 'embed' + const embedPreviewIndex = pathParts.findIndex(part => part === 'embed-preview'); + if (embedPreviewIndex !== -1) { + pathParts[embedPreviewIndex] = 'embed'; + } else { + // Fallback: just append /embed/ if embed-preview not found + pathParts.push('embed'); + } + + // Construct new URL + const newPath = pathParts.join('/'); + const newUrl = window.location.origin + newPath + queryString; + + // Open in new tab + window.open(newUrl, '_blank'); + } + async copyToClipboard(text) { if (navigator.clipboard && window.isSecureContext) { await navigator.clipboard.writeText(text); diff --git a/_site/embed-preview/index.html b/_site/embed-preview/index.html index 77e3b31..243bd53 100644 --- a/_site/embed-preview/index.html +++ b/_site/embed-preview/index.html @@ -30,8 +30,19 @@
- -
+ +
+ +
+ + + +
diff --git a/_site/index.html b/_site/index.html index c4b2c21..10538bf 100644 --- a/_site/index.html +++ b/_site/index.html @@ -25,7 +25,7 @@ - +
diff --git a/_site/vibe/index.html b/_site/vibe/index.html index 3d9208d..44208fe 100644 --- a/_site/vibe/index.html +++ b/_site/vibe/index.html @@ -25,7 +25,7 @@ - +
diff --git a/embed-preview-script.js b/embed-preview-script.js index 08c6a33..3d9dd76 100644 --- a/embed-preview-script.js +++ b/embed-preview-script.js @@ -177,6 +177,11 @@ class EmbedPreview { if (copyButton) { copyButton.addEventListener('click', () => this.handleCopy()); } + + const editButton = document.getElementById('edit-button'); + if (editButton) { + editButton.addEventListener('click', () => this.handleEdit()); + } } render() { @@ -353,6 +358,30 @@ class EmbedPreview { this.showNotification('Prompt copied to clipboard!'); } + handleEdit() { + // Get current query string + const queryString = window.location.search; + + // Get current URL path parts + const pathParts = window.location.pathname.split('/'); + + // Find index of 'embed-preview' and replace with 'embed' + const embedPreviewIndex = pathParts.findIndex(part => part === 'embed-preview'); + if (embedPreviewIndex !== -1) { + pathParts[embedPreviewIndex] = 'embed'; + } else { + // Fallback: just append /embed/ if embed-preview not found + pathParts.push('embed'); + } + + // Construct new URL + const newPath = pathParts.join('/'); + const newUrl = window.location.origin + newPath + queryString; + + // Open in new tab + window.open(newUrl, '_blank'); + } + async copyToClipboard(text) { if (navigator.clipboard && window.isSecureContext) { await navigator.clipboard.writeText(text);